PoC Exploit released for TP-Link Code Execution Vulnerability(CVE-2024-54887)


A security researcher, exploring reverse engineering and exploit development, has successfully identified a critical vulnerability in the TP-Link TL-WR940N router, specifically affecting hardware versions 3 and 4 with all firmware up to the latest version.

This vulnerability, which has been documented as CVE-2024-54887, allows for potential arbitrary remote code execution (RCE) through stack buffer overflow exploitation.

The researcher utilized techniques such as static and dynamic analysis, shellcode development for MIPS Linux, and Return Oriented Programming (ROP) to demonstrate the exploit’s viability.

Investigate Real-World Malicious Links & Phishing Attacks With Threat Intelligence Lookup - Try for Free

Vulnerability Analysis

The researcher began by emulating the router’s firmware using Firmadyne, facilitating a thorough inspection of its functionality.

Code Execution Vulnerability
The function in the web interface and it’s associated parameters

During static analysis with tools like Ghidra, it was revealed that key security measures, such as Non-Executable (NX) and Position Independent Executables (PIE), were absent.

The analysis identified unbounded calls to strcpy() in the code responsible for processing DNS server settings, specifically the dnsserver1 and dnsserver2 parameters.

This flaw poses a risk for a stack buffer overflow, allowing an attacker to overwrite adjacent memory areas and control the device’s execution flow.

Exploit Development

Using the identified vulnerability, the researcher crafted an exploit leveraging ROP techniques suitable for MIPS architecture.

The development involved creating a sequence of gadgets to facilitate controlled execution of shellcode.

Code Execution VulnerabilityCode Execution Vulnerability
Gadget Chain Overview

Initial testing confirmed the ability to overwrite critical registers and inject malicious payloads to execute commands on the router.

The final exploit was encapsulated in a Python script capable of authenticating to the router and executing shellcode to establish a bind shell.

Post-exploitation testing was conducted, confirming the exploit’s effectiveness in triggering a bind shell on port 4444 from the compromised device.

The researcher communicated the findings to TP-Link, which acknowledged the issue and clarified that the affected hardware versions had reached their end-of-life status, resulting in no further security updates.

As of January 9, 2025, the vulnerability is officially documented with the assigned CVE number, marking a significant contribution to the field of IoT security research.

This discovery underscores the importance of continual security assessments for embedded systems, especially those that remain in active use despite the cessation of official support.

Integrating Application Security into Your CI/CD Workflows Using Jenkins & Jira -> Free Webinar



Source link