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
Copy file name to clipboardExpand all lines: infra/experimental/agent-skills/fuzzing-memory-unsafe-expert/SKILL.md
+17-1Lines changed: 17 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,4 +39,20 @@ The below are characteristics commonly found in good fuzzing harnesses, which co
39
39
10. **Follows the code structure**: The harness should be designed to follow the structure of the codebase, making it easier to identify and target specific areas of interest.
40
40
11. **Follows code conventions**: The harness should follow the coding conventions of the project, making it easier for maintainers to understand and integrate the harness into the codebase.
41
41
12. **Does not get stuck**: The harness should be designed to avoid getting stuck on certain inputs or code paths, allowing the fuzzer to continue exploring other areas of the codebase.
42
-
13. **Includes dictionary**: The harness should include a dictionary of known inputs or patterns that are relevant to the project, helping the fuzzer to generate more effective test cases.
42
+
13. **Includes dictionary**: The harness should include a dictionary of known inputs or patterns that are relevant to the project, helping the fuzzer to generate more effective test cases.
43
+
44
+
### Operational guidelines
45
+
46
+
- Always build and run fuzzing harnesses to validate they work. This can for example be done in a oss-fuzz environment:
- If a fuzzer runs into a crash instantly, it's very likely wrong.
55
+
- Always document the rationale for design decisions in the fuzzing harness, and the rationale for why the harness is expected to find bugs. This can be done in a markdown file in the same directory as the fuzzing harness, or in comments in the code of the fuzzing harness itself.
56
+
- Look for function entrypoints that are exposed to untrusted input, and try to design fuzzing harnesses that target these entrypoints. This is often the most effective way to find security bugs.
57
+
- When extending existing fuzzing harnesses, always validate that the existing code coverage does not digress. You should empirically evaluate this and give a justification that no digression has happened, or if it has happened then you should give a justification for why the digression is acceptable in light of the achieved extension.
58
+
- When extending fuzzing harnesses you should give justification for the impact of bugs that they will find.
Copy file name to clipboardExpand all lines: infra/experimental/agent-skills/oss-fuzz-engineer/SKILL.md
+36-1Lines changed: 36 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,6 +8,8 @@ description:
8
8
9
9
This skill guides the agent how to use the OSS-Fuzz infrastructure to find and report bugs in open source software. The agent can use this skill to integrate new projects, extend and improve the fuzzing posture of projects, run fuzzing campaigns, and fix broken existing OSS-Fuzz projects.
10
10
11
+
When working on OSS-Fuzz tasks then you should also use any fuzzing related skills you have, such as code analysis and fuzzing harness writing skills, to achieve the best results.
12
+
11
13
## Workflows
12
14
13
15
There are multiple common workflows that an OSS-Fuzz engineer might follow and we describe some imporant ones here.
@@ -36,7 +38,17 @@ The agent can also be used to extend and improve the fuzzing posture of existing
36
38
37
39
A useful approach for extending a project is to study the latest code coverage report for the project, which is publicly available, to identify areas of the code that are not well covered by existing fuzz targets. The agent can then write new fuzz targets to cover those areas, and test them locally before concluding on the work for the security engineer to review.
38
40
39
-
Use the local code coverage feature of the `python3 infra/helper.py` tool to generate code coverage reports for fuzz targets locally, for example to validate the code coverage achieved by a new fuzz target. This can be done by running `python3 infra/helper.py introspector --coverage-only PROJECT_NAME` and then studying the generated report in e.g. build/out/PROJECT_NAME/report.
41
+
Use the local code coverage feature of the `python3 infra/helper.py` tool to generate code coverage reports for fuzz targets locally, for example to validate the code coverage achieved by a new fuzz target. This can be done by running `python3 infra/helper.py introspector --coverage-only PROJECT_NAME` and then studying the generated report in e.g. build/out/PROJECT_NAME/report. Some examples of this include:
42
+
43
+
```
44
+
# Generate a coverage report for htslib OSS-Fuzz project from running each
45
+
# fuzzer for 30 seconds, and store coverage directory in `htslib-cov-1`.
The user may provide directions on how to extend the fuzzing, and it's crucial to follow instructions on this matter. For example, the user may ask to focus on a specific area of the code, or to target specific types of vulnerabilities. The agent should always provide a clear explanation of the rationale for each extension or improvement made to the fuzzing posture of the project.
42
54
@@ -46,6 +58,9 @@ The agent should always provide clear technical justification for each extension
46
58
47
59
When doing this type of work it's crucial the agent uses any skills it has related to code analysis and fuzzing harness writing. It's important each extension is done through a personal assessment of the current fuzzing posture of the project, and a clear explanation of the rationale for each extension or improvement. The agent should never make any commits or push anything to GitHub, but should conclude on the work for the security engineer to review. The agent should never submit any changes to OSS-Fuzz's Github.
48
60
61
+
It is crucial when extending existing OSS-Fuzz project you must validate the existing code coverage does not digress. You should empirically evaluate this and give a justification that no digression has happened, or if it has happened then you should give a justification for why the digression is acceptable in light of the achieved extension.
62
+
63
+
Unless otherwise specified, the agent should focus on improving a single fuzzing harness for the target project, and not focus on making broad changes that will take a long time to review. Simple changes are often more effective than broad large changes.
The above two commands must succeed without error, and when integrating a new project these commands must be run before concluding on the work for the security engineer to review.
88
103
104
+
In addition to the above, there are some constraints on Chronos worth mentioning:
105
+
- If the tests fail when `run_tests.sh` is run, then `check-tests`*must* fail as well. This is a crucial invariant that is used to validate if wrong patches lead to wrong outcomes, and we must be able to check wrong patches that break tests.
106
+
- The `run_tests.sh` script should leave a given repository in the state it was before the script was run. For example, `git diff` should be the same before and after `run_tests.sh` is run inside the target repository.
107
+
-`run_tests.sh` has no network connection, so if any tests requires network connection then these tests should be skipped in `run_tests.sh` and this should be clearly documented in the script.
108
+
89
109
90
110
# Guidelines for working locally on OSS-Fuzz projects
91
111
92
112
1. Always work from the base folder of the current OSS-Fuzz project unless otherwise specified.
93
113
2. Make a local checkout of the target source code to make working with the target project easy. This involves e.g. studying the `Dockerfile` of the target project, finding the e.g. `git clone` of the target project, and then cloning this repository locally and using e.g. `COPY` instead of `RUN git clone` in the Dockerfile to get the source code into the container.
94
114
3. Use the `python3 infra/helper.py` tool to build and test fuzz targets locally.
95
115
4. Analyse if build scripts can be optimized to improve local building efficiency.
116
+
117
+
118
+
# Public data available for OSS-Fuzz projects
119
+
120
+
The OSS-Fuzz infrastructure provides a lot of public data that can be used to guide the work of an OSS-Fuzz engineer. This includes:
121
+
122
+
- Current build status of all OSS-Fuzz projects:
123
+
- html page: https://oss-fuzz-build-logs.storage.googleapis.com/index.html
- use this reference to identify latest build status of a given project, and to identify if there are any build issues that need to be fixed.
126
+
- If you are tasked with fixing the build of a project, then use this data to identify the latest build error.
127
+
- If you are tasked with fixing the build of a project, then use this data to identify the conditions of the latest build error, e.g. which architecture, fuzzing engine and sanitizer is failing.
128
+
- Some build errors are due to the harnesses running into an issue immediately, meaning they build but `check_build` fails. These are bugs that likely indicate the fuzzing harnesses have a deficiency.
129
+
- in the references section guidance is provided on code coverage reports, helper script used for interacting with OSS-Fuzz projects and documentation on the structure of OSS-Fuzz projects.
130
+
-https://introspector.oss-fuzz.com : details insights on macro and micro level stats on OSS-Fuzz.
0 commit comments