Skip to content

Commit 5dd3d1f

Browse files
authored
Update README.md
1 parent 7f23431 commit 5dd3d1f

1 file changed

Lines changed: 16 additions & 3 deletions

File tree

tools/shiva-ld/README.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,15 @@ part of the prelinking process.
5252
#### Custom Dynamic tags for the Shiva interpreter
5353

5454
```
55-
#define SHIVA_DT_NEEDED (DT_LOOS + 10)
56-
#define SHIVA_DT_SEARCH (DT_LOOS + 11)
55+
#define SHIVA_DT_NEEDED (DT_LOOS + 10) // Patch basename (i.e. "patch.o")
56+
#define SHIVA_DT_SEARCH (DT_LOOS + 11) // Search path (i.e. "/opt/shiva/modules")
57+
#define SHIVA_DT_ORIG_INTERP (DT_LOOS + 12) // Original interpreter path (i.e. "/lib/ld-linux.so")
5758
```
5859

5960
#### Using shiva-ld command line tool
6061

61-
$ shiva-ld -e ./vuln_program -p patch_fix.o -i /lib/shiva -s /opt/shiva/modules -o ./vuln_program.patched
62+
The Shiva prelinker is called "/usr/bin/shiva-ld" and has the following command line
63+
usage:
6264

6365
```
6466
Usage: shiva-ld -e test_bin -p patch1.o -i /lib/shiva-s /opt/shiva/modules/ -o test_bin_final
@@ -68,3 +70,14 @@ Usage: shiva-ld -e test_bin -p patch1.o -i /lib/shiva-s /opt/shiva/modules/ -o t
6870
[-s] --search_path Module search path (For patch object)
6971
[-o] --output_exec Output executable
7072
```
73+
74+
Prelink the executable "vuln_program". Don't forget to copy patch.o into the search
75+
path specified to shiva-ld; in our case "/opt/shiva/modules". This is akin to how
76+
shared libraries are typically stored in /lib/x86-64-linux.gnu/
77+
78+
```
79+
$ shiva-ld -e ./vuln_program -p patch.o -i /lib/shiva -s /opt/shiva/modules -o ./vuln_program
80+
$ sudo cp patch.o /opt/shiva/modules
81+
```
82+
83+
elfmaster@arcana-research.io

0 commit comments

Comments
 (0)