Skip to content
KitploitKITPLOIT
ToolsBlog
Submit
ToolsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

··Feeds·Contact·Privacy·© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
CVE-2025-47917 — PoC exploit for CVE-2025-47917: Use-After-Free in mbedTLS leading to remote code execution. | Kitploit
Tools/GitHubGitHub/bytereaper77/cve-2025-47917
Vulnerability AnalysisExploitationShellcodePenetration TestingPayload DevelopmentBinary Exploitation
GitHubbytereaper77/cve-2025-47917

CVE-2025-47917

PoC exploit for CVE-2025-47917: Use-After-Free in mbedTLS leading to remote code execution.

View Repository
131 year agoNot yet reviewed

Most Popular

View all →

Discover the most used tools by our community.

Explore all tools

Browse our collection of tools

View all tools →
Share

CVE-2025-47917 Exploit (Use-After-Free in mbedTLS)

Author : Byte Reaper

Telegram : @ByteReaper0

CVE : CVE-2025-47917

Vulnerability : Use-After-Free (UAF) in mbedTLS 3.6.4 name parsing


Description

This repository contains an exploit targeting a Use-After-Free vulnerability in the mbedtls_x509_string_to_names() name parsing function of the mbedTLS library. A successful exploit grants arbitrary code execution with root privileges by hijacking freed heap metadata and redirecting control flow to injected shellcode.


Prerequisites

  1. Operating System: Linux (tested on Kali Linux)

  2. Root privileges: Required for disabling ASLR and executing injected shellcode

  3. mbedTLS development libraries (mbedTLS < 3.6.4):

    root@kitploit:~
    sudo apt update
    sudo apt install -y libmbedtls-dev
    
  4. Build tools: gcc, make (optional)


Compilation

Adjust include/library paths according to your installation:

root@kitploit:~
gcc /path/to/exploit.c \
    -I/usr/local/include \
    -L/usr/local/lib \
    -lmbedtls -lmbedx509 -lmbedcrypto \
    -Wl,-rpath,/usr/local/lib \
    -o exploit_UAF

Usage

  1. Disable ASLR (Address Space Layout Randomization):

    root@kitploit:~
    echo 0 | sudo tee /proc/sys/kernel/randomize_va_space
    
  2. Prepare a listener for the reverse shell on attacker machine (port 4454):

    root@kitploit:~
    nc -lvnp 4454
    
  3. Run the exploit with root privileges:

    root@kitploit:~
    sudo ./exploit_UAF
    

Exploitation Workflow

  1. ASLR Check: checkAslr() reads /proc/sys/kernel/randomize_va_space to ensure ASLR is disabled. Exits if enabled.
  2. First mbedtls_x509_string_to_names() call: Initializes an empty named-data list.
  3. Heap Spray: paddingChunk() allocates many fake named-data structs to fill free list entries with controlled content pointing to shellcode.
  4. Second mbedtls_x509_string_to_names() call: Triggers the Use-After-Free condition, reuses freed chunk containing fake metadata.
  5. Shellcode Injection: Shellcode is mapped RWX via mmap(), copied, and executed through corrupted named_data->val.p pointer.

Reverse Shell Shellcode

  • Target IP: 192.168.92.187
  • Target Port: 4454

The shellcode performs a socket + connect + dup2 sequence, then execve("/bin/sh").


Ethical and Legal Disclaimer

  • This code is provided for authorized security research and educational purposes only.
  • Unauthorized use against systems for which you do not have explicit permission is illegal and unethical.
  • Always obtain written permission before testing on any network or host.

License

MIT

Download Tool