Control Flow Graph Recovery for Dynamically Loaded Code via Symbolic Library Resolution
This paper proposes a safe, symbolic execution-based analysis technique that combines speculative library preloading with custom hooks to recover Control Flow Graphs from dynamically loaded code, achieving significant improvements in node and edge recovery over static analysis while maintaining 100% precision and recall in library detection.
Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer
Imagine you are trying to understand how a complex machine works by looking at its blueprints. In the world of computer software, these blueprints are called Control Flow Graphs (CFGs). They map out every possible path a program can take, showing you where the code goes next.
However, modern software (and malicious programs like malware) has learned a trick to hide their blueprints. They use a technique called dynamic loading. Instead of having all their parts built into the main machine from the start, they keep some parts in a locked box and only open the box and assemble the parts while the machine is running.
The Problem: The Invisible Parts
Traditional software analysis tools are like static architects. They look at the blueprints on the table and say, "Here is the path." But if the machine pulls a hidden part out of a box while it's running, the static architect sees nothing. They see a blank space where a door should be, so they can't draw the path through it.
This is a huge problem for security. If you can't see the hidden paths, you can't tell if the machine is safe or if it's a trap.
The Solution: The "Speculative" Detective
The author of this paper, O. S. Mostovyi, built a new kind of detective tool. Instead of just looking at the blueprints, this tool acts like a time-traveling simulator.
Here is how it works, using a simple analogy:
- The Simulation (Symbolic Execution): Imagine you have a robot that can run the software without actually turning it on for real. It runs the code in a "what-if" world. It doesn't execute the dangerous parts; it just thinks through them.
- The Two-Level Architecture: The tool has two special senses working together:
- Level 1 (The Librarian): This part watches the software ask for new parts. When the software says, "I need a library from the network" or "I need a file from a hidden memory spot," the Librarian intercepts the request. Even if the software says the file name is encrypted or scrambled, the tool uses math to figure out what the file actually is. It then "speculatively" loads that file into the simulation so the robot can see it.
- Level 2 (The Traffic Cop): This part watches the roads the robot travels. When the robot reaches a fork in the road where the direction depends on a hidden variable (like a secret address), the Traffic Cop checks the "what-if" scenarios to see where that road actually leads.
How It Handles Tricky Tricks
The paper explains that bad actors use many ways to hide their loading process. The tool is designed to catch them all:
- Fileless Execution: Some programs create files that don't exist on the hard drive, living only in RAM. The tool sees these invisible files.
- Network Loading: Some programs download their code from the internet while running. The tool simulates this download to see what arrives.
- Encrypted Names: If the program says "Load file [encrypted code]," the tool uses a mathematical solver to crack the code and find the real file name.
The Results: Filling in the Missing Map
To test this, the author created 16 different "traps" (benchmarks) that used various hiding techniques, from simple tricks to complex, multi-stage encryption.
The results were very clear:
- Completeness: The tool found 29.8% more paths (nodes) and 26.5% more connections (edges) than the traditional static tools. It filled in the blank spaces on the map.
- Accuracy: It was 100% accurate. Every time it said it found a hidden library, it was right. It didn't make any false alarms.
- Safety: Because it used simulation (symbolic execution) rather than actually running the dangerous code, it could analyze these tricky programs safely without the risk of the malware escaping or causing damage.
The Limitations
The author is honest about what the tool cannot do yet:
- It's a Detective, Not a Magician: It can find the hidden doors and draw the paths, but it doesn't automatically "undo" complex obfuscation (scrambling) to make the code easy to read. That is still a hard problem.
- Platform Limits: It currently works well for Linux systems (specifically ELF files) on certain computer chips, but not for Windows or other operating systems yet.
- Hidden Flows: It tracks data that moves explicitly, but it sometimes misses data that moves in subtle, indirect ways (like through complex math functions).
Summary
In short, this paper presents a new method to map out software that hides its parts until it runs. By combining a "what-if" simulator with a smart system that intercepts and resolves hidden file requests, the tool can draw a complete map of the program's behavior, revealing paths that were previously invisible to security analysts. It successfully tested this on 16 different scenarios, proving it can find hidden libraries with perfect accuracy.
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.