The ELF Virus Writing HOWTO

sparc-sunos5.7

Alexander Bartolich

alexander.bartolich@gmx.at

Revision History
Revision Quick!! Act as if nothing has happened!2003-01-08

This is a platform specific volume of TEVWH. See the global part for introduction, copyright, licensing and other legal issues. This part was built on an installation of "SunOS 5.7" [1] running on sparc. This is not free software. Though the operating system itself is quite affordable for private use, Sun's development suite is not. I used the free GNU tools instead. [2]

GNUgcc-2.8.1SMCbash-2.05
SMCbinut-2.11.2SMCgdb-4.18
SMCperl-5.8.0SUNWbtool-11.7.0,REV=1998.09.01.04.16
SUNWcsu-11.7.0,REV=1998.10.06.00.59SUNWdoc-11.7.0,REV=1998.09.01.04.16
SUNWesu-11.7.0,REV=1998.09.01.04.16SUNWhea-11.7.0,REV=1998.09.01.04.16
SUNWtoo-11.7.0,REV=1998.09.01.04.16SUNWxcu4-11.7.0,REV=1998.09.01.04.16
SUNWxcu4t-5.6,REV=98.05.08 


Table of Contents
1. Variables & packages
1.1. Variables prefixed with TEVWH_
1.2. Variables prefixed with TEVWH_PATH_
1.3. The name of the X
1.4. The owner of files
1.5. The source of man-pages
1.6. Verifying installed packages
2. The magic of the Elf
2.1. How it works
2.2. Strings and dumps
2.3. The address of main
2.4. Other roads to ELF
3. Magic revealed
3.1. GDB to the rescue
3.2. In doubt use force
3.3. Write your name
4. The language of evil
4.1. Offset of e_entry
4.2. Extracting e_entry
4.3. Devil in disguise
4.4. Infection #1
5. Segments
5.1. objdump -fp
5.2. readelf -l
5.3. elfdump
5.4. Observations
5.5. Segments of /bin/sh
5.6. Self modifying code
6. Sections
6.1. objdump -h
6.2. readelf
6.3. elfdump
6.4. Observations
6.5. Sections of /bin/sh
7. Scanners
7.1. Finding executables
7.2. Scan entry point
7.3. Scan segments
7.4. A shell for segment padding
7.5. Scan file size
8. Segment padding infection
8.1. Off we go
8.2. Magnifying glass
8.3. First scan
8.4. Second scan
9. The entry point

Notes

[1]

http://wwws.sun.com/software/solaris/binaries/index.html

[2]

http://gd.tuwien.ac.at/platform/sun/packages/solaris/freeware/sparc