Source Code Reconstruction from Binary Files Using Embeddings and LLMs

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

The challenge is determining the source code of a binary software code when the source code version is not available, which is common due to compilation processes making it non-reversible, and existing decompilers provide only approximate results.

Innovation Solution

Utilizing a generative artificial intelligence language model (LLM) and a file encoder model to embed binary code and source code in a common latent space, generating file embedding vectors, and using similarity analysis and a large language model to determine the source code based on these vectors.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Loss of information

If traditional decompilers are used to convert binary code to source code, then source code can be obtained, but the accuracy and reliability of the reconstructed source code deteriorates

Engineering Contradiction:
Improvesource code availabilityVSAvoidsource code accuracy
Core Design Contradiction:
Loss of informationVSMeasurement precision

Solution Approach 1:

The patent replaces traditional mechanical decompilation processes with a deep learning-based neural network system. The neural network is trained on pairs of source code and binary code to learn the complex mapping relationships, then uses this learned knowledge to accurately reconstruct source code from binary code, achieving higher accuracy than conventional decompilers.

Inventive Principle:
Principle #28Mechanics substitution (Replace mechanical system)

Solution Approach 2:

The patent transforms the source code reconstruction problem into a parameter optimization problem by adjusting neural network weights and biases during training. The system changes parameters iteratively to minimize the difference between reconstructed source code and original source code, thereby improving reconstruction accuracy.

Inventive Principle:
Principle #35Parameter changes

2Productivity

If source code is compiled to binary code, then executable software is produced, but the ability to retrieve original source code deteriorates

Engineering Contradiction:
Improvesoftware development efficiencyVSAvoidsource code retrieval capability
Core Design Contradiction:
ProductivityVSLoss of information

Solution Approach 1:

The patent performs preliminary training of the neural network system before actual source code reconstruction is needed. By pre-training on large datasets of source-code pairs, the system prepares the necessary knowledge and patterns in advance, enabling accurate source code retrieval when binary code needs to be analyzed for security or maintenance purposes.

Inventive Principle:
Principle #10Preliminary action

3Reliability

If binary code is analyzed for security risks without source code, then security analysis can be performed, but the precision of security risk detection deteriorates

Engineering Contradiction:
Improvesecurity analysis capabilityVSAvoidsecurity risk detection accuracy
Core Design Contradiction:
ReliabilityVSMeasurement precision

Solution Approach 1:

The patent introduces reconstructed source code as an intermediary between binary code and security analysis tools. The neural network first reconstructs source code from binary code, then this reconstructed source code serves as input to security analysis tools, enabling more accurate and comprehensive security risk detection compared to analyzing binary code directly.

Inventive Principle:
Principle #24Intermediary (Mediator)

Data Source

PatentEP4610811A1Determining source code of a software code
Publication Date: 2025.09.03 CYLANCE INC
  • EP4610811A1 patent drawingFigure 1
  • EP4610811A1 patent drawingFigure 2
  • EP4610811A1 patent drawingFigure 3

AI summary

Systems, methods, and software can be used to determine source code of a software code. In some aspects, a method includes: processing a binary code by using a file encoder model to obtain a file embedding vector; and selecting one or more source code samples based on the file embedding vector and a distance function.