Wednesday, August 01, 2012

8. FATX File Types - Part 2 PIRS and LIVE Files

Following on from Part 1 of this post we will now look at the PIRS and LIVE Files. Both PIRS and LIVE files are classified as read-only files. They are signed by Microsoft using a private key that is kept in a secure and safe location somewhere in the Redmond offices. The corresponding public key is located on the XBox itself. It is used to verify the signature and ensure that these files are authentic, approved XBox files. This method prevents any unauthorised 3rd party applications from being installed on the XBox.


PIRS & LIVE Files


PIRS & LIVE files as discussed in the previous blog entry are signed and delivered by Microsoft to the XBox. PIRS files differ from LIVE files in that they are not delivered to the XBox through the XBox Live service[1]. An example of these files would be system and dashboard updates, themes and Gamertags. From Fig 8.6 below you can see the PIRS Signed Files are located in the System Auxiliary Partition of the drive.

Fig 8.6  PIRS Signed Files.




Using the Toolkit Hex View option we can confirm that the file is in fact a PIRS file. Fig 8.7 shows the file details in Hex form.

Fig 8.7 Hex View of the PIRS file




Using the PIRS file details obtained from http://free60.org/STFS  we constructed a function within the Toolkit. This function parses CON, LIVE and PIRS files and display the details in a form. Fig 8.8 shows the output details of a selected PIRS file.

Some important pieces of information that were gathered from this file were as follows:


Header Information

PIRS FILE Magic Number = PIRS
This is the magic number for the file and tells us that the file is in fact an STFS Content File.Package Signature = B9D1496CF257E0F2E9E74C5707F315E926509F0F05DCD0E04BBFA24E931EDA8103D79D15BAC60E3E4143195FCF1D38EAB0C3EB57227D32093D9172E16A2BFBA3857B7C62F8054C4540184503EBAF19B01B361D6E4BE8479AB53727B848AC1CBED2E62F5B5100E06D968BE2021E730C81EAAA3C3AF1D1ABE6A9FBF2F48D164D6BD10475A32AB8199D21DB95FF4A947D52AE433BDE2F3698F8BA3A070C03F2B9E0AE003826816E6D8F03F1F34EDD6AC51193DCB6F864F5F03E42B4A88AF8410D079C5F4805AEB379DC8B76D3BA2E004414A1695C1E2701A0B069AE071949EA3C1CF163667F4306EA3A03BEDC167A4E2C95FE507A34557E95BB370409D772C8FC50
The Package Signature is generated using the SHA1 hash that is detailed in the Metadata below.

Metadata Details         

The Metadata of STFS packages is used by the dashboard to read data such as "the title, the licenses and the RSA signature which is used to verify the package"[1]. This information can be seen below

SHA1 Hash = 670448712300C0ECCE47F3D9A6D3C484DA634F81
This value is used to create the package signature for LIVE and PIRS files.

Display Name = AvatarAsset
Publisher Name = Microsoft
These values are the Friendly Display Name of the file that is being viewed. It also provides the name of the Publisher

Fig 8.8 PIRS File Details

From Fig 8.9 below you can see the LIVE Signed Files are located in the System Auxiliary Partition of the drive.

Fig 8.9 LIVE Signed Files.


Using the Toolkit Hex View option we can confirm that the file is in fact a LIVE file. Fig 8.10 shows the file details in Hex form.

Fig 8.10 Hex View of the LIVE file


Using the LIVE file details obtained from http://free60.org/STFS  we constructed a function within the Toolkit. This function parses CON, LIVE and PIRS files and display the details in a form. Fig 8.11 shows the output details of some selected LIVE files. 

Fig 8.11 File Details of a LIVE file
























Some important pieces of information that were gathered from this file were as follows:


Header Information

PIRS FILE Magic Number = LIVE
This is the magic number for the file and tells us that the file is in fact an STFS Content File.Package Signature = 5A873F2DBC00EBEA4B441118D3F5E2226BF65F8191CB2FD5343D11BEFB432795E47379E48C23EE4766309BF052816D61E8A08CD959D9AE98341739B3793D17DAA3B21E3DDB3411783B9357F7D5523ECC8455FE918C29AAD199DBD048ACB5228C8CA0900B9E3D7ACFE0BAF353E562AAABD9CE467F72B01F3392FC3371A175D7E13D6E74FFD4FE72BFDC251E8AF4C78E2D3902DAECCEEE45FA2FB338A383EEA787F01AB56F293846BCB03F950E4D94C1964AE7AE8EC800293EF60F127F4D0835DB597662F02109D3334F4985EAF5411E103854F3E6B3AC89CD208DC5837A27E617969032CBBCE8852468D8B4B4FA6D5F304E3845586F3BA81FE379FB7AD718EFA8

The Package Signature is generated using the SHA1 hash that is detailed in the Metadata below.

Metadata Details         

The Metadata of STFS packages is used by the dashboard to read data such as "the title, the licenses and the RSA signature which is used to verify the package"[1]. This information can be seen below

SHA1 Hash = D6FFF1F3474C79F3FEA07AE3010BAC94A91CEA64
This value is used to create the package signature for LIVE and PIRS files.

Display Name = DOOM IIDOOM IIDOOM IIDOOM II
Display Description = DOOM II - the first person classic that spawned a gaming revolution.DOOM II - le classique du jeu de tir en vue subjective ? l'origine d'une r?volution du jeu vid?o.DOOM II - El cl?sico en primera persona que origin? una revoluci?n en los videojuegos.DOOM II - Il classico in prima persona che ha rivoluzionato il modo di giocare.
Publisher Name = 
Title Name = DOOM II
These values are the Friendly Display Name of the file that is being viewed. It also provides the Display Description in a number of different languages as well as the Title Name

In Summary:

As the private key for PIRS and LIVE files is not available to us we are unable to resign these files after editing them. There are a number of tools available that will allow a user to load a PIRS file, view the details of the file and extract the contents. wxPIRS is an example of this type of application [2]. You can see the details of  the file used in this Blog  in Fig 8.12 below. Fig 8.13,14 & 15 are examples of 3 types of LIVE files. We selected the DOOM 2 Game, Facebook Application and HALO4 Video file to show the differences between them. You will see from the images that the Game file contains the xex executable as well as the game resource file (images and text file). The HALO4 file contains a windows media file and the Facebook file contains a single executable.
Fig 8.12 wxPirs extract of a PIRS file.





































Fig 8.13 wxPirs extract of a LIVE Game file. 


Fig 8.14 wxPirs extract of a LIVE Application file.




























Fig 8.15 wxPirs extract of a LIVE Video file. 















[1] BOX 360 Forensics: A Digital Forensics Guide to Examining Artifacts - Steven Bolt
[2] WXPIRS - http://www.thetechgame.com/Downloads/id=580/wxpirs.html#details

Saturday, July 28, 2012

8. FATX File Types - Part 1 CON Files

Any files or packages that are downloaded, created or used by the XBOX 360 file system are part of a secure system called Secure Transacted File System (STFS)[1]. Files that are part of the SFTS use SHA1 hashes, encryption and RSA signatures for a number of different security purposes. In some cases these files are protected to prevent unauthorized editing and copy protection. In other cases the files are protected for integrity purposes, to ensure that the information contained within them is valid and correct. Some files are signed in order to identify which specific console they below too. STFS files fall into 2 main categories, read-only files and writable files. Read-only files are downloaded from the XBox Live service. They are signed using a Microsoft Private key which is known only to Microsoft. The corresponding public key for these files is located on the XBox console. Writable files are signed using a console specific private key. The public/private key pair for writable files is located on the local XBox. There are 3 main files that fall into these categories. These files can be identified from their header information and are documented on the Free 60 website [1]. These files are as follows:

  1. CON Files 
  2. LIVE Files
  3. PIRS Files
This Blog entry will explain and discuss the first of these 3 files in detail, it will detail their purpose and functions within the FATX file system.


CON Files


CON Files are content files that are specific to the console on which they are stored. Examples of these types of files are Profile related files, cached files and save games. CON files are writable files. An example of a CON file that was recovered from the XBox drive was a save game for Fable 3. This save game was discussed in more in an earlier blog entry.

From Fig 8.1 below you can see the Save Game is located in the Data Partition of the drive.

Fig 8.1  Fable 3 Save Game.

















Using the Toolkit Hex View option we can confirm that the save game is in fact a CON file. Fig 8.2 shows the file details in Hex form.

Fig 8.2 Hex View of the Fable 3 Save Game CON file

























You will immediately notice from Fig 8.2 that the information located at bytes 11-21 (X803405-001) is the Console ID number that was located originally in the Josh Sector. This information is important as it provides the first link between the save game file and the console that created it.

Using the CON file details obtained from http://free60.org/STFS  we constructed a function within the Toolkit. This function parses CON, LIVE and PIRS files and display the details in a form. Fig 8.3 shows the output details of a selected CON file.

Some important pieces of information that were gathered from this file were as follows:


Header Information

CON FILE Magic Number = CON 
This is the magic number for the file and tells us that the file is in fact an STFS Content File.
Certificate Owner Console ID = 031B12E836
This the ID number of  the console that created the content file. You will notice that this is the same number that is identified in the JOSH sector in Fig 8.4. This is the first link between the files located on the XBox drive and the console on which they were created/stored.Certificate Owner Console PartNumber = X803405-001This is the Console Part number used by Microsoft for bill of materials purposes. It identifies the XBox console as opposed to the hard drive. This value was common to all drives that were used with this particular XBox. The corresponding Part Number can be seen in details can be seen in the JOSH sector in Fig 8.4 below. 
PublicExponent = 00010001
PublicModulus = FEF248CCC2BAF5318DA48850C7447F81F05DF3049D5C6B44135255D3359B660FCF6CF7FCDF49357A57AE06456CB71259AB91F9C7745A8B4465DBC139E32636470A19DBB2BA7207B72CE74BED945D9D8708776B692D065136376A627238C65E897E56B01B1C3B48815BAEDA155FA34B8F5CDA992DBA984943D2F77C77685912ED
Both the Public Exponent and the Modulus are used to represent the Public key in the RSA Algorithm 
"The public key has modulus n and the public (or encryption) exponent e. The private key has modulus n and the private (or decryption) exponent d, which is kept secret." [2][3]
Both these values can be also seen in the JOSH sector and give additional links between the CON files and the local machine.

Metadata Details         

The Metadata of STFS packages is used by the dashboard to read data such as "the title, the licenses and the RSA signature which is used to verify the package"[1]. This information can be seen below


SHA1 Hash = CBF3A214359B2D3EE545D8B33E9A4886EC6F6F0C
This value is used to create the package signature for LIVE and PIRS files.
Content Type = Saved Game
The content Type is a number that identifies the purpose of the CON file. A full list is available here.
Profile ID = EF5AC380484FEBF5
This is the Profile ID number that identifies the Gamer Profile that this particular file has been signed for.
Device ID = 0S8AEJL0180029 
This is the ID of the Device the current file was signed on.
Title Name = Fable III
This is the Title ID of the STFS package in question.





Fig 8.3 CON File Details
Fig 8.4 JOSH Sector Details
Fig 8.5 Security Sector Details

In Summary:

There are a number of tools available that will allow a user to load a CON Save Game file and view the details of the file. Xbox 360 Content Manager  is an example of this type of application [9]. In order to edit and resign these save game files the private key known as the KeyVault file is needed. This file is obtained from the XBox260 memory by dumping the NAND file [11,12]. Once you have obtained the NAND file you can extract the KeyVault from the NAND file [13].

In the keyvault of every Xbox 360 is a unique CON keypair that is used for signing CON files. The public key component of this keypair is signed by Microsoft to ensure that arbitrary keypairs cannot be used.
A copy of the public key and its signature is stored in each CON file. This allows Xbox 360 consoles to verify CON files that may be signed by other Xbox 360 consoles.Because the signing keys are per-box, individual consoles can have their keypair revoked in firmware updates. [10]


Once you have the KeyVault you can use the CONSign application [10] to resign the package. This will allow the user to edit a save game or a profile file and associate it with a new profile or device.


[1] http://free60.org/STFS 
[2] https://sites.google.com/site/danzcosmos/the-rsa-algorithm
[3] http://imps.mcmaster.ca/courses/SE-4C03-07/wiki/wrighd/rsa_alg.html
[4] CON File Details: http://www.xboxhacker.org/index.php?PHPSESSID=a44d456f74ffa66bfb4c75d7e5fafe4c&topic=9941.msg64084#msg64084
[5] CONFile Resigning: http://www.se7ensins.com/forums/threads/con-resigning-explained.40085/
[6] CON File Resigning Tool: http://insomniacgamerz.net/forums/modding-programs/14097-concept-0-3-feudalnates-con-resigner.html
[7] Modding Tools: http://www.mcmgaming.co.uk/modding-tools
[8] Profile Tool http://www.mediafire.com/?r5766389se9oyzo
[9] Xbox 360 Content Manager http://www.homebrew-connection.org/xbox-360-content-manager-v3-0/?utm_source=rss&utm_medium=rss&utm_campaign=xbox-360-content-manager-v3-0
[10] ConSign http://forums.xbox-scene.com/index.php?showtopic=654564
[11] How to Dump your NAND - http://www.thetechgame.com/Tutorials/id=201/how-to-dump-your-current-nand-from-your-jtag-using-flash360.html
[12] NAND Reading- http://www.free60.org/NAND_Reading
[13] How to Extract your Keyvault (KV.bin)
- http://www.se7ensins.com/forums/threads/how-to-extract-your-keyvault-kv-bin.47671/

Saturday, July 21, 2012

7. Forensic Analysis of the Drive

This blog post will discuss the preparation involved prior to the forensic examination of the XBOX Drive. 7 drive images were created. Each image contains a different stage of the process. The name and details of each stage is as follows:


Stage 0. Base Drive

This is the base image file as obtained out of the box.


Stage 1. Drive Formatted using XBox 360 Formatting Utility

This image was created after the XBox360 format utility was run.

Stage 2. Live Profile Downloaded

XBox Live profile was downloaded and configured. Gamer tag was setup as well as an Avatar.

Stage 3. Games and Video Downloaded from Live, Game Installed from DVD

2 XBox Live Arcade games were downloaded. These were

  • Doom2
  • Street Fighter 2

A third game was installed to the local hard drive from the game DVD. This game was called

  • Fable 3

A game video was downloaded from the Marketplace called

  • Halo4

Stage 4. Facebook and Twitter Application downloaded and Installed


Stage 5. Fable 3 Played and Save Game Created


  • Facebook Logged in
  • Twitter Logged in

Stage 6. Game Played and Save Game Created

Fable 3 was loaded, played and a save game was created
Logged into Messenger and a conversation was created

Forensic Examination Process

The process of examining the effect each of these steps have on the XBox drive is calculate by comparing the drive at each of the 7 intervals discussed above. In order to do this we will extract each of the partitions from the Drive Image for each of the 7 stages. To do this we will.

  • We will compare each of the partitions from each sequential image and note any changes.
  • Do string searches for particular items in each image and note the number of instances recorded
  • Check SHA1 Hash Values of each of the string searches to identify if the hash values are stored. This is of particular interest for Passwords. We will attempt to discover if the passwords that are hashed were done so with a SALT value.
  • We will compare the files and folders identified from the toolkit to identify what are added with each iteration. 
  • Finally we will check the Josh and Security Sector Between each iteration for any differences that can be found.

Wednesday, July 18, 2012

6. FATX Files

The first step that was performed to investigate the drive was to do an ASCII search for terms that would represent files that are located on the drive. In order to facilitate this a video and a game demo were downloaded from the XBox Live system to the drive. These downloads can be seem in Fig 6.1 below.

The game demo downloaded was Fable 3. Two Xbox Arcade Games were downloaded, they were Doom 2 and Street Fighter 2. A Halo 4 game video was downloaded on Zune Marketplace.

Fig 6.1 Xbox Arcade Games, Demos and Halo 4 videos downloaded from XBox Live.

WP_000004WP_000005

Now that we have confirmed the files that were downloaded we searched the drive image for the following strings

  1. “Doom” - Found 51 occurrences of ‘Doom’.
  2. “FableIII” - Found 12 occurrences of 'fableIII'.
  3. “Street Fighter” - Found 2 occurrences of ‘Street Fighter’.
  4. “Halo4” - Found 1 occurrence of ‘Halo4’.

1. Doom Search Results

DOOM

2. FableIII search results

FABLE3

3. Street Fighter search results

SF2

4. Halo 4 search results

HALO4

The results of this search gives us some indication of where the files related to these applications/video are located.

Doom 3 search info is located in Data Partition only

Fabel 3 Game search info located in Data partition except for 2 entries which are located in the Game Cache Partition

Street Fighter Game search info located in Data Partition

Halo 4 Video info is located in the Game Cache Partition

In the next blog we will investigate the file types themselves.

Monday, July 16, 2012

5. FATX Partition Details


This blog entry covers the configuration and details of partitions In the FATX file system. From “XBOX 360 Forensics”[1] we discover that FATX partitions are identified by the magic number XTAF at the start of the sector.

Doing a search of the drive image for the string XTAF we find 6 instances. These represent the 6 main partitions on the drive. The details of the partitions can be found at http://free60.org/FATX. Fig 5.1 shows the partition information

Fig 5.1 – Partition information for FATX

Capture

The first 16bytes of information on each partition represents the partition header. The header contains the Magic number, the partition ID, the numbers of sectors per cluster and the Root directory cluster for the partition in question. Using the 010 editor we extracted this information for each of the headers from our image.

Fig 5.2 - Partition Header Information

SystemClusterGameSectorSysExtSysext2

Data

Now that we have identified the partitions in the FATX file system, we can take a closer look at the contents of each partition. Identify the files and directory structure and begin our forensic investigation into the contents.

Monday, June 18, 2012

4.Introduction to FATX

Drive Details
In a traditional file system such as FAT32 or NTFS information about the file system is stored at the physical sector 0 of the hard drive. This sector would contain information about the partitions on the drive as well as the location of the operating system boot files.

On examination of the Xbox360 however we note that it is capable of booting into the Operating System without any media or USB drives attached.  Before we take a look at the drive image we will investigate the FTK Imager log file to ascertain some initial basic information about the image. From Fig 4.1 we identified that the drive image contains 39,070,080 sectors which are 512Bytes in size.
 Fig 4.1 - FTK Imager Log File


Armed with the sector size information we look at the drive image and notice that there is no information in the first 15 sectors. Each of these sectors has a zero value as per the image below:
Fig 4.2 Sector 0 of the drive image using 010 Editor

Due to the fact that here is no information located in sector zero as well as the fact that the Xbox can boot independent of media; we can deduce that the Xbox360 operating system is stored elsewhere within the system. 

FATX Partition Header
The first sector that contains information is sector 16 beginning at offset 0x000002000

Fig 4.3 Sector 16 of the drive image - Security Sector


Using the partition information[1] (fig 4.4) we are able to identify the details of the partitions on the XBox Drives as well as their offsets. From this information we established that the information provided in Sector 16 is the beginning of the Security Sector. 
Fig 4.4 Partition Information of the XBox360 Drive
Offset
Length
Information
Format
0x2000
0x204 - 0x80000
Security Sector
Binary
0x80000
0x80000000
System Cache
SFCX (Secure File Cache for Xbox)
0x80080000
0xA0E30000
Game Cache
SFCX (Secure File Cache for Xbox)
0x10C080000
0xCE30000
SysExt
FATX ("Sub"-Partition)
0x118EB0000
0xCE30000
SysExt2
FATX ("Sub"-Partition)
0x120eb0000
0x10000000
Xbox 1 Backwards Compatibility
FATX
0x130eb0000
end of drive
Data
FATX



The security sector is used by the XBox to identify the size, type and authenticity of the hard drive in question. It allows Microsoft to control the hardware being used by the XBox and will prevent unauthorized equipment from being used. To do this the security sector contains information such as the drive Serial Number, Size, Firmware revision, model number and the number of hash values. it begins at the 16th sector on the drive at offset 0x2000.

Using the security sector offset details[2] (Fig 4.5) we constructed a template for the 010 editor to identify and extract the security sector details from the drive image

Fig 4.5 Security Sector Header Information

Offset
Length
Type
Information
0x0
0x14
ascii string
Serial Number
0x14
0x8
ascii string
Firmware Revision
0x1C
0x28
ascii string
Model Number
0x44
0x14
bytes
MS Logo Hash
0x58
0x4
unsigned int
Number of Sectors on drive
0x5C
0x100
bytes
RSA Signature
0x200
0x4
signed int
MS Logo Size
0x204
MS Logo Size
image
MS Logo


The template when applied to the drive image provided us with the drive information as follows.

Fig 4.6 Results of 010 FATX Template


As you can see we were able to identify the following details of the drive.
Serial Number  = 3NT08WA5
Firmware Version = 3.01
Model Number = ST920217AS

A quick search reveals the following details from the http://www.memory4less.com website [3] 


Fig 4.7 Technical Specifications of the Seagate LD25 Series Hard Disk Drive P/N ST920217AS

Further down the drive we identified the Magic Number for the beginning and end tag for a PNG file. 

Fig 4.8 PNG Format Magic Number Details [4]


The area of the file was extracted and resulted in the PNG file shown in Fig 4.9. 

Fig 4.9 PNG File extraction file and Details


When we looked at the properties of this file we identified the file had a size of 2,754bytes which corresponded exactly to that identified in the 010 template in Fig 4.6 for LogoSize.


One final point of note was the number of sectors on the disk identified by the FTK Imager log file. If you remember FTK identified that the drive image contains 39,070,080 sectors which are 512Bytes in size. You probably noticed from the 010 template above that the drive header details that there are 2150,192,130 sectors on the disk. Why the discrepancy?

During our investigation we identified that the data was stored on the drive in Big Endian format which means the first byte is the most significant bit. In essence we read from the drive from left to right. This resulted in the drive header details we read from the 010 template. On further investigation however we discovered that the Number of Sectors is written in Little Endian format with the first byte signifying the least significant bit. On reading the value from right to left we get a Sector number of 39,070,080 as can be seen in Fig 4.10 below.

Fig 4.10 Sector Number Reading using Little Endian Format




















This Security Sector was copied from a smaller hard drive (20GB) and placed in the same location on a bigger one (250GB). When it was connected to the XBox it was recognised and functioned. The Xbox however only recognised it as a 20GB drive. This is expected behaviour due to the fact that the size of the drive is depicted by the number of 512byte sectors defined in the Security Sector.

When the field holding the number of sectors on the drive was edited to allow a larger drive to be referenced the XBox360 crashed and failed to recognise the drive. From this experiment we deduce that the RSA Signature that is contained in the header information is a form of hash of the header fields. When the header field is altered the resulting hash is different from that stored on the drive and as such is no longer trusted by the XBox. More investigation is needed into this area.