turing - All Articles - CISO Platform2023-10-02T11:08:50Zhttps://www.cisoplatform.com/profiles/blogs/feed/tag/turingDefcon, Turing Machine & Halting Problem: "Why is it easier to hack than to defend?"https://www.cisoplatform.com/profiles/blogs/defcon-turing-machine-halting-problem-why-is-it-easier-to-hack-th2014-08-14T04:00:00.000Z2014-08-14T04:00:00.000Z23j0c848tmyvuhttps://www.cisoplatform.com/members/23j0c848tmyvu<div><p><br /> Defcon is the time when I have no business meetings and am quite disconnected with the world. A good time to immerse myself in my own thoughts. Last week during Defcon @ Las Vegas, I was thinking on how difficult it is build a secure system. We get amazed by hacking various stuff but is lot more amazing to think how tough it is to build a secure system.</p><p></p><p></p><p><strong><span class="font-size-4">"Halting problem" makes it practically impossible to build a secure system</span></strong></p><p><span>In </span><a href="http://en.wikipedia.org/wiki/Computability_theory_(computer_science)" title="Computability theory (computer science)" class="mw-redirect">computability theory</a><span>, the </span><b>halting problem</b><span> is the problem of determining, from a description of an arbitrary computer program</span><span> and an input, whether the program will finish running or continue to run forever. <a href="http://en.wikipedia.org/wiki/Alan_Turing" title="Alan Turing">Alan Turing</a><span> proved in 1936 that a general </span><a href="http://en.wikipedia.org/wiki/Algorithm" title="Algorithm">algorithm</a><span> to solve the halting problem for </span><i>all</i><span> possible program-input pairs cannot exist. A key part of the proof was a mathematical definition of a computer and program, which became known as a </span><a href="http://en.wikipedia.org/wiki/Turing_machine" title="Turing machine">Turing machine</a><span>; the halting problem is </span><i><a href="http://en.wikipedia.org/wiki/Undecidable_problem" title="Undecidable problem">undecidable</a></i><span> over Turing machines. </span>(Source Wiki)</span></p><p>Now what does it imply? It implies that the halting problem is applicable to our computer programs and we cannot determine if any program will halt with a given input. This further implies that we can model the possibility of the existence of any vulnerability (e.g. a crash while fuzzing) a halting problem. And we cannot determine whether the program will halt unless it does. </p><p>(Read more: <b><a href="http://www.cisoplatform.com/profiles/blogs/5-application-security-trends-you-don-t-want-to-miss">Top 5 Application Security Technology Trends</a>)</b></p><p></p><p><span class="font-size-4"><strong>Multi-stage attack chaining is a PSPACE complete problem</strong></span></p><p>Well, I worked on this long at "<a href="http://ivizsecurity.com" target="_blank">iViZ Security</a><u>"</u> long time back when we were researching on how to find all the permutations and combinations of attack paths. My knowledge could be a bit dated but in any case this is a damn "hard" problem.</p><p>Imagine if you want to combine multiple vulnerabilities to execute a chain of attacks. You may have obtained partial privilege by exploiting some vulnerability. Then you use privilege escalation. Get root. Sniff. Now that's a multi-stage attack. We researched on finding all the permutations and combinations of attacks. After working on this for a while we got the nasty issue of requirement of space and memory to store the information of states. We found that it is a PSPACE complete problem. </p><p><span>In </span><a href="http://en.wikipedia.org/wiki/Computational_complexity_theory" title="Computational complexity theory">computational complexity theory</a><span>, a </span><a href="http://en.wikipedia.org/wiki/Decision_problem" title="Decision problem">decision problem</a><span> is </span><b>PSPACE-complete</b><span> if it can be solved using an amount of memory that is polynomial in the input length (</span><a href="http://en.wikipedia.org/wiki/PSPACE" title="PSPACE">polynomial space</a><span>) and if every other problem that can be solved in polynomial space can be </span><a href="http://en.wikipedia.org/wiki/Polynomial-time_many-one_reduction" title="Polynomial-time many-one reduction" class="mw-redirect">transformed to it in polynomial time</a><span>. The problems that are PSPACE-complete can be thought of as the hardest problems in </span><b>PSPACE</b><span>, because a solution to any one such problem could easily be used to solve any other problem in </span><b>PSPACE</b><span>. (Source-Wiki)</span></p><p><span>So the conclusion is that it virtually impossible to find all the permutations and combinations of attack paths. To secure you need to stop all such paths but to break you need to find just one. So making sure that we defend all of them is pretty hard.</span></p><p><span>(Read more: <strong> </strong></span><b><a href="http://www.cisoplatform.com/profiles/blogs/how-the-heartbleed-bug-was-found-by-antti-karjalainen-discoverer-">How the Heartbleed bug was found by Antti Karjalainen - discoverer ...</a></b><span><b>)</b></span></p><p></p><p></p></div>