16.01.2015 Views

Hacking

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

printf("calculating printable values to subtract from EAX..\n\n");<br />

t[3] = (targ & 0xff000000)>>24; // Splitting by bytes<br />

t[2] = (targ & 0x00ff0000)>>16;<br />

t[1] = (targ & 0x0000ff00)>>8;<br />

t[0] = (targ & 0x000000ff);<br />

l[3] = (last & 0xff000000)>>24;<br />

l[2] = (last & 0x00ff0000)>>16;<br />

l[1] = (last & 0x0000ff00)>>8;<br />

l[0] = (last & 0x000000ff);<br />

for(a=1; a < 5; a++) { // Value count<br />

carry = flag = 0;<br />

for(z=0; z < 4; z++) { // Byte count<br />

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

for(j=0; j < len; j++) {<br />

for(k=0; k < len; k++) {<br />

for(m=0; m < len; m++)<br />

{<br />

if(a < 2) j = len+1;<br />

if(a < 3) k = len+1;<br />

if(a < 4) m = len+1;<br />

try = t[z] + carry+mem[i]+mem[j]+mem[k]+mem[m];<br />

single = (try & 0x000000ff);<br />

if(single == l[z])<br />

{<br />

carry = (try & 0x0000ff00)>>8;<br />

if(i < len) word[0][z] = mem[i];<br />

if(j < len) word[1][z] = mem[j];<br />

if(k < len) word[2][z] = mem[k];<br />

if(m < len) word[3][z] = mem[m];<br />

i = j = k = m = len+2;<br />

flag++;<br />

}<br />

}<br />

}<br />

}<br />

}<br />

}<br />

if(flag == 4) { // If all 4 bytes found<br />

printf("start: 0x%08x\n\n", last);<br />

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

printf(" - 0x%08x\n", *((unsigned int *)word[i]));<br />

printf("-------------------\n");<br />

printf("end: 0x%08x\n", targ);<br />

}<br />

}<br />

exit(0);<br />

When this program is run, it expects two arguments—the start and the<br />

end values for EAX. For the printable loader shellcode, EAX is zeroed out to<br />

start with, and the end value should be 0x80cde189. This value corresponds to<br />

the last four bytes from shellcode.bin.<br />

370 0x600

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

Saved successfully!

Ooh no, something went wrong!