You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -52,54 +60,61 @@ Repeat the same steps above for a cxx file by invoking `${CXX}` instead of `${CC
52
60
53
61
PolyTracker has only been tested on x86\_64 Linux. (Notably, the [DataFlow Sanitizer](https://clang.llvm.org/docs/DataFlowSanitizer.html) that PolyTracker builds upon _does not_ work on macOS.)
54
62
55
-
PolyTracker depends on [gllvm](https://github.com/SRI-CSL/gllvm) to create whole program bitcode archives and to extract bitcode from targets.
63
+
PolyTracker depends on [gllvm](https://github.com/SRI-CSL/gllvm) to create whole program bitcode archives and to extract bitcode from targets.
56
64
57
-
PolyTracker depends on python3.7+
65
+
PolyTracker depends on python3.7+
58
66
59
67
The following tools and libraries are required to run PolyTracker:
68
+
60
69
* LLVM version 7 or 7.1; other later versions may work but have not been tested. The builds in the official Ubuntu Bionic repository appear to be broken; we suggest building LLVM from source or installing it from the official LLVM repositories
61
70
62
71
## Manually building the examples
63
72
64
73
Check out this Git repository. From the root, build the base PolyTracker Docker image:
74
+
65
75
```
66
76
docker build -t trailofbits/polytracker .
67
77
```
68
78
69
79
This will create a Docker container with PolyTracker built, and the `CC` environment variable set to `polybuild`. Simply add the code to be instrumented to this container, and as long as its build process honors the `CC` environment variable, the resulting binary will be instrumented.
70
80
71
81
For a demo of PolyTracker running on the [MuPDF](https://mupdf.com/) parser run this command:
`Mutool_track` will be build in `/polytracker/the_klondike/mupdf/build/debug`. Running `mutool_track` will output `polytracker.json` which contains the information provided by the taint analysis. Its reccomended to use this json with [PolyFile](https://www.github.com/trailofbits/PolyFile).
87
+
`Mutool_track` will be build in `/polytracker/the_klondike/mupdf/build/debug`. Running `mutool_track` will output `polytracker.json` which contains the information provided by the taint analysis. Its recommended to use this json with [PolyFile](https://www.github.com/trailofbits/PolyFile).
77
88
78
-
For a demo of PolyTracker running on Poppler utils version 0.84.0 run this command:
89
+
For a demo of PolyTracker running on Poppler utils version 0.84.0 run this command:
make -j10 HAVE_X11=no HAVE_GLUT=no prefix=./bin install
127
-
```
142
+
```
128
143
129
144
Or if you would like to build the debug version, as we do in our Dockerfile:
130
145
@@ -138,12 +153,11 @@ get-bc -b target
138
153
${CC}/{CXX} --instrument-bitcode target.bc -o target_track --libs <any libs go here>
139
154
```
140
155
141
-
If you aren't sure about what libraries you might need to link for a complex target, the enviornment variable `WLLVM_ARTIFACT_STORE` sets a directory that contains a mainfest that logs all build commands and artifacts used. You should be able to rebuild the target completely using information in the mantifest and the artifacts.
142
-
156
+
If you aren't sure about what libraries you might need to link for a complex target, the environment variable `WLLVM_ARTIFACT_STORE` sets a directory that contains a manifest that logs all build commands and artifacts used. You should be able to rebuild the target completely using information in the manifest and the artifacts.
143
157
144
-
## Environment Variables
158
+
## Environment Variables
145
159
146
-
PolyTracker accepts configuration paramters in the form of environment variables to avoid recompiling target programs. The current environment variables PolyTracker supports is:
160
+
PolyTracker accepts configuration parameters in the form of environment variables to avoid recompiling target programs. The current environment variables PolyTracker supports is:
147
161
148
162
```
149
163
POLYPATH: The path to the file to mark as tainted
@@ -156,12 +170,12 @@ POLYEND: End offset to track
156
170
157
171
POLYOUTPUT: Provides a path/prefix to output polytracker information too
158
172
159
-
POLYCONFIG: Provides a path to a JSON file specifying setings
173
+
POLYCONFIG: Provides a path to a JSON file specifying settings
160
174
161
-
WLLVM_ARTIFACT_STORE: Provides a path to an exisiting directory to store artifact/manifest for all build targets
175
+
WLLVM_ARTIFACT_STORE: Provides a path to an existing directory to store artifact/manifest for all build targets
162
176
```
163
177
164
-
## Configuration Files
178
+
## Configuration Files
165
179
166
180
Rather than setting environment variables on every run, you can make a configuration file.
167
181
@@ -172,9 +186,9 @@ Example:
172
186
"POLYEND": 3,
173
187
"POLYTTL": 16
174
188
}
175
-
```
189
+
```
176
190
177
-
Polytracker will search for config files in the following way:
191
+
Polytracker will search for config files in the following way:
178
192
1. If POLYCONFIG is specified, it will grab it from there
179
193
2. Checks current directory there is a polytracker_config.json
180
194
3. Checks the .config directory under the users home ("~/.config/polytracker/polytracker_config.json")
@@ -187,7 +201,7 @@ be thrown.
187
201
188
202
The PolyTracker instrumentation looks for the `POLYPATH` environment variable to specify which input file's bytes are meant to be tracked. (Note: PolyTracker can in fact track multiple input files—and really any file-like stream such as network sockets—however, we have thus far only exposed the capability to specify a single file. This will be improved in a future release.)
189
203
190
-
The instrumented software will write its output to `polytracker_process_sets.json` and
204
+
The instrumented software will write its output to `polytracker_process_sets.json` and
191
205
`polytracker_forest.bin` in the current directory.
192
206
193
207
For example, with our instrumented version of MuPDF, run
@@ -198,36 +212,36 @@ On program exit, those artifacts will be created in the current directory.
198
212
These artifacts can be inspected and manipulated by the `polytracker` tool on the host system.
199
213
The artifacts are documented [here.](docs/ARTIFACTS.md)
200
214
201
-
The optional `POLYTRACE`enviornment variable can be set to `POLYTRACE=1` to produce a basic-block
215
+
The optional `POLYTRACE`environment variable can be set to `POLYTRACE=1` to produce a basic-block
202
216
level trace of the program. This trace data will be included in the output JSON file under the
203
217
"`trace`" key.
204
218
205
-
## Creating custom ignore lists from pre-built libraries
219
+
## Creating custom ignore lists from pre-built libraries
206
220
207
221
Attempting to build large software projects can be time consuming, especially older/unsupported ones.
208
222
It's even more time consuming to try and modify the build system such that it supports changes, like dfsan's/our instrumentation.
209
223
210
224
There is a script located in `polytracker/scripts` that you can run on any ELF library and it will output a list of functions to ignore.
211
-
We use this when we do not want to track information going through a specific library like libpng, or other sub components of a program. The `Dockerfile-listgen.demo` exists to build common open source libraries so we can create these lists.
212
-
213
-
This script is a slightly tweaked version of what DataFlowSanitizer has, which focuses on ignoring system libraries. The original script can be found in `dfsan_rt`.
225
+
We use this when we do not want to track information going through a specific library like libpng, or other sub components of a program. The `Dockerfile-listgen.demo` exists to build common open source libraries so we can create these lists.
226
+
227
+
This script is a slightly tweaked version of what DataFlowSanitizer has, which focuses on ignoring system libraries. The original script can be found in `dfsan_rt`.
214
228
215
229
## Current Status and Known Issues
216
230
217
231
Taints will not propagate through dynamically loaded libraries unless
218
232
those libraries were compiled from source using PolyTracker, _or_
219
233
there is specific support for the library calls implemented in
220
234
PolyTracker. There _is_ currently support for propagating taint
221
-
throught the majority of uninstrumented C standard library calls.
235
+
through the majority of uninstrumented C standard library calls.
222
236
To be clear, programs that use uninstrumented functions will still run normally,
223
237
however, operations performed by unsupported library calls will not
224
238
propagate taint. We are currently working on adding robust support for
225
239
C++ programs, but currently the best results will be from C programs.
226
240
227
-
Snapshotting is currently deprecated and not supported in the latest version.
241
+
Snapshotting is currently deprecated and not supported in the latest version.
228
242
229
-
If there are issues with Docker please do a system prune and build with --no-cache for both PolyTracker
230
-
and whatever demo you are trying to run.
243
+
If there are issues with Docker please do a system prune and build with --no-cache for both PolyTracker
244
+
and whatever demo you are trying to run.
231
245
232
246
The worst case performance of PolyTracker is exercised when a single
233
247
byte in memory is simultaneously tainted by a large number of input
@@ -242,7 +256,7 @@ This research was developed by [Trail of
242
256
Bits](https://www.trailofbits.com/) with funding from the Defense
243
257
Advanced Research Projects Agency (DARPA) under the SafeDocs program
244
258
as a subcontractor to [Galois](https://galois.com). It is licensed
0 commit comments