Overview
Proone is designed to target a wide range of embedded Linux devices with different CPU architectures. The project includes sophisticated build scripts that automate cross-compilation for multiple architectures and package them into a single deployable executable with a FatELF-style binary archive.Cross-Compilation Workflow
The cross-compilation process involves:- Building native tools for the build host
- Cross-compiling the worm for each target architecture
- Stripping and extracting debug symbols
- Generating data vault and credential dictionaries
- Packing all binaries into a single multi-architecture executable
Prerequisites
Required Tool: xcomp
The build scripts depend on thexcomp tool for managing cross-compilation environments. This tool must be installed and configured before running the build scripts.
Reference: ~/workspace/source/scripts/build-all.sh:5
Cross-Compilation Toolchains
Install cross-compilation toolchains for your target architectures:- Cross-compiler (
<target>-gcc) - Binutils (
<target>-objcopy,<target>-strip,<target>-readelf) - Standard libraries for the target
Target Libraries
All dependencies must be cross-compiled for each target architecture:- mbedtls (mbedcrypto, mbedx509, mbedtls)
- libssh2
- zlib
- pthsem
LDFLAGS/CPPFLAGS.
Build Configuration
Create a configuration filescripts/build-all.conf.sh to specify target architectures:
OS- Operating system (currently only “linux” supported)ARCH- Architecture identifier for output filesTARGET_PREFIX- Target identifier used in file namingHOST- Host triplet passed to--hostin configureCOMPILER_PREFIX- Toolchain prefix for compiler/binutils
Build Scripts
build-all.sh
The main script that orchestrates the entire multi-architecture build process. Location:scripts/build-all.sh
Usage:
-
Loads configuration from
scripts/build-all.conf.sh -
Creates build directory structure:
builds/- Root build output directorybuilds/debug/- Debug symbol filesbuilds/proone.bin/- Architecture-specific ELF filesbuilds/tools/- Native build toolsbuilds/misc/- Test utilitiesbuilds/proone/- Final multi-arch executables
-
Builds native tools on the build host:
- proone-pack
- proone-list-arch
- proone-mkcdict
- proone-mkdvault
- proone-ipaddr-arr
-
Generates data vault and credential dictionary:
-
Cross-compiles each target using
xcompandbuild-arch.sh -
Packs all executables into final multi-architecture binary:
build-arch.sh
Builds Proone for a single target architecture. Location:scripts/build-arch.sh
Usage:
-
Configures with cross-compilation settings:
-
Compiles core executable and test utilities:
-
Separates debug symbols using the
separate_debugfunction:- Copies unstripped executable
- Extracts debug symbols with
objcopy --only-keep-debug - Strips binary removing unnecessary sections
- Adds debug link with
objcopy --add-gnu-debuglink - Generates readelf output for analysis
- Cleans up for next architecture build
separate_debug Function
Extraction of debug symbols for post-mortem debugging:- Build IDs and notes
- Comments and version info
- Exception handling frames
- GOT/PLT sections (for static builds)
Manual Cross-Compilation
For building a single architecture manually:Binary Archive Format
The final multi-architecture executable uses a custom FatELF-style format:- Self-contained - Single file contains all target binaries
- Decentralized - No binary distribution server needed
- Compressed - zlib compression reduces total size
- Recombination - Extracts and recombines for different targets
Binary Recombination
When Proone infects a target with a different architecture:- Parses its own executable to locate DVault and Binary Archive
- Decompresses the binary archive stream
- Extracts the ELF for the target architecture from the index
- Appends the DVault to the target ELF
- Recompresses the binary archive with the host ELF replacing target ELF
- Uploads the recombined executable to the target
Targeting Considerations
Wide Device Range
Proone targets legacy devices running old Linux kernels:- POSIX Standard:
_POSIX_C_SOURCE=200112L(POSIX.1-2001) - Kernel Versions: Tested on Linux 2.6.x and later
- Architecture: Big-endian and little-endian variants
- Memory: Designed for < 32MB RAM with
--enable-minmem
Common Target Architectures
- ARM (armv4t, armv5te, armv7) - Routers, IoT devices, IP cameras
- MIPS/MIPSel - Home routers, set-top boxes
- PowerPC - Embedded systems, network appliances
- SH4 (SuperH) - Older consumer electronics
- x86 (i386, i686) - Legacy x86 embedded systems
- m68k (Motorola 68000) - Industrial control systems
Static Linking Requirement
Embedded devices rarely have:- Full library installations
- Compatible library versions
- Sufficient storage for dependencies
--enable-static is essential for cross-compiled releases.
Troubleshooting
xcomp Command Not Found
Cross-Compiler Not Found
Library Not Found During Cross-Compilation
Build Output Directory Issues
If build-all.sh fails with permission or directory errors:Best Practices
- Always use static linking for production cross-compilation
- Keep debug symbols in
builds/debug/for analyzing crashes - Test on real target devices before deployment
- Use —enable-minmem for very low-memory targets
- Preserve readelf outputs for reverse engineering analysis
- Version control your
build-all.conf.shconfiguration
Next Steps
- Return to Building Proone for standard build instructions
- Review Configuration Options for tuning cross-builds
