A critical vulnerability with Exim email servers put’s more than 500,000 servers at risk. The bug affects all the version of Exim from the first commit to last 3.x release.
The Vulnerability resides with b64decode function in the SMTP listener. When the provided input is not a valid base64 string it consumes additional bytes while decoding which causes the one-byte heap overflow.
Taiwanese security Researcher Meh discovered the vulnerability. He says generally this bug is not critical, but with Exim, it overwrites the critical data when the string fits some specific length and also the extra byte is controllable which make the exploitation more feasible.
Exim uses base64 encoding to communicate with the clients and the encodes functions will be stored in a buffer that allocated by store_get(). To leverage the one-byte heap overflow Meh selected sender_host_name as a better choice.
Also Read Operation Honeybee – A Cyber Attack Leveraging an SYSCON Backdoor Using MS Word Documents
Meh published a blog post describing the vulnerability along with the steps to exploit it. According to the recent Mail (MX) Server Survey, around 56 Percent servers running Exim.
The bug was tracked as CVE-2018-6789, an attacker could leverage the vulnerability by sending a crafted malicious request that causes the buffer overflow and it can use to execute the remote code.
Exim email servers – Patch
Meh reported the vulnerability to Exim and the Exim released version 4.90.1, which fixes the vulnerability. Users are advised to update their Exim server version to 4.90.1 or above.