blob: 15fc57e551193358fcaf155f128624914f1f28c2 [file] [log] [blame] [view]
Liza Burakovaf3d929b62023-05-01 16:31:121# Security Shepherd ClusterFuzz instructions
Adrian Taylord8d168a2020-04-30 00:46:152
3[TOC]
4
Liza Burakovaf3d929b62023-05-01 16:31:125This page has instructions for [Security Shepherds](shepherd.md) in how best to use
Adrian Taylord8d168a2020-04-30 00:46:156[ClusterFuzz](https://clusterfuzz.com) to reproduce and label bugs.
7
8## Basics
9
10[https://clusterfuzz.com/upload-testcase](https://clusterfuzz.com/upload-testcase)
11allows you to upload files to reproduce crashes on various platforms and will
12identify revision ranges when the regression was introduced. If a test case
13requires multiple files, they can be uploaded together in a zip or tar
Hubert Chaobaffb602022-09-29 19:48:5514archive: the main file needs to contain the words `run`, `fuzz-` `index.` or
15`crash.`.
Adrian Taylord8d168a2020-04-30 00:46:1516
17Please *do* specify the crbug number when uploading the test case. This will allow
18ClusterFuzz to keep the crbug updated with progress.
19
Adrian Taylorce1cad62022-03-31 03:14:4420Please *don't* upload test cases unless they're obviously harmless. Currently
21ClusterFuzz does not support untrusted workloads.
22
Adrian Taylord8d168a2020-04-30 00:46:1523## Useful jobs
24
25You should chose the right job type depending on the format of file you want to
26test:
27
28* repro.html [linux_asan_chrome_mp](https://clusterfuzz.com/upload-testcase?upload=true&job=linux_asan_chrome_mp)
29 or [windows_asan_chrome](https://clusterfuzz.com/upload-testcase?upload=true&job=windows_asan_chrome)
30* repro.js [linux_asan_d8](https://clusterfuzz.com/upload-testcase?upload=true&job=linux_asan_d8)
31* repro.pdf [libfuzzer_pdfium_asan / pdfium_fuzzer](https://clusterfuzz.com/upload-testcase?upload=true&job=libfuzzer_pdfium_asan&target=pdfium_fuzzer)
32 or [libfuzzer_pdfium_asan / pdfium_xfa_fuzzer](https://clusterfuzz.com/upload-testcase?upload=true&job=libfuzzer_pdfium_asan&target=pdfium_xfa_fuzzer)
33
34## MojoJS
35
36[MojoJS](../../mojo/public/js/README.md) is a means for a renderer process to use
37Mojo IPCs directly from JavaScript. Although it's not enabled in normal production
38Chrome builds, it's a great way to simulate how a compromised renderer can attack
39other processes over IPC.
40
41Because Mojo IPCs change with each version of Chrome, the test case needs to
42use exactly the right MojoJS bindings. MojoJS bugs typically specify to use
43`python ./copy_mojo_bindings.py` to put such bindings in place, but that does not
44work for ClusterFuzz where it will need to bisect across many versions of Chrome
45with many versions of Mojo.
46
47Therefore, do this instead:
48
49* In the PoC, replace all paths where it's loading MojoJS scripts to be prefixed
50 with `file:///gen` instead. For example:
Adrian Tayloradd4d332023-06-16 15:47:1451```
Adrian Taylord8d168a2020-04-30 00:46:1552 <script src="file:///gen/mojo/public/js/mojo_bindings_lite.js">
Adrian Tayloradd4d332023-06-16 15:47:1453```
Adrian Taylord8d168a2020-04-30 00:46:1554 This works because most of the ClusterFuzz Chrome binaries are [now built with](https://chromium-review.googlesource.com/c/chromium/src/+/1119727) `enable_ipc_fuzzer=true`.
Adrian Tayloradd4d332023-06-16 15:47:1455
Adrian Taylord8d168a2020-04-30 00:46:1556* If you believe the bug will reproduce on Linux, use the [linux_asan_chrome_mojo](https://clusterfuzz.com/upload-testcase?upload=true&job=linux_asan_chrome_mojo) job type.
57* If you believe the bug will only reproduce on Android, [ClusterFuzz can't help right now](https://crbug.com/1067103).
58* Otherwise, use any job type but specify extra command-line flags `--enable-blink-features=MojoJS`. In this case, ClusterFuzz might declare that a browser process crash is Critical severity, whereas because of the precondition of a compromised renderer [you may wish to adjust it down to High](severity-guidelines.md).
59
60[Example bug where these instructions have worked](https://crbug.com/1072983).
Adrian Tayloradd4d332023-06-16 15:47:1461
62## Gestures
63
64Some testcases require UI gestures to reproduce them. ClusterFuzz has a
65"gestures" field where you _may_ be able to specify such UI interactions. The
66language is platform-specific. On Linux, it's commands for
67[xdotool](https://manpages.ubuntu.com/manpages/trusty/man1/xdotool.1.html) in a
68Python-like list. For instance,
69```
70[ "type,'qx1sqOqB0ZbEFYn'","key,F3","key,F12" ]
71```
72As mouse coordinates are subject to change, it probably only makes sense to try
73gestures if the UI actions can be achieved purely using keystrokes. The relevant
74ClusterFuzz [code is in
75gesture_handler.py](https://github.com/google/clusterfuzz/blob/master/src/clusterfuzz/_internal/fuzzing/gesture_handler.py#L22)
76to figure out the languages for other platforms.
Adrian Taylor799dd542023-11-14 17:53:2977
78## HTTP(S) headers
79
80If you need to reproduce a test case that involves specific HTTP headers, do this:
81
821. Make a copy of [page_load_in_process_fuzzer_seed_corpus/network.textproto](https://source.chromium.org/chromium/chromium/src/+/main:chrome/test/fuzzing/page_load_in_process_fuzzer_seed_corpus/network.textproto)
832. Edit as necessary to give the headers you need
Adrian Taylor9eaf9e6552023-11-15 10:55:50843. Go to the ClusterFuzz [upload page](https://clusterfuzz.com/upload-testcase)
Adrian Taylor799dd542023-11-14 17:53:29854. Select `libfuzzer_chrome_asan` for the job
865. Select `page_load_in_process_fuzzer` for the fuzzer
Adrian Taylor9eaf9e6552023-11-15 10:55:50876. Upload `network.textproto` as the test case.