Heap Overflow in F-Secure Internet Gatekeeper
A heap overflow in the admin panel occurs when a very large Content-Length header causes an integer overflow during allocation, so a tiny buffer is allocated but a larger amount of data is read into it. An unauthenticated attacker could exploit this, and the authors believe RCE is possible.
blog.doyensec.com
Published on blog.doyensec.com
This blog post illustrates a vulnerability we discovered in the F-Secure Internet Gatekeeper application. It shows how a simple mistake can lead to an exploitable unauthenticated remote code execution vulnerability.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely an integer overflow when adding 1 to a Content-Length value that has already been capped at ULONG_MAX, causing malloc to allocate a zero-byte buffer before a large read.
Impact
An unauthenticated attacker could exploit this heap overflow; the text describes it as an exploitable unauthenticated RCE vulnerability, though the PoC only demonstrates file removal.
What the attacker needed
Network access to port 9012; vulnerable version installed
How it was found
- Set up a CentOS virtual machine and install the vulnerable F-Secure Internet Gatekeeper package.
- Send a POST request to the admin panel on port 9012 with a very large Content-Length header value.
- The application parses the header, converts it with strtoul, and the value becomes ULONG_MAX.
- The code adds 1 to this value, causing an integer overflow to zero, and malloc allocates a zero-byte buffer.
- The application then reads the body data into the tiny buffer, causing a heap overflow.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
This overwrites other memory and can let an attacker delete files on the server without logging in; the authors believe running code may also be possible.
What is Memory corruption?
Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.