13.03.2013 Views

Hacking the Xbox

Hacking the Xbox

Hacking the Xbox

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

94<br />

<strong>Hacking</strong> <strong>the</strong> <strong>Xbox</strong>: An Introduction to Reverse Engineering<br />

The program inside <strong>the</strong> ROM can be thought of as a ball of yarn: Once<br />

you find <strong>the</strong> starting point of <strong>the</strong> thread, it is just a matter of time and<br />

perseverance until you unwind <strong>the</strong> ball of yarn to its core.<br />

Fortunately, <strong>the</strong> starting point of <strong>the</strong> <strong>Xbox</strong>’s Pentium processor is very<br />

well documented by Intel. On power-up, <strong>the</strong> processor starts running<br />

code at a special hard-wired location, called <strong>the</strong> reset vector. This reset<br />

vector is at address 0xFFFF.FFF0, near <strong>the</strong> top of memory. Let’s look<br />

at <strong>the</strong> data contained at this location (in hexadecimal):<br />

0xFFFF.FFF0 EBC6 8BFF 1800 D8FF FFFF 80C2 04B0 02EE<br />

// key initialization routine<br />

unsigned char K[256]; // 0xFFFFC80 in flash<br />

unsigned char S[256]; // 0x10000 in SDRAM<br />

for( i = 0; i < 256; i++ ) {<br />

S[i] = i;<br />

}<br />

j = 0;<br />

for( i = 0; i < 256; i++ ) {<br />

// RC-4 would do j = (j + K[i] + S[i]) % 256<br />

j = (j + K[i] + S[j]) % 256;<br />

// swap S[i], S[j]<br />

temp = S[i];<br />

S[i] = S[j];<br />

S[j] = temp;<br />

}<br />

// decryption routine<br />

unsigned char cipherText[16384]; // 0xFFFFA000 in FLASH<br />

unsigned char plainText[16384]; // 0x400000 in SDRAM<br />

for( index = 0x4000, i = 0, k = 0; index > 0; index— ) {<br />

// xbox version<br />

t = (S[i] ^ cipherText[k]) % 256;<br />

plainText[k] = t;<br />

// swap( S[i], S[t] );<br />

temp = S[i];<br />

S[i] = S[t];<br />

S[t] = temp;<br />

i = (i + 1) % 256;<br />

k++;<br />

}<br />

Listing 6-1: Decompilation of <strong>the</strong> dummy cipher found in <strong>the</strong> FLASH ROM.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!