CVE-2016-20047 Overview
CVE-2016-20047 is a local buffer overflow vulnerability in EKG Gadu 1.9~pre+r2855-3+b1, a messaging client for the Gadu-Gadu network. The vulnerability exists in the username handling functionality, where an attacker can supply an oversized username string to trigger a buffer overflow condition. By crafting a malicious buffer exceeding 258 bytes, attackers can overwrite the instruction pointer and execute arbitrary code with user privileges.
Critical Impact
Local attackers can achieve arbitrary code execution by exploiting the buffer overflow in the strlcpy function through a crafted username parameter, potentially leading to complete system compromise under the context of the affected user.
Affected Products
- EKG Gadu 1.9~pre+r2855-3+b1
Discovery Timeline
- 2026-03-28 - CVE CVE-2016-20047 published to NVD
- 2026-03-30 - Last updated in NVD database
Technical Details for CVE-2016-20047
Vulnerability Analysis
This vulnerability is classified as CWE-787 (Out-of-bounds Write), a memory corruption flaw that occurs when the application writes data past the end of an allocated buffer. The vulnerability resides in the username handling routine of EKG Gadu, where insufficient bounds checking allows an attacker to overflow a fixed-size buffer on the stack.
The attack requires local access to the system, but does not require any special privileges or user interaction to exploit. When successfully exploited, the attacker can gain complete control over confidentiality, integrity, and availability of the affected system within the user's privilege context.
Root Cause
The root cause of this vulnerability is improper input validation in the username handling code. The application uses the strlcpy function to copy user-supplied input into a fixed-size buffer without properly validating the input length against the destination buffer size. When a username string exceeding 258 bytes is provided, the copy operation writes beyond the allocated buffer boundary, corrupting adjacent stack memory including the saved return address.
Attack Vector
The attack vector is local, requiring the attacker to have access to the system where EKG Gadu is installed. The attacker constructs a malicious payload containing:
- Padding data to fill the buffer up to the return address
- A controlled return address pointing to attacker-controlled code
- Shellcode to be executed when the function returns
When the vulnerable function processes the oversized username, the stack buffer is overwritten, and upon function return, execution is redirected to the attacker's shellcode. This grants the attacker arbitrary code execution with the privileges of the user running the EKG Gadu application.
For detailed exploit information, refer to the Exploit-DB #40392 entry and the Vulncheck Advisory on EKG.
Detection Methods for CVE-2016-20047
Indicators of Compromise
- Presence of unusually long username strings (>258 bytes) in EKG Gadu configuration files or process memory
- Unexpected child processes spawned by the EKG Gadu application
- Anomalous network connections originating from the ekg process
- Signs of shellcode patterns in memory dumps associated with the application
Detection Strategies
- Monitor for abnormal memory access patterns in the EKG Gadu process using endpoint detection tools
- Implement application whitelisting to detect unauthorized code execution from the EKG process context
- Deploy SentinelOne's Behavioral AI to detect exploitation attempts through anomalous process behavior
- Use memory protection mechanisms to detect stack-based buffer overflow attempts
Monitoring Recommendations
- Enable detailed logging for the EKG Gadu application and monitor for crash events or segmentation faults
- Implement file integrity monitoring on EKG configuration files to detect potential injection attempts
- Configure alerts for unusual command execution patterns from messaging applications
- Deploy endpoint detection and response (EDR) solutions capable of detecting memory corruption exploitation
How to Mitigate CVE-2016-20047
Immediate Actions Required
- Discontinue use of EKG Gadu 1.9~pre+r2855-3+b1 if possible and migrate to alternative messaging clients
- Restrict local access to systems running the vulnerable software to trusted users only
- Enable operating system security features such as ASLR (Address Space Layout Randomization) and DEP (Data Execution Prevention) to make exploitation more difficult
- Monitor the EKG project page for any security updates or patches
Patch Information
No official vendor patch information is currently available for this vulnerability. Organizations should consult the Vulncheck Advisory on EKG for the latest remediation guidance. Consider upgrading to a newer version of the software if available, or implementing compensating controls.
Workarounds
- Limit local user access to systems where EKG Gadu is installed
- Run the application in a sandboxed environment or container to limit the impact of potential exploitation
- Enable compiler-based stack protection mechanisms (stack canaries) if recompiling the application from source
- Apply network segmentation to isolate systems running vulnerable software from critical infrastructure
# Enable ASLR system-wide (if not already enabled)
echo 2 > /proc/sys/kernel/randomize_va_space
# Verify DEP/NX bit is enabled
dmesg | grep -i "NX"
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.


