Annotated. Each entry says why you would open it, so you can pick the right one under time
pressure.
ELF is unusual in this repository in the same way DEX is: it has a normative written
specification as well as several implementations. When the specification and Android's linker
appear to disagree, the linker is what runs on the device — and Android's own elf.h is the
tiebreaker for anything Android-specific.
The normative source. Chapter 4 defines the ELF header, sections and symbols; chapter 5 defines segments, the dynamic array and relocation. Every table in README §3 traces back to these two chapters
Independent implementations and specification notes; useful when two tools disagree
The three-tier rule, worth internalising early: ELF constants come from three places. The
generic ABI (above) defines everything common. The processor supplement defines values in
0x7xxxxxxx — PT_ARM_EXIDX lives there. The OS supplement defines 0x6xxxxxxx — every
PT_GNU_*, DT_GNU_* and DT_ANDROID_* lives there. A tool printing a raw constant is usually
telling you it does not have that tier's supplement, not that the file is corrupt.
The umbrella repository. AAELF64 defines the R_AARCH64_* relocation numbering used in README §3.7; AAELF32 does the same for ARM32 and defines PT_ARM_EXIDX
Read on cs.android.com. 07-AOSP is the
navigation technique. File paths are stable; line numbers are not, and none are cited anywhere in
this chapter.
The dynamic linker — the implementation of README §3.10¶
Path
Open it when
bionic/linker/linker.cpp
You want find_library / load_library and the dependency walk
bionic/linker/linker_phdr.cpp
You want the ElfReader class: header verification, ReserveAddressSpace, LoadSegments, FindPhdr, and phdr_table_protect_gnu_relro — the mprotect that implements RELRO
bionic/linker/linker_relocate.cpp
You want to see R_AARCH64_RELATIVE, GLOB_DAT and JUMP_SLOT actually applied, and where the packed and RELR formats are decoded. The single most useful file in this list
bionic/linker/linker_soinfo.cpp, linker_soinfo.h
The soinfo bookkeeping, symbol lookup, and call_constructors — which runs .init_array
The authoritative Android ELF constant list. Where DT_ANDROID_REL, DT_ANDROID_RELA, DT_ANDROID_RELR and SHT_ANDROID_* are defined, with comments on their history. Ships in every NDK sysroot as usr/include/elf.h, so if you have an NDK you already have it. Every Android-specific constant in this chapter was checked against it — including DT_ANDROID_RELRENT, which is 0x6FFFE003 and breaks the consecutive run
bionic/libc/include/link.h
struct link_map and dl_iterate_phdr — how a process enumerates its own libraries, and the list a hiding library unlinks itself from
bionic/libc/include/sys/auxv.h
getauxval, AT_SECURE, AT_HWCAP — how native code learns about its environment
Use this, not binutils, on Android targets. Ships in every NDK at toolchains/llvm/prebuilt/<host>/bin/. Decodes Android's packed relocations, which binutils cannot
llvm-objdump, llvm-nm, llvm-strip, llvm-cxxfilt
The rest of the NDK's LLVM binutils. llvm-cxxfilt demangles C++ names, which you will need constantly
readelf, objdump, nm, strings (GNU binutils)
Fine for anything not using Android-specific formats. Silently reports zero relocations on a packed library
The definitive explanation of PLT, GOT, symbol visibility, lazy binding and why -fvisibility=hidden matters. Dense, opinionated, and the single best thing on this list
Eli Bendersky, Position Independent Code (PIC) in shared libraries
The clearest short explanation anywhere of why the GOT exists. Read it before Drepper if the concept is new
Eli Bendersky, Load-time relocation of shared libraries
The companion piece, on what the linker actually patches
Ian Lance Taylor, the twenty-part Linkers series (airs.com)
How linkers work, by someone who wrote gold. Long, and the best explanation of symbol resolution order in existence
Learning Linux Binary Analysis, Ryan O'Neill
ELF from an offensive and forensic angle: infection techniques, anti-analysis, memory forensics. Directly relevant to Lab 05
MWR/other public write-ups on Android packers
Search for current ones rather than relying on a fixed link; the techniques in README §6.6 are all documented publicly
Cite the identifier in every finding. "The library has no stack canaries" is an observation;
mapping it to MASVS-CODE-4 turns it into something a programme can track — and, just as importantly,
something a programme can decide to accept.
Only identifiers verified as real are listed here. Where the class matters more than the instance,
the class is described rather than an identifier invented.
Identifier
One line
CVE-2015-1538
Integer overflow in Android's libstagefright MP4 handling, reachable by MMS. The archetypal native-parser vulnerability, and the reason Android's media stack was rearchitected
CVE-2016-5195
"Dirty COW" — a Linux kernel copy-on-write race, widely used to root Android devices
CVE-2019-2215
Use-after-free in the kernel Binder driver, exploited in the wild
(class, not an ID)
Repeated integer-overflow and heap-overflow findings in bundled libpng, libjpeg-turbo, FreeType, libwebp and OpenSSL forks. These are the highest-yield native findings on real engagements, and identifying which version is bundled is 17-Libraries's subject
Never cite a CVE identifier you have not checked. One wrong number destroys the reader's trust
in every other number in the report. Where you are unsure, describe the class: "an integer-overflow
vulnerability of the kind found repeatedly in media parsers" is true, useful, and cannot be wrong.