You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<h4id="finding-the-vulnerability">Finding the Vulnerability<ahiddenclass="anchor" aria-hidden="true" href="#finding-the-vulnerability">#</a></h4>
574
574
<p>The vulnerability is easy to spot if you are familiar with format string bugs.<br>
575
575
In the decompiled code (see image below), the program calls <code>printf()</code><strong>without</strong> specifying a format string, like <code>%s</code>:</p>
<p>This means user input is passed directly to <code>printf</code>, allowing us to control the format string and leak stack values or write to arbitrary memory.</p>
578
578
<p>Additionally, the program provides a feature that lets us write any value to any address—this will be useful for exploitation.</p>
579
579
<h4id="exploiting-the-vulnerability">Exploiting the Vulnerability<ahiddenclass="anchor" aria-hidden="true" href="#exploiting-the-vulnerability">#</a></h4>
<h4id="individuare-la-vulnerabilità">Individuare la vulnerabilità<ahiddenclass="anchor" aria-hidden="true" href="#individuare-la-vulnerabilità">#</a></h4>
574
574
<p>La vulnerabilità è evidente se conosci i format string bug.
575
575
Nel codice decompilato (vedi immagine), il programma chiama <code>printf()</code><strong>senza</strong> specificare una format string, tipo <code>%s</code>:</p>
<p>Questo significa che l’input dell’utente viene passato direttamente a <code>printf</code>, permettendoci di controllare la format string e di leakare valori dallo stack o scrivere in memoria arbitraria.</p>
578
578
<p>Inoltre, il programma offre una funzionalità che permette di scrivere qualsiasi valore in qualunque indirizzo—utile per l’exploit.</p>
579
579
<h4id="sfruttare-la-vulnerabilità">Sfruttare la vulnerabilità<ahiddenclass="anchor" aria-hidden="true" href="#sfruttare-la-vulnerabilità">#</a></h4>
0 commit comments