Secure Locate Heap Corruption Vulnerability

Secure Locate maintains an index of the entire filesystem, including files only visible by root. The slocate binary is setgid "slocate" so it can read this index. Slocate contains a heap-corruption vulnerability that may compromise disclosure of these files if exploited.

When running slocate, users are able to specify a database of their own as a commandline parameter. A subtle vulnerability exists in slocate's reading of these user-supplied databases that may allow a local user to execute arbitrary code with effective gid slocate.

When reading the contents of the database file, slocate initially reads a value from the file that is supposed to indicate the offset in a malloc()'d buffer at which the data is to be written. If this number exceeds the size of the allocated buffer, the bytes from the file will be written to the memory following the buffer, the malloc structure.

As a result, it is possible for a local user to overwrite internal malloc memory structures on the heap with arbitrary data. Attackers can replace a legitimate malloc structure with a malicious one designed to cause other areas of memory to be overwritten.


 

Privacy Statement
Copyright 2010, SecurityFocus