Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Create a large file such that reading <code>row</code> and <code>cols</code> are both negatives. <code>rasterBytes = pixBytes * rows * cols</code> is <em>positive</em> so everything will be fine till <code>p = img-&gt;raster;</code>. But at this point you have two infinite loops, and the program may overwrite the heap.</p> <p>Another attack is to set up <code>row</code> and <code>cols</code> such that they have different sign. You can choose either value to be <code>-1</code>, while the other is large enough to read the data you want. The allocation </p> <pre><code> img-&gt;raster = (void*)malloc(rasterBytes); </code></pre> <p>will fail, which lead img->raster to point to NULL. Which means</p> <pre><code> fread(p, pixBytes, 1, fp) &lt; 1 </code></pre> <p>will try to read the content of the file to kernel memory. If this code is executed in kernel mode, depending of the system (let say old unix which doesn use memory segment), then you will overwrite the content of the kernel memory with the content of the file. A kernel which doesn use memory segment rely not on segmentation faults but on page faults (a virtual address which doesnt have any real page assigned to it). The issue is that there are virtual memory designs such that the first real pages are directly assigned to the kernel pages. Ie kernel virtual address 0x0 is correspond to the real memory at 0x0 and is perfectly valid (inside the kernel).</p> <p><strong>EDIT:</strong> In both of those cases, the goal of the attacker is to inject the content of the input file (which is totally under his control) in a region of memory he should not have access to, while not being able to modify the function <code>read_ppm()</code>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload