Changelog¶
2.0.0 - Not Released Yet¶
Breaking Changes
C++17 Migration: LIEF public headers, public API, and STL have been bumped from C++11 to C++17.
C API Removal: The legacy C API has been completely removed.
- Logging Level Renaming: and its enumerators are now written in
CamelCase
- Assembly:
Add API to inspect and rewrite the
LOCKprefix of x86 instructions:
- ELF:
Fix the layout of the segments added by LIEF for the architectures that can use pages larger than 4K (#1366)
Fix the modification of binaries that have already been modified by LIEF. The segment table was relocated a second time which, for the non-PIE binaries, shifted the sections without shifting the segments nor the dynamic entries. It resulted in a
DT_STRTABthat was no longer pointing to.dynstr(i.e. garbageDT_NEEDED/DT_RUNPATHnames) and in aPT_PHDRthat was not wrapped by aPT_LOADsegment (#1366).- now reports the
PT_LOADsegments that can’t be mapped independently because they share the same page. It also report mismatch between.dynstrvirtual address andDT_STRTAB.
- COFF:
- Add to look up a section by its name. Names that are stored in the COFF string table (i.e. longer than 8 bytes) can be resolved either from their regular value or from their
/<offset>placeholder:import lief coff = lief.COFF.parse("dwarf.obj") section = coff.get_section(".debug_rnglists") section.name # '/18' section.coff_string.string # '.debug_rnglists'
1.0.0 - July 12th, 2026¶
Runtime
LIEF now provides runtime features as described here: Runtime
- BinaryNinja:
The DWARF import plugin now supports comments
- Ghidra:
Add support for generating DWARF from firmware or binaries without a precise format or architecture (#1249)
- DWARF:
Add support for accessing the bit size of bit-field declarations (#1265)
- Add support for accessing Enum entries:
Add support for reading from or assigning a register to a function parameter
- Add support for reading from or assigning a description (
DW_AT_description) to a , , or : - Enable the creation of nested
- Add support for generating a C/C++ definition for a whole (). The output of the following
to_decl()functions can now be configured through the new structure:import lief dbg = lief.dwarf.load("/bin/with_debug") opt = lief.DeclOpt() opt.is_cpp = True opt.indentation = 4 for cu in dbg.compilation_units: print(cu.to_decl(opt))
- PDB:
- Improve support and the API for
LF_ENUM: - Improve support and the API for
LF_PROCEDURE: - Improve support and the API for
LF_ARRAY: - Improve support and the API for simple types:
- Improve support and the API for
LF_ONEMETHOD: - Add support for generating a C/C++ definition for a () and a (), configurable with the new structure.
- ELF:
- Add support for
DT_FILTERtag: - Add to parse an ELF binary from a memory dump
- COFF:
- Add for accessing the full section name when this name does not fit in 8 bytes.
- Mach-O:
Add support for writing big-endian Mach-O binaries (#1236)
Introduce an API for selecting a specific Mach-O binary by architecture from a FAT binary (#1283)
- Add to create a FAT binary from a list of objects targeting different architectures
- Add support for
Fix an extra byte being written after the thread state of an
LC_UNIXTHREAD/LC_THREADcommand, which shifted the following load commands by one byte (#1344)- Add support for editing the runtime tables of the
LC_FUNCTION_VARIANTScommand and committing the changes on write: - Add a structured parser, editing API and writer for the
LC_FUNCTION_VARIANT_FIXUPScommand: - Add support for the
LC_LAZY_LOAD_DYLIB_INFOcommand: - Add to parse a Mach-O binary from a memory dump
- PE:
- Add setters for and
- Add to convert a raw offset into a RVA
- Add to parse a PE binary from a memory dump
- Update for PE binaries to return an absolute virtual address instead of a RVA (#1318)
- Add support for adding an at a specific position: (#1298)
Improve support for EFI binaries, such as
bzImage(#1293)
- ObjC:
- Add support for Objective-C categories (#1353): , accessible through
- Assembly:
Add support for iterating over the operands of MIPS, PowerPC, eBPF and RISC-V instructions (
Register,Immediate,MemoryandPCRelative):
- Rust:
Warning
The Minimum Supported Rust Version (MSRV) is now
1.85.0(previously1.74.0).The Rust FFI no longer relies on
autocxxandbindgen. It is now built on top of plaincxx, which simplifies the bindings and reduces the iteration timeThe Rust bindings directory has been renamed from
api/rust/cargo/toapi/rust/crates/Add support for the
aarch64-linux-androidandx86_64-linux-androidtargets
- C++:
Add
LIEF_LIFETIMEBOUNDannotations wrapping[[clang::lifetimebound]]to leverage Clang’s lifetime analysis. This helps detect dangling references at compile time for methods that return references or iterators tied to an object’s lifetime:// Clang can now warn about this dangling reference: auto& hdr = LIEF::ELF::Parser::parse("a.out")->header(); LIEF_INFO("{}", hdr.header_size()); // /src/src/ELF/Binary.cpp:63:15: error: object whose reference is captured // does not live long enough [-Werror,-Wlifetime-safety-use-after-scope] // 63 | auto& hdr = LIEF::ELF::Parser::parse("a.out")->header(); // | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // /src/src/ELF/Binary.cpp:63:47: note: destroyed here // 63 | auto& hdr = LIEF::ELF::Parser::parse("a.out")->header(); // | ^ // /src/src/ELF/Binary.cpp:64:19: note: later used here // 64 | LIEF_INFO("{}", hdr.header_size());
- Dependencies:
Update nanobind to version
v2.13.xUpdate tl-expected to version
1.3.1Update utfcpp to version
4.0.9Update frozen to commit
61dce5aUpdate spdlog to version
1.17.0Update mbedtls to version
4.0.0
- Extended:
Use LLVM
22.xAdd support to directly download a package from the History:
- Python:
Python 3.8 is no longer supported
Add support for the free-threaded Python builds. The C++ core is now thread-safe with respect to its few static variables, and can be used when the GIL is disabled (#1255):
from concurrent.futures import ThreadPoolExecutor import lief def strip(path: str) -> None: binary = lief.ELF.parse(path) binary.strip() binary.write(f"{path}.stripped") with ThreadPoolExecutor() as pool: pool.map(strip, ["/bin/ls", "/bin/cat", "/bin/echo"])
0.17.6 - March 18th, 2026¶
0.17.5 - March 8th, 2026¶
0.17.4 - February 21st, 2026¶
- PE:
Fixed the address type in the TLS builder (by Immortalety in PR #1296)
- MachO:
- Fixed to properly handle non-file-backed segments, such as
__DATAsegments containing onlyZEROFILLsections like__bss(by jalopezg-git in PR #1301, fixing #1299). Fixed
patch_relocation()to correctly process tagged pointers (by jalopezg-git in PR #1302, fixing #1300).
- COFF:
Resolved a compilation conflict with the Windows
minwindef.hmacro#define max.
- CMake:
Fixed compiler flag issues on Windows when compiling with
clang-cl(by sigewinnefish in PR #1306).
- Python:
Bumped various Python backend build dependencies in
api/python/build-requirements.txtto support Python3.14when compiling from sources (#1304).
0.17.3 - January 24th, 2026¶
0.17.2 - January 3rd, 2026¶
- Mach-O:
- Compilation:
Fixed MinGW compilation for some configurations (by TheBrokenRail, dabbb72).
- PE:
Fixed alignment issue when rebuilding PE relocations (#1261).
Fixed infinite loop when processing v2 dynamic relocations (by chengyongru, fixing #1273).
- ELF:
- Mach-O:
0.17.1 - October 25th, 2025¶
0.17.0 - September 14th, 2025¶
BinaryNinja & Ghidra Plugins
LIEF-based plugins for Binary Ninja and Ghidra have been bootstrapped here:
LIEF Tools
I initiated a Tools section which aims at providing utilities based on LIEF (mostly CLI):
- Assembler:
Add support for Contextual Assembly Patching
- DSC:
Add enum for the latest dyld shared cache version introducing changes in the header layout (
dyld-1284.13 - 2025-04-25)uint64_t dynamicDataOffset; uint64_t dynamicDataMaxSize; uint32_t tproMappingsOffset; uint32_t tproMappingsCount; + uint64_t functionVariantInfoAddr; + uint64_t functionVariantInfoSize; + uint64_t prewarmingDataOffset; + uint64_t prewarmingDataSize; };
Add enum for the latest dyld shared cache version introducing changes in the header layout (
dyld-1231.3 - 2024-09-24)uint64_t dynamicDataOffset; uint64_t dynamicDataMaxSize; + uint32_t tproMappingsOffset; + uint32_t tproMappingsCount; };
Fix symbol resolution issue: #1127
- PE:
Please check LIEF 0.17.0 - PE changelog
luadebug added support for pretty printing OID value and non-roman characters in X509 certificates (see: #1226, #1219)
- COFF:
Initial support for the COFF format: see the COFF section
- Mach-O:
- Initial support for and commands (
LC_FUNCTION_VARIANTS, LC_FUNCTION_VARIANT_FIXUPS) - Add support for command (
LC_NOTE) - Add support for command (
LC_ATOM_INFO) Add support for modifying Mach-O commands that embed variable-length data (#1204, #1125). See: RPath and Library Path Modification.
# Change library name for lib in macho.libraries: lib.name += "/some/path/lib.dylib" # Change rpath for rpath in macho.rpaths: rpath.path += '/a/very/long/path/that/needs/expansion'
To void
#defineconflicts with Apple SDK, the following enums have been renamed:- lief.MachO.FAT_MAGIC + lief.MachO.MAGIC_FAT - lief.MachO.FAT_CIGAM + lief.MachO.CIGAM_FAT - lief.MachO.Symbol.ORIGIN.LC_SYMTAB + lief.MachO.Symbol.ORIGIN.SYMTAB - lief.MachO.Section.TYPE.S_4BYTE_LITERALS + lief.MachO.Section.TYPE.IS_4BYTE_LITERALS - lief.MachO.Section.TYPE.S_8BYTE_LITERALS + lief.MachO.Section.TYPE.IS_8BYTE_LITERALS - lief.MachO.Section.TYPE.S_16BYTE_LITERALS + lief.MachO.Section.TYPE.IS_16BYTE_LITERALS
- MACHO_TYPES::MH_MAGIC - MACHO_TYPES::MH_CIGAM - MACHO_TYPES::MH_MAGIC_64 - MACHO_TYPES::MH_CIGAM_64 - MACHO_TYPES::FAT_MAGIC - MACHO_TYPES::FAT_CIGAM + MACHO_TYPES::MAGIC + MACHO_TYPES::CIGAM + MACHO_TYPES::MAGIC_64 + MACHO_TYPES::CIGAM_64 + MACHO_TYPES::MAGIC_FAT + MACHO_TYPES::CIGAM_FAT - Section::TYPE::S_16BYTE_LITERALS + Section::TYPE::IS_16BYTE_LITERALS - Section::TYPE::S_4BYTE_LITERALS + Section::TYPE::IS_4BYTE_LITERALS - Section::TYPE::S_8BYTE_LITERALS + Section::TYPE::IS_8BYTE_LITERALS - Symbol::ORIGIN::LC_SYMTAB + Symbol::ORIGIN::SYMTAB
- ELF:
LIEF newly-inserted sections are now compatible with a
stripafter the modification of the binary (see: Adding a section/segment)Enhance support for IA64 architecture.
Introduce
lief.ELF.Segment.raw_flagsto access the raw (integer) value of the flag- If an ELF binary uses a custom page size, its value can be defined in the parser configuration: .
Add support for SH4
Add suport for x32/ILP32 ELF binaries (#1225)
Add support for S390x
Better endianess support when writing back a binary.
- Enhance support for removing segments (#1233):
Enhance support for removing or modifying symbol versions (related to the lief-patchelf initiative)
New doc section: Symbol Versions
New doc section: R[UN]PATH Modification
- DWARF:
LIEF extended can now process DWARF debug info in PE binaries
Add support for creating DWARF: DWARF Editor (require extended version
>= 0.17.0.2623)
- PDB:
- Add
- Add support for CodeView symbols:
S_COMPILE3, S_COMPILE2, S_BUILDINFO, S_ENVBLOCK. These symbols are exposed through the interface , which can be accessed using . This metadata provides build time information such as:Module Name : * Linker * Build Metadata: Frontend Version: 0.0.0.0 Backend Version : 14.37.32825.0 Tool Version : Microsoft (R) LINK Language : LINK Target : X64 Environment: cwd: C:\Users\romai\dev\rust\ast-grep exe: C:\Program Files\Microsoft Visual Studio\2022\Community\[...] pdb: C:\Users\romai\dev\rust\ast-grep\target\debug\deps\ast_grep.pdb cmd: /NOLOGO /LIBPATH:C:\Users\romai\dev\rust\ast-grep\target\[...] Module Name : std-4ee9ee8805e6ac55.std.ddad90bab7781587-cgu.0.rcgu.o Object : C:\Users\romai\scoop\persist\rustup\.rustup\toolchains\[...] Build Metadata: Frontend Version: 1.74.0.0 Backend Version : 17004.0.0.0 Tool Version : clang LLVM (rustc version 1.74.0 (79e9716c9 2023-11-13)) Language : RUST Target : X64 Build Info: Current directory: /rustc/79e9716c980570bfd1f666e3b16ac583f0168962 Build tool : C:\a\rust\rust\build\x86_64-pc-windows-msvc\stage1\bin\rustc.exe Source file : library\std\src\lib.rs\@\std.ddad90bab7781587-cgu.0 Command line : "-cc1" "--crate-name" "std" "--edition=2021" [...]
- OAT:
Parsing Android OAT files requires to explicitly use
lief.OAT.parse()
import lief # Before LIEF 0.17.0 this function returned a lief.OAT.Binary object lief.parse("CallDeviceId.oat") # Since LIEF 0.17.0 this function returns a lief.ELF.Binary object lief.parse("CallDeviceId.oat") # Return a lief.OAT.Binary object lief.OAT.parse("CallDeviceId.oat")
- Abstraction:
- Add to attach an external debug file to a . See these sections for more details: DWARF: Loading an external debug filePDB: Loading an external debug file
- Extended:
Fix issue in the Python bindings while trying to access
lief.__LIEF_MAIN_COMMIT__Fix CMake issue with
find_package(lief-extended)Use LLVM
21.1.x
- Build System:
- Dependencies:
Move to tl-expected
1.2.0Move to utfcpp
4.0.6Move to mbedtls
3.6.4Move to spdlog
1.15.3Move to
nlohmann/json3.12.0Upgrade nanobind to version
v2.8.x
- Utilities:
- Add
0.16.7 - October 5th, 2025¶
0.16.6 - May 29th, 2025¶
0.16.5 - April 19th, 2025¶
- ELF:
Relax the condition over the
DT_SYMENTentry (#1177)
- Mach-O:
- Compilation:
- Packages:
Add Python, Rust, SDK packages for Windows ARM64 (
aarch64-pc-windows-msvc)Add Python, Rust, SDK packages for Linux Musl ARM64 (
aarch64-unknown-linux-musl)Add Python, Rust, SDK packages for Linux Musl i686 (
i686-unknown-linux-musl)
0.16.4 - February 23rd, 2025¶
- Python:
- PE:
Fix export forwarding issue (#1168)
- MachO:
Fix truncated
nlist_t.n_typewhen rewriting a Mach-O binary
0.16.3 - February 1st, 2025¶
0.16.2 - January 1st, 2025¶
- Compilation:
Fix broken
aarch64Python wheel which is related to a toolchain issue (#1146)
0.16.1 - December 26th, 2024¶
- MachO:
Various fixes from DzenIsRich & peledins-zimperium Thanks to them, Mach-O modification is more reliable.
Fix issue when building with
-DLIEF_MACHO=ON(see: #1138)
- Rust:
Fix min-rustc version issue (see: 75a27f0)
- Compilation:
0.16.0 - December 10th, 2024¶
- Abstraction:
- Add to read an integer value at a specific virtual address
C++
LIEF::Binary& bin; uint16_t short_value = bin.get_int_from_virtual_address<uint16_>(0x140002CC8);
Python
some_bin: lief.Binary = ... long_value = some_bin.get_int_from_virtual_address(0x140002CC8, 4) # or long_value = some_bin.get_int_from_virtual_address(0x140002CC8, ctypes.sizeof(ctypes.c_uint32))
Rust
elf: &lief::elf::Binary let value: i16 = elf.get_int_from_virtual_address::<i16>(0x401126).unwrap();
- Global code cleaning (especially, and is now more meaningful)
- Re-scope
lief.ARCHITECTURESinto - Re-scope
lief.MODESinto - Re-scope
lief.OBJECT_TYPESinto - Re-scope
lief.ENDIANNESSinto
- MachO:
Fix endianness support (#1110)
Add helpers to determine the platform targeted by a Mach-O binary:
Expose an iterator over the stub entries located in
__stubs,__auth_stubs,__symbol_stub,__picsymbolstub4:- Add support for the
LC_SUBCLIENTcommand: - Add support for the
LC_ROUTINE/LC_ROUTINE64command: - Expose an iterator for the indirect symbols in
- Add to iterate over the bindings info located in or
- Add to represent a binding operation inferred from the indirect symbol table.This can be handy if a Mach-O does not have the commands or (e.g. extracted shared cache library)
- PE:
Fix authenticode error while reading RSA PKCS#1 1.5 padding
- ELF:
Fix issue when multiple empty strings are present in the
.symtabsection (#1124)- Add to resolve the value of relocations
Add support for eBPF relocations.
- Add support for
GNU_PROPERTY_AARCH64_FEATURE_PAUTHGNU property note: . - Add to check if an ELF targets Android
Fix a critical error when rewriting ELF file with
DT_RELRrelocations. This error leads to a crash of the modified binary.Fix error while (re)generating ELF’s RELR relocations (#1097)
Add support for RISC-V architecture
Fix bug when trying to remove a dynamic symbol that is associated with multiple relocations (#1089)
- Rust:
Mutable API are progressively introduced:
Thanks to Huntragon Rust bindings can be used without openssl (see: #1105)
Rust precompiled Linux packages are now supported for Debian 10 & Ubuntu 19.10. Before, they require at least Debian 11 & Ubuntu 20.04
Add support for the
x86_64-unknown-linux-musltarget which allows to generate full static executable.
- ObjC:
- The header-like generation () is now including method’s address as a comment:
Before
@interface GCKUIImageHints<NSCopying,NSSecureCoding> { long long _imageType; NSObject<NSSecureCoding> * _customData; struct CGSize _imageSize; } + (bool)supportsSecureCoding:(GCKUIImageHints *)self :(SEL)id; - (bool)isEqual:(GCKUIImageHints *)self :(SEL)id :(NSObject *)arg2;
After
@interface GCKUIImageHints<NSCopying,NSSecureCoding> { long long _imageType; NSObject<NSSecureCoding> * _customData; struct CGSize _imageSize; } // Address: 0x00001aa448 + (bool)supportsSecureCoding:(GCKUIImageHints *)self :(SEL)id; // Address: 0x00001aa5ec - (bool)isEqual:(GCKUIImageHints *)self :(SEL)id :(NSObject *)arg2;
- Fix for small methods.
- The output of can now be configured with .
- DWARF:
Add
DW_TAG_typedefsupport
- Extended:
Note
LIEF extended is now open to everyone
C++ SDK is now available
Rust package is now available
Initial assembler support: Assembler
Initial disassembler support: Disassembler
Linux Python wheels are now
manylinux_2_27compliants. In other words, they are working with a glibc from at least 2018.Support for Dyld shared cache
- is working on all platforms (not only unix-based builds)
- is working on all platforms (not only unix-based builds)
pe = lief.PE.parse("some.exe") if exp := pe.get_export(): for entry in exp.entries: # e.g.void __cdecl Platform::Details::EventSourceUninitialize(void **) print(entry.demangled_name) for imp in pe.imports: for entry in imp.entries: # e.g. void __cdecl std::_Xlength_error(char const *) print(entry.demangled_name)
- Add to demangle symbols (c.f. #1054)
The extended version is now using a versioning matching LIEF regular version
- Python Bindings:
Upgrade nanobind from
1.8.0to2.4.0*.pyistubs are now generated by nanobind (replacing mypy’s stugen)
- Dependencies:
Upgrade MbedTLS from
3.2.1to3.6.1
- doc:
Global restructuring of the documentation
Add Sphinx cross-reference support for Rust. For instance, this link:
lief::elf::Binary::debug_inforeferences the documentation ofdebug_infoin the Rust documentation page.- Add cross-api menu directive. For instance, this link: toggles a menu to access the documentation of DWARF’s debug info for Rust, Python & C++.
0.15.1 - July 23th, 2024¶
- MachO:
Fix missing commit for
.hwxsupport
0.15.0 - July 21th, 2024¶
- Extended:
Note
Add support for DWARF: DWARF
Add support for PDB: PDB
Add support for Objective-C: Objective-C
- Repo:
masterbranch has been renamedmain
- Rust:
First (beta) release of the bindings (c.f. Rust)
- ELF:
Add support to create custom notes (#1026):
elf: lief.ELF.Binary = ... elf += lief.ELF.Note.create( name="my-custom-note", original_type=lief.ELF.Note.TYPE.UNKNOWN, description=list(b"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed"), section_name=".lief.note.custom" ) config = lief.ELF.Builder.config_t() config.notes = True elf.write("/tmp/new-binary.elf", config)
Add
lief.ELF.Binary.get_relocated_dynamic_array()which allows to get a relocated view of the of init/fini entries. This function can handy ELF init array/fini array functions are defined through relocations. See: #1058, #626Add support for QNX Stack note (#1065)
The
static_symbolsAPI functions has been renamed insymtab_symbols.LIEF was naming symbols located in the
.symtabsections as static symbols in opposition to the.dynsymsymbols. This naming can be confusing since the concept of static symbol in a program is well defined (i.e.static bool my_var) and not applicable in this case.Therefore, the ``xxx_static_symbols`` API is has been renamed ``xxx_symtab_symbol``.
Re-scope
DYNAMIC_TAGSintolief.ELF.DynamicEntry.TAGRe-scope
E_TYPEintolief.ELF.Header.FILE_TYPERe-scope
VERSIONintolief.ELF.Header.VERSIONRe-scope
ELF_CLASSintolief.ELF.Header.CLASSRe-scope
ELF_DATAintolief.ELF.Header.ELF_DATARe-scope
OS_ABIintolief.ELF.Header.OS_ABIRe-scope
ELF_SECTION_TYPESintolief.ELF.Section.TYPERe-scope
ELF_SECTION_FLAGSintolief.ELF.Section.FLAGSRe-scope
SYMBOL_BINDINGSintolief.ELF.Symbol.BINDINGRe-scope
ELF_SYMBOL_TYPESintolief.ELF.Symbol.TYPERe-scope
ELF_SYMBOL_VISIBILITYintolief.ELF.Symbol.VISIBILITYRe-scope
SEGMENT_TYPESintolief.ELF.Segment.TYPERe-scope
ELF_SEGMENT_FLAGSintolief.ELF.Segment.FLAGRe-scope
DYNAMIC_FLAGS_1intolief.ELF.DynamicEntryFlags.FLAGRe-scope
DYNAMIC_FLAGSintolief.ELF.DynamicEntryFlags.FLAGRe-scope
DYNSYM_COUNT_METHODSintolief.ELF.ParserConfig.DYNSYM_COUNTRe-scope
RELOCATION_PURPOSESintolief.ELF.Relocation.PURPOSERELOC_x86_64,RELOC_i386, … have been re-scoped and merged intolief.ELF.Relocation.TYPEAdd support for Android packed relocation format (
DT_ANDROID_REL{A})Add support for relative relocation format (
DT_RELR)
- PE:
Authenticode: Add partial support for the following PKCS #7 attributes:
1.3.6.1.4.1.311.3.3.1 - Ms-CounterSign(lief.PE.MsCounterSign)1.3.6.1.4.1.311.10.3.28 - Ms-ManifestBinaryID(lief.PE.MsManifestBinaryID)1.3.6.1.4.1.311.2.6.1 - SPC_RELAXED_PE_MARKER_CHECK_OBJID(lief.PE.SpcRelaxedPeMarkerCheck)1.2.840.113549.1.9.16.2.47 - SIGNING_CERTIFICATE_V2(lief.PE.SigningCertificateV2)
1.2.840.113549.1.9.16.1.4 - PKCS#9 TSTInfo(lief.PE.PKCS9TSTInfo)
Add
lief.PE.CodeViewPDB.guidattribute (#480)Move
lief.PE.OptionalHeader.computed_checksumtolief.PE.Binary.compute_checksum()In previous versions of LIEF,
lief.PE.OptionalHeader.checksumwas re-computed (on purpose) in the parsing phase. On large binaries, this re-computation can have a strong impact on the performances. Thus, this computation has been deferred to a dedicated methodlief.PE.Binary.compute_checksum()pe = lief.PE.parse("...") # Before: computed = pe.optional_header.computed_checksum # Now: computed = pe.compute_checksum()
- MachO:
Add support to modify Mach-O rpath (see: #1074)
Add helper
lief.MachO.Binary.support_arm64_ptr_authto check if a Mach-O binary is supporting ARM64 pointer authentication (arm64e)Fix major performance issue when processing Mach-O binaries on Windows & macOS
Add generic
lief.MachO.UnknownCommandto support Apple private Load commands not officially supported by LIEF.Re-scope
LOAD_COMMAND_TYPESintolief.MachO.LoadCommand.TYPERe-scope
FILE_TYPESintolief.MachO.Header.FILE_TYPERe-scope
HEADER_FLAGSintolief.MachO.Header.FLAGSRe-scope
MACHO_SEGMENTS_FLAGSintolief.MachO.SegmentCommand.FLAGSRe-scope
MACHO_SECTION_TYPESintolief.MachO.Section.TYPERe-scope
MACHO_SECTION_FLAGSintolief.MachO.Section.FLAGSRe-scope
REBASE_TYPESintolief.MachO.DyldInfo.REBASE_TYPERe-scope
REBASE_OPCODESintolief.MachO.DyldInfo.REBASE_OPCODESRe-scope
BIND_OPCODESintolief.MachO.DyldInfo.BIND_OPCODESRe-scope
BINDING_CLASSintolief.MachO.DyldBindingInfo.CLASSRe-scope
BIND_TYPESintolief.MachO.DyldBindingInfo.TYPERe-scope
EXPORT_SYMBOL_FLAGSintolief.MachO.ExportInfo.FLAGSRe-scope
EXPORT_SYMBOL_KINDSintolief.MachO.ExportInfo.KINDRe-scope
RELOCATION_ORIGINSintolief.MachO.Relocation.ORIGINRe-scope
SYMBOL_ORIGINSintolief.MachO.Symbol.ORIGINRe-scope
VM_PROTECTIONSintolief.MachO.SegmentCommand.VM_PROTECTIONSRe-scope
CPU_TYPESintolief.MachO.Header.CPU_TYPE
- CMake:
LIEFConfig.cmakeis now installed in<prefix>/lib/cmake/LIEF/instead of<prefix>/share/LIEF/cmake/
- Python Bindings:
Add
lief.disable_leak_warning()to disable Nanobind warning about “leaks”.
Warning
These warnings does not necessarily mean that LIEF leak objects. These warnings might happen in Cyclic garbage collection.
- Documentation:
Add icons
Include inheritance diagram for Python API (e.g.
lief.ELF.Note)
0.14.1 - February 11th, 2024¶
0.14.0 - January 20, 2024¶
- ELF:
Add support for the GNU note properies (#975).
- Example:
elf = lief.ELF.parse("...") note = elf.get(lief.ELF.Note.TYPE.GNU_PROPERTY_TYPE_0) aarch64_feat: lief.ELF.AArch64Feature = note.find(lief.ELF.NoteGnuProperty.Property.TYPE.AARCH64_FEATURES) if lief.ELF.AArch64Feature.FEATURE.BTI in aarch64_feat.features: print("BTI supported")
See:
Refactoring of the ELF note processing
Fix relocation issue when using
-Wl,--emit-relocs(c.f. #897 / #898 by adamjseitz)Improve the computation of the dynamic symbols thanks to adamjseitz (c.f. #922)
Add support for the LoongArch architecture thanks to loongson-zn (c.f. #921)
Add a
lief.ELF.ParserConfiginterface that can be used to tweak which parts of the ELF format should be parsed.- Example:
config = lief.ELF.ParserConfig() # Skip parsing static and dynamic symbols config.parse_static_symbols = False config.parse_dyn_symbols = False elf = lief.ELF.parse("target.elf", config)
- MachO:
The fileset name is now stored in
lief.MachO.Binary.fileset_name(instead of lief.MachO.Binary.name)
- PE:
RESOURCE_SUBLANGShas been removedRESOURCE_LANGSis now defined in a dedicated header:LIEF/PE/resources/langs.hppRESOURCE_TYPESis now scoped inResourcesManager::TYPEGUARD_CF_FLAGSis now scoped asIMAGE_GUARDinlief.PE.LoadConfigurationV1SECTION_CHARACTERISTICSis now scoped within theSectionclass instead of being globally defined:# Before lief.PE.SECTION_CHARACTERISTICS.CNT_CODE # Now: lief.PE.Section.CHARACTERISTICS.CNT_CODE
DATA_DIRECTORYis now scoped within theDataDirectoryclass instead of being globally defined:# Before lief.PE.DATA_DIRECTORY.IAT # Now: lief.PE.DataDirectory.TYPES.IAT
MACHINE_TYPESandHEADER_CHARACTERISTICSare now scoped within theHeaderclass instead of being globally defined:# Before lief.PE.MACHINE_TYPES.AMD64 # Now: lief.PE.Header.MACHINE_TYPES.AMD64
lief.PE.Header.characteristicsnow returns a list/std::vector instead of aset.lief.PE.OptionalHeader.dll_characteristics_listsnow returns alist/std::vectorinstead of aset.SUBSYSTEMandDLL_CHARACTERISTICSare now scoped within theOptionalHeaderclass instead of being globally defined:# Before lief.PE.SUBSYSTEM.NATIVE # Now: lief.PE.OptionalHeader.SUBSYSTEM.NATIVE
lief.PE.DosHeader.used_bytes_in_the_last_pagehas been renamed inlief.PE.DosHeader.used_bytes_in_last_pageRefactoring of the Debug directory processing:
lief.PE.Debugis now the root class of:lief.PE.CodeView/lief.PE.CodeView,lief.PE.Pogo,lief.PE.Repro.The parsing logic has been cleaned and the tests updated.
Add a
lief.PE.ParserConfiginterface that can be used to tweak which parts of the PE format should be parsed (#839).- Example:
config = lief.PE.ParserConfig() # Skip parsing PE authenticode config.parse_signature = False pe = lief.PE.parse("pe.exe", config)
- Abstraction:
LIEF::EXE_FORMATSis now scoped inLIEF::Binary::FORMATSAll the Binary classes now implement classof:
std::unique_ptr<LIEF::Binary> bin = LIEF::Parser::parse("..."); if (LIEF::PE::Binary::classof(bin.get())) { auto& pe_file = static_cast<LIEF::PE::Binary&>(*bin); }
- General Design:
Python parser functions (like:
lief.PE.parse()) now accept os.PathLike arguments like pathlib.Path (#974).Remove the lief.Binary.name attribute
LIEF is now compiled with C++17 (the API remains C++11 compliant)
Switch to nanobind for the Python bindings.
CI are now more efficient.
The Python documentation for properties now contains the type of the property.
0.13.2 - June 17, 2023¶
0.13.1 - May 28, 2023¶
0.13.0 - April 9, 2023¶
- ELF:
Fix overflow issue in segments (c.f. #845 found by liyansong2018)
Fix missing relationship between symbols and sections (c.f. #841)
Fix and (re)enable removing dynamic symbols (c.f. #828)
Add support for NT_GNU_BUILD_ATTRIBUTE_OPEN and NT_GNU_BUILD_ATTRIBUTE_FUNC (c.f. #816)
[CVE-2022-38497] Fix ELF core parsing issue (#766 found by CCWANG19)
[CVE-2022-38306] Fix a heap overflow found by CCWANG19 (#763)
aeflores fixed an issue when there are multiple versions associated with a symbol (see: #749 for the details).
Handle binaries compiled with the -static-pie flag correctly (see: #747)
Add support for modifying section-less binaries. The ELF
Sectionobjects gain thelief.ELF.Section.as_frame()method which defines the section as a framed section.A framed section is a section that concretely does not wraps data and can be corrupted.
- Example:
elf = lief.parse("/bin/ssh") text = elf.get_section(".text").as_frame() # We can now corrupt all the fields of the section text.offset = 0xdeadc0de text.size = 0xffffff text.address = 0x123 elf.write("/tmp/out")
Add API to precisely define how the segments table should be relocated. One might want to enforce a certain ELF layout while adding sections/ segments. It is now possible to call the method:
relocate_phdr_table()to define how the segments table should be relocated for welcoming the new sections/segments:elf = lief.parse("...") # Enforce a specific relocation type: # The new segments table will be shift at the end # of the file elf.relocate_phdr_table(Binary.PHDR_RELOC.FILE_END) # Add sections/segments # [...] elf.write("out.elf")
See:
- MachO:
Add support for parsing Mach-O in memory
[CVE-2022-38307] Fix a segfault when the Mach-O binary does not have segments (found by CCWANG19 via #764)
Enable to create exports
Fix the layout of the binaries modified by LIEF such as they can be (re)signed.
Add support for LC_DYLD_CHAINED_FIXUPS and LC_DYLD_EXPORTS_TRIE
Global enhancement when modifying the __LINKEDIT content
Add API to get a
Sectionfrom a specified segment’s name and section’s name.
- Example:
sec = bin.get_section("__DATA", "__objc_metadata")
Add API to remove a
Sectionfrom a specified segment’s name and section’s name.
- Example:
sec = bin.remove_section("__DATA", "__objc_metadata")
Add
lief.MachO.Binary.page_size
- PE:
The Python API now returns bytes objects instead of List[int]
Remove
lief.PE.ResourceNode.sort_by_id()Fix the ordering of children of
ResourceNodeRemove deprecated functions related to PE hooking.
Add support for new PE LoadConfiguration structures.
- DEX:
Fix multiple parsing issues raised by bladchan
- Other:
- General Design:
- Python Bindings:
Move to a build system compliant with
pyproject.tomlProvide typing stubs: #650
PyPI releases no longer provide source distribution (sdist)
- Dependencies:
Move to spdlog 1.11.0
Move to Pybind11 - 2.10.1
Move to nlohmann/json 3.11.2
Move to MbedTLS 3.2.1
Move to utfcpp 3.2.1
0.12.3 - November 1, 2022¶
This release contains several security fixes:
0.12.1 - April 08, 2022¶
0.12.0 - March 25, 2022¶
- ELF:
ahaensler added the support to insert and assign a
lief.ELF.SymbolVersionAuxRequirement(see: #670)Enhance the ELF parser to support corner cases described by netspooky in :
https://tmpout.sh/2/14.html (84 byte aarch64 ELF)
https://tmpout.sh/2/3.html (Some ELF Parser Bugs)
New ELF Builder which is more efficient in terms of speed and in terms of number of segments added when modifying binaries (see: https://lief-project.github.io/blog/2022-01-23-new-elf-builder/)
Clcanny improved (see #507 and #509) the reconstruction of the dynamic symbol table by sorting local symbols and non-exported symbols. It fixes the following warning when parsing a modified binary with
readelfWarning: local symbol 29 found at index >= .dynsym's sh_info value of 1
- MachO:
Change the layout of the binaries generated by LIEF such as they are compliant with
codesignchecksThe API to configure the MachO parser has been redesigned to provide a better granularity
config = lief.MachO.ParserConfig() config.parse_dyld_bindings = False config.parse_dyld_exports = True config.parse_dyld_rebases = False lief.MachO.parse("/tmp/big.macho", config)
LucaMoroSyn added the support for the
LC_FILESET_ENTRY. This command is usually found in kernel cache filesLIEF::MachO::Binary::get_symbolnow returns a pointer (instead of a reference). If the symbol can’t be found, it returns a nullptr.Add API to select a
Binaryfrom aFatBinaryby its architecture. See:lief.MachO.FatBinary.take().fat = lief.MachO.parse("/bin/ls") fit = fat.take(lief.MachO.CPU_TYPES.x86_64)
Handle the 0x0D binding opcode (see: #524)
xhochy fixed performances issues in the Mach-O parser (see #579)
- PE:
Adding
lief.PE.OptionalHeader.computed_checksumthat re-computes thelief.PE.OptionalHeader.checksum(c.f. issue #660)Enable to recompute the
RichHeader(issue: #587)Add support for PE’s delayed imports. see:
lief.PE.LoadConfiguration.reserved1has been aliased tolief.PE.LoadConfiguration.dependent_load_flagslief.PE.LoadConfiguration.characteristicshas been aliased tolief.PE.LoadConfiguration.sizeThanks to gdesmar, we updated the PE checks to support PE files that have a corrupted
lief.PE.OptionalHeader.magic(cf. #644)
- DEX:
- Abstraction:
Abstract binary imagebase for PE, ELF and Mach-O (
lief.Binary.imagebase)Add PE imports/exports as abstracted symbols
- Compilation & Integration:
ekilmer updated and modernized the CMake integration files through the PR: #674
Enable to use a pre-compiled version of spdlog. This feature aims at improving compilation time when developing on LIEF.
One can provide path to spdlog install through:
$ python ./setup.py --spdlog-dir=path/to/lib/cmake/spdlog [...] # or $ cmake -DLIEF_EXTERNAL_SPDLOG=ON -Dspdlog_DIR=path/to/lib/cmake/spdlog ...
Enable to feed LIEF’s dependencies externally (c.f. Third Party)
Replace the keywords
and,or,notwith&&,||and!.
- Dependencies:
Upgrade to MbedTLS 3.1.0
Upgrade Catch2 to 2.13.8
The different dependencies can be linked externally (cf. above and Third Party)
- Documentation:
New section about the errors handling ( Error Handling) and the upcoming deprecation of the exceptions.
New section about how to compile LIEF for debugging/developing. See: Debugging
- General Design:
- span:
LIEF now exposes Section/Segment’s data through a span interface. As std::span is available in the STL from C++20 and the LIEF public API aims at being C++11 compliant, we expose this span thanks to tcbrindle/span. This new interface enables to avoid copies of
std::vector<uint8_t>which can be costly. With this new interface, the originalstd::vector<uint8_t>can be retrieved as follows:auto bin = LIEF::ELF::Parser::parse("/bin/ls"); if (const auto* section = bin->get_section(".text")) { LIEF::span<const uint8_t> text_ref = section->content(); std::vector<uint8_t> copy = {std::begin(text_ref), std::end(text_ref)}; }
In Python, span are wrapped by a read-only memory view. The original list of bytes can be retrieved as follows:
bin = lief.parse("/bin/ls") section = bin.get_section(".text") if section is not None: memory_view = section.content list_of_bytes = list(memory_view)
- Exceptions:
Warning
We started to refactor the API and the internal design to remove C++ exceptions. These changes are described a the dedicated blog (LIEF RTTI & Exceptions)
To highlighting the content of the blog for the end users, functions that returned a reference and which threw an exception in the case of a failure are now returning a pointer that is set to nullptr in the case of a failure.
If we consider this original code:
LIEF::MachO::Binary& bin = ...; try { LIEF::MachO::UUIDCommand& cmd = bin.uuid(); std::cout << cmd << "\n"; } catch (const LIEF::not_found&) { // ... dedicated processing } // Other option with has_uuid() if (bin.has_uuid()) { LIEF::MachO::UUIDCommand& cmd = bin.uuid(); std::cout << cmd << "\n"; }
It can now be written as:
LIEF::MachO::Binary& bin = ...; if (LIEF::MachO::UUIDCommand* cmd = bin.uuid();) { std::cout << *cmd << "\n"; } else { // ... dedicated processing as it is a nullptr } // Other option with has_uuid() if (bin.has_uuid()) { // It ensures that it is not a nullptr LIEF::MachO::UUIDCommand& cmd = *bin.uuid(); std::cout << cmd << "\n"; }
0.11.X - Patch Releases¶
0.11.5 - May 22, 2021¶
Remove usage of
notin public headers (b8e825b)
- ELF:
- PE:
Fix issue when computing
lief.PE.Binary.sizeof_headers(ab3f073)
- MachO:
Fix error on property
lief.MachO.BuildVersion.sdk(see #533)
0.11.4 - March 09, 2021¶
- PE:
Fix missing bound check when computing the authentihash
0.11.3 - March 03, 2021¶
- PE:
Add sanity check on the signature’s length that could lead to a
std::bad_allocexception
0.11.2 - February 24, 2021¶
- PE:
Fix regression in the behavior of the PE section’s name. One can now access the full section’s name (with trailing bytes) through
lief.PE.Section.fullname(see: #551)
0.11.1 - February 22, 2021¶
- PE:
lief.PE.x509.is_trusted_by()andlief.PE.x509.verify()now return a betterlief.PE.x509.VERIFICATION_FLAGSinstead of justlief.PE.x509.VERIFICATION_FLAGS.BADCERT_NOT_TRUSTED(see: #532)Fix errors in the computation of the Authentihash
0.11.0 - January 19, 2021¶
- ELF:
aeflores added MIPS relocations support in the ELF parser
Fix issue when exporting symbols on empty-gnu-hash ELF binary (1381f9a)
Fix reconstruction issue when the binary is prelinked (cf. issue #466)
Add
DF_1_PIEflagFix parsing issue of the
.eh_framesection when the base address is not 0.JanuszL enhanced the algorithm that computes the string table. It moves from a
N^2algorithm to aNlog(N)(1e0c4e8).Fix
.eh_frameparsing issue (b57f323)Add
PT_GNU_PROPERTYenumBug fix in the symbols table reconstruction (ELF)
- PE:
Enhance PE Authenticode. See PE Authenticode
get_imphash()can now generate the same value as pefile and Virus Total (#299)pe = lief.parse("example.exe") vt_imphash = lief.PE.get_imphash(pe, lief.PE.IMPHASH_MODE.PEFILE) lief_imphash = lief.PE.get_imphash(pe, lief.PE.IMPHASH_MODE.DEFAULT)
See also
Remove the padding entry (0) from the rich header
lief.PE.LangCodeItem.itemsnow returns a dictionary for which the values are bytes (instead ofstrobject). This change is related toutf-16support.kohnakagawa fixed wrong enums values: c031250, 6ee808a, cd05f34
kohnakagawa fixed a bug in the PE resources parser (a7254d1)
Handle PE forwarded exports (issue #307)
- Mach-O:
- Dependencies:
Replace
easyloggingppwith spdlog 1.8.1Upgrade
frozento 1.0.0Upgrade
jsonto 3.7.3Upgrade
pybind11to 2.6.0Upgrade
mbedtlsto 2.16.6
- Documentation:
aguinet updated the bin2lib tutorial with the support of the new glibc versions (7884e57)
Global update and enable to build the documentation out-of-tree
Changing the theme
- Misc:
Add Python 3.9 support
FindLIEF.cmakedeprecatesLIEF_ROOT. You should useLIEF_DIRinstead.
- Logging:
We changed the logging interface. The following log levels have been removed:
LOG_GLOBAL
LOG_FATAL
LOG_VERBOSE
LOG_UNKNOWN
We also moved from an class-interface based to functions.
Example:
lief.logging.disable() lief.logging.enable() lief.logging.set_level(lief.logging.LEVEL.INFO)
Note
The log functions now output on
stderrinstead ofstdout
0.10.1 - November 29, 2019¶
Fix regression in parsing Python
bytesAdd Python API to demangle strings:
lief.demangle
0.10.0 - November 24, 2019¶
- ELF:
Add build support for ELF notes
Add coredump support (9fc3a8a)
Enable to bind a relocation with a symbol (a9f3cb8)
- Example:
relocation = "..." symbol = lief.ELF.Symbol() symbol.name = "printf123" relocation.symbol = symbol
Add constructors (67d924a)
Expose ELF destructors (957384c)
Add
remove_static_symbol(c677970)Add support for static relocation writing (d1b98d6)
Expose function to get strings located in the
.rodatasection (02f4851)Export ELF ABI version (8d7ec26)
- PE:
- Mach-O:
Enhance Mach-O modifications by exposing an API to:
Add load commands
Add sections
Add segments
See: 406115c
Enable
write()on FAT Mach-O (1659531)Introduce Mach-O Build Version command (6f96723)
Enable to remove Mach-O symbols (616d739)
Add support for adding
LC_UNIXTHREADcommands in a MachO (by nezetic - 64d2597)
- Abstract Layer:
- Android:
Add partial support for Android 9 (bce9ebe)
- Misc:
Many thanks to the contributors: recvfrom, pbrunet, mackncheesiest, wisk, nezetic, lkollar, jbremer, DaLynX, 1orenz0, breadchris, 0xbf00, unratito, strazzere, aguinetqb, mingwandroid, serge-sans-paille-qb, yrp604, majin42, KOLANICH
0.9.0 - June 11, 2018¶
LIEF 0.9 comes with new formats related to Android: OAT, DEX, VDEX and ART. It also fixes bugs and thanks to yd0b0N, ELF parser now supports big and little endian binaries. We also completed the JSON serialization of LIEF objects. Enable to configure the Mach-O parser for quick parsing: 880b99a Add Add Add Add Add Add API to show export-trie, rebase and binding opcodes: 5d56141 Add PE Code View: eab4a76 Parser now returns a Use frozen for some internal Features¶
lief.MachO.EncryptionInfo command: f4e2d81lief.MachO.RPathCommand command: 196994dlief.MachO.DataInCode command: a16e1c4lief.MachO.SubFramework command: 9e3b5b4lief.MachO.SegmentSplitInfo command: 9e3b5b4lief.MachO.DyldEnvironment command: 9e3b5b4API¶
lief.breakp() and lief.shell()lief.parse() now support io streams as inputstd::unique_ptr instead of a raw pointer: cd1cc45Misc¶
std::map (If C++14 is supported by the compiler)Acknowledgements¶
0.8.3¶
[Mach-O] Fix typo on comparison operator - abbc264
0.8.2¶
[ELF] Increase the upper limit of relocation number - 077bc32
0.8.1 - October 18, 2017¶
0.8.0 - October 16, 2017¶
LIEF 0.8.0 mainly improves the MachO parser and the ELF builder. It comes with Dockerfiles for CentOS and Android.
LibFuzzer has also been integrated in the project to enhance the parsers Add the Handle relocations of object files ( Global enhancement of the ELF builder: One can now add multiple One can now add multiple entries in the dynamic table: b2d3694 enables modification of the ELF interpreter without length restriction Enhancement of the dynamic symbols counting - 985d124 Enable editing ELF’s notes: See commit 3be9dd0 for more details Add Parse the Load Config Table into For details, see commit: 0234e3b The Binding opcodes Rebases opcodes Export trie Section relocations are now parsed into Fix enums conflicts(#32) - 66b4cd4 Fix most of the memory leaks: 88dafa8, d9b1436, 554fa15, 3602643 In the C++ API Add [Python API] Enhance the access to the abstract layer through the One can now do: Add Add: To check if a given flag is set, one can do: [Python] Segment flags: Enhancement for Enhancement for Add some operators 5666351 Add some operators: cbe8354 Add an API to configure the logger - 4600c2b Example: See: Add FindLIEF.cmake - 6dd8b10 Add ASAN, TSAN, USAN, LSAN - 7f6aeb0 Add LibFuzzer - 7a0dc28 recomposer, bearparser, IAT_patcher, PEframe, Manalyze, MachOView, elf-dissectorFeatures¶
Relocation are now abstracted from the 3 formats - 9503f2fPIE and NX are abstracted through the is_pie and has_nx propertieslief.Section.search() and lief.Section.search_all() methods to look for patterns in the section’s content.DT_FLAGS and DT_FLAGS_1 are now parsed into DynamicEntryFlags - 754b8af.o) - 483b8dcSection or Segment into an ELF:elf = lief.parse("/bin/cat")
for i in range(3):
segment = Segment()
segment.type = SEGMENT_TYPES.LOAD
segment.content = [i & 0xFF] * 0x1000
elf += segment
for i in range(3):
section = Section("lief_{:02d}".format(i))
section.content = [i & 0xFF] * 0x1000
elf += section
elf.write("foo")
$ readelf -l ./foo
PHDR 0x0000000000000040 0x0000000000000040 0x0000000000000040
0x00000000000061f8 0x00000000000061f8 R E 0x8
INTERP 0x0000000000006238 0x0000000000006238 0x0000000000006238
0x000000000000001c 0x000000000000001c R 0x1
[Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]
LOAD 0x0000000000000000 0x0000000000000000 0x0000000000000000
0x000000000000d6d4 0x000000000000d6d4 R E 0x200000
LOAD 0x000000000000da90 0x000000000020da90 0x000000000020da90
0x0000000000000630 0x00000000000007d0 RW 0x200000
LOAD 0x000000000000f000 0x000000000040f000 0x000000000040f000
0x0000000000001000 0x0000000000001000 0x1000
LOAD 0x0000000000010000 0x0000000000810000 0x0000000000810000
0x0000000000001000 0x0000000000001000 0x1000
LOAD 0x0000000000011000 0x0000000001011000 0x0000000001011000
0x0000000000001000 0x0000000000001000 0x1000
....
$ readelf -S ./foo
...
[27] lief_00 PROGBITS 0000000002012000 00012000
0000000000001000 0000000000000000 0 0 4096
[28] lief_01 PROGBITS 0000000004013000 00013000
0000000000001000 0000000000000000 0 0 4096
[29] lief_02 PROGBITS 0000000008014000 00014000
0000000000001000 0000000000000000 0 0 4096
elf = lief.parse("/bin/cat")
elf.add_library("libfoo.so")
elf.add(DynamicEntryRunPath("$ORIGIN"))
elf.add(DynamicEntry(DYNAMIC_TAGS.INIT, 123))
elf.add(DynamicSharedObject("libbar.so"))
elf.write("foo")
$ readelf -d foo
0x0000000000000001 (NEEDED) Shared library: [libfoo.so]
0x0000000000000001 (NEEDED) Shared library: [libc.so.6]
0x000000000000000c (INIT) 0x7b
0x000000000000000c (INIT) 0x3600
...
0x000000000000001d (RUNPATH) Bibliothèque runpath:[$ORIGIN]
0x000000000000000e (SONAME) Bibliothèque soname: [libbar.so]
elf = lief.parse("/bin/cat")
elf.interpreter = "/a/very/long/path/to/another/interpreter"
elf.write("foo")
$ readelf -l foo
Program Headers:
Type Offset VirtAddr PhysAddr
FileSiz MemSiz Flags Align
PHDR 0x0000000000000040 0x0000000000000040 0x0000000000000040
0x00000000000011f8 0x00000000000011f8 R E 0x8
INTERP 0x000000000000a000 0x000000000040a000 0x000000000040a000
0x0000000000001000 0x0000000000001000 R 0x1
[Requesting program interpreter: /a/very/long/path/to/another/interpreter]
....
elf = lief.parse("/bin/ls")
build_id = elf[NOTE_TYPES.BUILD_ID]
build_id.description = [0xFF] * 20
elf.write("foo")
$ readelf -n foo
Displaying notes found in: .note.gnu.build-id
Owner Data size Description
GNU 0x00000014 NT_GNU_BUILD_ID (unique build ID bitstring)
Build ID: ffffffffffffffffffffffffffffffffffffffff
get_imphash() and resolve_ordinals() functions - a89bc6d, dfa8e98LoadConfiguration (up to Windows 10 SDK 15002 with hotpatch_table_offset)from lief import to_json
import json
pe = lief.parse("some.exe")
loadconfig = to_json(pe.load_configuration)) # Using the lief.to_json function
pprint(json.loads(to_json(loadconfig)))
{'characteristics': 248,
'code_integrity': {'catalog': 0,
'catalog_offset': 0,
'flags': 0,
'reserved': 0},
'critical_section_default_timeout': 0,
'csd_version': 0,
'editlist': 0,
...
'guard_cf_check_function_pointer': 5368782848,
'guard_cf_dispatch_function_pointer': 5368782864,
'guard_cf_function_count': 15,
'guard_cf_function_table': 5368778752,
'guard_flags': 66816,
'guard_long_jump_target_count': 0,
'guard_long_jump_target_table': 0,
'guard_rf_failure_routine': 5368713280,
'guard_rf_failure_routine_function_pointer': 5368782880,
...
dyld structure is parsed (deeply) into DyldInfo. It includes:lief.MachO.Section.relocations - 29c8157LC_FUNCTION_STARTS is parsed into FunctionStarts (18d8919)LC_SOURCE_VERSION, LC_VERSION_MIN_MACOSX and LC_VERSION_MIN_IPHONEOS are parsed into SourceVersion and VersionMin (c359778, 0b4bb7d, 5b99311, #45)LC_THREAD and LC_UNIXTHREAD are now parsed into ThreadCommand - 2325783Fixes¶
API¶
get_XXX() getters have been renamed into XXX() (e.g. get_header() becomes header()) - a4c69f7, e805669lief.Binary gains the format property - 9391238lief.parse() can now takes a list of integers - f330fa8has_symbol() and get_symbol() to lief.Binary - f121af5abstract attribute - 0713854elf = lief.ELF.parse("/bin/ls") # Could be lief.MachO / lief.PE
abstract = elf.abstract # Return the lief.Binary object
lief.ELF.Binary.symbols which return an iterator over all symbols (static and dynamic) - af6ab65Header.sizeof_section_header has been renamed into section_header_size - d96971barm_flags_list,mips_flags_listppc64_flags_listhexagon_flags_list>>> if lief.ELF.ARM_EFLAGS.EABI_VER5 in lief.ELF.Header "yes" else "no"
PF_X, PF_W, PF_X has been renamed into X, W, X - d70ef9eDynamicEntryRpath and DynamicEntryRunPath: c375a47DynamicEntryArray: 81440celief.MachO.parse() can now takes a list of integers - f330fa8lief.MachO.parse() now returns a FatBinary instead of a list of Binary. FatBinary has a similar API as a list - 3602643from lief import Logger
Logger.disable()
Logger.enable()
Logger.set_level(lief.LEVEL.INFO)
lief.LoggerBuild system¶
Documentation¶
Acknowledgements¶
0.7.0 - July 3, 2017¶
Features¶
- Abstract Layer:
- ELF:
- PE:
Bug Fixes¶
API¶
- Abstract Layer:
- ELF:
lief.ELF.Segment.datahas been renamed tolief.ELF.Segment.contentlief.ELF.parse()takes an optional parameters: symbol counting -lief.ELF.DYNSYM_COUNT_METHODSlief.ELF.Relocation.size
- PE:
lief.PE.Symbol.has_sectionlief.PE.Binary.hook_function()lief.PE.Binary.get_content_from_virtual_address()takes either an Absolute virtual address or a Relative virtual addresslief.PE.Binary.section_from_virtual_addresshas been renamed tolief.PE.Binary.section_from_rva().lief.PE.parse_from_rawhas been removed. One can uselief.PE.parse().lief.PE.Section.datahas been removed. Please uselief.PE.Section.content
- Dos Stub:
lief.PE.Builder.build_dos_stub
- Rich Header:
- Overlay:
lief.PE.Builder.build_overlay
- Imports:
- Resources:
lief.PE.LangCodeItemlief.PE.ResourceDialogItemlief.PE.ResourceFixedFileInfo
- MachO:
Documentation¶
- References:
elfsteem, pelook, PortEx, elfsharp, metasm, amoco, Goblin
- Tutorials:
- Integration:
Acknowledgements¶
0.6.1 - April 6, 2017¶
Bug Fixes¶
- ELF:
Don’t rely on
lief.ELF.Section.entry_sizeto count symbols - 004c676
API¶
Documentation¶
- Integration:
Acknowledgements¶
Philippe for the proofreading.
0.6.0 - March 30, 2017¶
First public release