Add files using upload-large-folder tool
Browse files- local-test-tika-delta-04/fuzz-tooling/CITATION.cff +46 -0
- local-test-tika-delta-04/fuzz-tooling/LICENSE +201 -0
- local-test-tika-full-01-vuln_7/fuzz-tooling/infra/base-images/base-builder/sanitizers/pysecsan/tests/README.md +1 -0
- local-test-tika-full-01-vuln_7/fuzz-tooling/infra/base-images/base-builder/sanitizers/pysecsan/tests/poe/libvcs-cve-2022-21187/build.sh +21 -0
- local-test-tika-full-01-vuln_7/fuzz-tooling/infra/base-images/base-builder/sanitizers/pysecsan/tests/poe/libvcs-cve-2022-21187/fuzz_libvcs.py +45 -0
- local-test-tika-full-01-vuln_7/fuzz-tooling/infra/base-images/base-runner/gocoverage/convertcorpus/main.go +54 -0
- local-test-tika-full-01-vuln_7/fuzz-tooling/infra/base-images/base-runner/gocoverage/go.sum +30 -0
- local-test-tika-full-01-vuln_7/fuzz-tooling/infra/base-images/base-runner/gocoverage/gocovmerge/gocovmerge.go +111 -0
- local-test-tika-full-01-vuln_7/fuzz-tooling/infra/experimental/SystemSan/Makefile +41 -0
- local-test-tika-full-01-vuln_7/fuzz-tooling/infra/experimental/SystemSan/PoEs/node-shell-quote-v1.7.3/target.js +35 -0
- local-test-tika-full-01-vuln_7/fuzz-tooling/infra/experimental/SystemSan/PoEs/pytorch-lightning-1.5.10/build.sh +25 -0
- local-test-tika-full-01-vuln_7/fuzz-tooling/infra/experimental/SystemSan/PoEs/pytorch-lightning-1.5.10/fuzz_pytorch_lightning.py +65 -0
- local-test-tika-full-01-vuln_7/fuzz-tooling/infra/experimental/SystemSan/SystemSan.cpp +493 -0
- local-test-tika-full-01-vuln_7/fuzz-tooling/infra/experimental/chronos/build_all.sh +33 -0
- local-test-tika-full-01-vuln_7/fuzz-tooling/infra/experimental/chronos/build_cache_local.sh +163 -0
- local-test-tika-full-01-vuln_7/fuzz-tooling/infra/experimental/chronos/build_on_cloudbuild.sh +26 -0
- local-test-tika-full-01-vuln_7/fuzz-tooling/infra/experimental/chronos/chronos.sh +81 -0
- local-test-tika-full-01-vuln_7/fuzz-tooling/infra/experimental/chronos/cloudbuild_all.yaml +34 -0
- local-test-tika-full-01-vuln_7/fuzz-tooling/infra/experimental/chronos/e2e-replay-build.sh +63 -0
- local-test-tika-full-01-vuln_7/fuzz-tooling/infra/experimental/sanitizers/ExecSan/README.md +3 -0
local-test-tika-delta-04/fuzz-tooling/CITATION.cff
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
cff-version: 1.2.0
|
| 2 |
+
title: OSS-Fuzz
|
| 3 |
+
message: >-
|
| 4 |
+
If you use this software, please cite it using the
|
| 5 |
+
metadata from this file.
|
| 6 |
+
type: software
|
| 7 |
+
authors:
|
| 8 |
+
- given-names: Abhishek
|
| 9 |
+
family-names: Arya
|
| 10 |
+
affiliation: Google LLC
|
| 11 |
+
email: aarya@google.com
|
| 12 |
+
orcid: 'https://orcid.org/0009-0009-4558-4314'
|
| 13 |
+
- given-names: Oliver
|
| 14 |
+
family-names: Chang
|
| 15 |
+
email: ochang@google.com
|
| 16 |
+
affiliation: Google LLC
|
| 17 |
+
orcid: 'https://orcid.org/0009-0006-3181-4551'
|
| 18 |
+
- given-names: Jonathan
|
| 19 |
+
family-names: Metzman
|
| 20 |
+
email: metzman@google.com
|
| 21 |
+
affiliation: Google LLC
|
| 22 |
+
orcid: 'https://orcid.org/0000-0002-7042-0444'
|
| 23 |
+
- given-names: Kostya
|
| 24 |
+
family-names: Serebryany
|
| 25 |
+
email: kcc@google.com
|
| 26 |
+
affiliation: Google LLC
|
| 27 |
+
orcid: 'https://orcid.org/0009-0009-2379-3641'
|
| 28 |
+
- given-names: Dongge
|
| 29 |
+
family-names: Liu
|
| 30 |
+
email: donggeliu@google.com
|
| 31 |
+
affiliation: Google LLC
|
| 32 |
+
orcid: 'https://orcid.org/0000-0003-4821-7033'
|
| 33 |
+
repository-code: 'https://github.com/google/oss-fuzz'
|
| 34 |
+
abstract: >-
|
| 35 |
+
OSS-Fuzz is an open-source project by Google that provides
|
| 36 |
+
continuous fuzzing for open-source software. It aims to
|
| 37 |
+
make common open-source software more secure and stable by
|
| 38 |
+
combining modern fuzzing techniques with scalable,
|
| 39 |
+
distributed execution. As of August 2023, OSS-Fuzz has
|
| 40 |
+
helped identify and fix over 10,000 vulnerabilities and
|
| 41 |
+
36,000 bugs across 1,000 projects.
|
| 42 |
+
keywords:
|
| 43 |
+
- open-source
|
| 44 |
+
- fuzzing
|
| 45 |
+
license: Apache-2.0
|
| 46 |
+
|
local-test-tika-delta-04/fuzz-tooling/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Apache License
|
| 2 |
+
Version 2.0, January 2004
|
| 3 |
+
http://www.apache.org/licenses/
|
| 4 |
+
|
| 5 |
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
| 6 |
+
|
| 7 |
+
1. Definitions.
|
| 8 |
+
|
| 9 |
+
"License" shall mean the terms and conditions for use, reproduction,
|
| 10 |
+
and distribution as defined by Sections 1 through 9 of this document.
|
| 11 |
+
|
| 12 |
+
"Licensor" shall mean the copyright owner or entity authorized by
|
| 13 |
+
the copyright owner that is granting the License.
|
| 14 |
+
|
| 15 |
+
"Legal Entity" shall mean the union of the acting entity and all
|
| 16 |
+
other entities that control, are controlled by, or are under common
|
| 17 |
+
control with that entity. For the purposes of this definition,
|
| 18 |
+
"control" means (i) the power, direct or indirect, to cause the
|
| 19 |
+
direction or management of such entity, whether by contract or
|
| 20 |
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
| 21 |
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
| 22 |
+
|
| 23 |
+
"You" (or "Your") shall mean an individual or Legal Entity
|
| 24 |
+
exercising permissions granted by this License.
|
| 25 |
+
|
| 26 |
+
"Source" form shall mean the preferred form for making modifications,
|
| 27 |
+
including but not limited to software source code, documentation
|
| 28 |
+
source, and configuration files.
|
| 29 |
+
|
| 30 |
+
"Object" form shall mean any form resulting from mechanical
|
| 31 |
+
transformation or translation of a Source form, including but
|
| 32 |
+
not limited to compiled object code, generated documentation,
|
| 33 |
+
and conversions to other media types.
|
| 34 |
+
|
| 35 |
+
"Work" shall mean the work of authorship, whether in Source or
|
| 36 |
+
Object form, made available under the License, as indicated by a
|
| 37 |
+
copyright notice that is included in or attached to the work
|
| 38 |
+
(an example is provided in the Appendix below).
|
| 39 |
+
|
| 40 |
+
"Derivative Works" shall mean any work, whether in Source or Object
|
| 41 |
+
form, that is based on (or derived from) the Work and for which the
|
| 42 |
+
editorial revisions, annotations, elaborations, or other modifications
|
| 43 |
+
represent, as a whole, an original work of authorship. For the purposes
|
| 44 |
+
of this License, Derivative Works shall not include works that remain
|
| 45 |
+
separable from, or merely link (or bind by name) to the interfaces of,
|
| 46 |
+
the Work and Derivative Works thereof.
|
| 47 |
+
|
| 48 |
+
"Contribution" shall mean any work of authorship, including
|
| 49 |
+
the original version of the Work and any modifications or additions
|
| 50 |
+
to that Work or Derivative Works thereof, that is intentionally
|
| 51 |
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
| 52 |
+
or by an individual or Legal Entity authorized to submit on behalf of
|
| 53 |
+
the copyright owner. For the purposes of this definition, "submitted"
|
| 54 |
+
means any form of electronic, verbal, or written communication sent
|
| 55 |
+
to the Licensor or its representatives, including but not limited to
|
| 56 |
+
communication on electronic mailing lists, source code control systems,
|
| 57 |
+
and issue tracking systems that are managed by, or on behalf of, the
|
| 58 |
+
Licensor for the purpose of discussing and improving the Work, but
|
| 59 |
+
excluding communication that is conspicuously marked or otherwise
|
| 60 |
+
designated in writing by the copyright owner as "Not a Contribution."
|
| 61 |
+
|
| 62 |
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
| 63 |
+
on behalf of whom a Contribution has been received by Licensor and
|
| 64 |
+
subsequently incorporated within the Work.
|
| 65 |
+
|
| 66 |
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
| 67 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 68 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 69 |
+
copyright license to reproduce, prepare Derivative Works of,
|
| 70 |
+
publicly display, publicly perform, sublicense, and distribute the
|
| 71 |
+
Work and such Derivative Works in Source or Object form.
|
| 72 |
+
|
| 73 |
+
3. Grant of Patent License. Subject to the terms and conditions of
|
| 74 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 75 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 76 |
+
(except as stated in this section) patent license to make, have made,
|
| 77 |
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
| 78 |
+
where such license applies only to those patent claims licensable
|
| 79 |
+
by such Contributor that are necessarily infringed by their
|
| 80 |
+
Contribution(s) alone or by combination of their Contribution(s)
|
| 81 |
+
with the Work to which such Contribution(s) was submitted. If You
|
| 82 |
+
institute patent litigation against any entity (including a
|
| 83 |
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
| 84 |
+
or a Contribution incorporated within the Work constitutes direct
|
| 85 |
+
or contributory patent infringement, then any patent licenses
|
| 86 |
+
granted to You under this License for that Work shall terminate
|
| 87 |
+
as of the date such litigation is filed.
|
| 88 |
+
|
| 89 |
+
4. Redistribution. You may reproduce and distribute copies of the
|
| 90 |
+
Work or Derivative Works thereof in any medium, with or without
|
| 91 |
+
modifications, and in Source or Object form, provided that You
|
| 92 |
+
meet the following conditions:
|
| 93 |
+
|
| 94 |
+
(a) You must give any other recipients of the Work or
|
| 95 |
+
Derivative Works a copy of this License; and
|
| 96 |
+
|
| 97 |
+
(b) You must cause any modified files to carry prominent notices
|
| 98 |
+
stating that You changed the files; and
|
| 99 |
+
|
| 100 |
+
(c) You must retain, in the Source form of any Derivative Works
|
| 101 |
+
that You distribute, all copyright, patent, trademark, and
|
| 102 |
+
attribution notices from the Source form of the Work,
|
| 103 |
+
excluding those notices that do not pertain to any part of
|
| 104 |
+
the Derivative Works; and
|
| 105 |
+
|
| 106 |
+
(d) If the Work includes a "NOTICE" text file as part of its
|
| 107 |
+
distribution, then any Derivative Works that You distribute must
|
| 108 |
+
include a readable copy of the attribution notices contained
|
| 109 |
+
within such NOTICE file, excluding those notices that do not
|
| 110 |
+
pertain to any part of the Derivative Works, in at least one
|
| 111 |
+
of the following places: within a NOTICE text file distributed
|
| 112 |
+
as part of the Derivative Works; within the Source form or
|
| 113 |
+
documentation, if provided along with the Derivative Works; or,
|
| 114 |
+
within a display generated by the Derivative Works, if and
|
| 115 |
+
wherever such third-party notices normally appear. The contents
|
| 116 |
+
of the NOTICE file are for informational purposes only and
|
| 117 |
+
do not modify the License. You may add Your own attribution
|
| 118 |
+
notices within Derivative Works that You distribute, alongside
|
| 119 |
+
or as an addendum to the NOTICE text from the Work, provided
|
| 120 |
+
that such additional attribution notices cannot be construed
|
| 121 |
+
as modifying the License.
|
| 122 |
+
|
| 123 |
+
You may add Your own copyright statement to Your modifications and
|
| 124 |
+
may provide additional or different license terms and conditions
|
| 125 |
+
for use, reproduction, or distribution of Your modifications, or
|
| 126 |
+
for any such Derivative Works as a whole, provided Your use,
|
| 127 |
+
reproduction, and distribution of the Work otherwise complies with
|
| 128 |
+
the conditions stated in this License.
|
| 129 |
+
|
| 130 |
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
| 131 |
+
any Contribution intentionally submitted for inclusion in the Work
|
| 132 |
+
by You to the Licensor shall be under the terms and conditions of
|
| 133 |
+
this License, without any additional terms or conditions.
|
| 134 |
+
Notwithstanding the above, nothing herein shall supersede or modify
|
| 135 |
+
the terms of any separate license agreement you may have executed
|
| 136 |
+
with Licensor regarding such Contributions.
|
| 137 |
+
|
| 138 |
+
6. Trademarks. This License does not grant permission to use the trade
|
| 139 |
+
names, trademarks, service marks, or product names of the Licensor,
|
| 140 |
+
except as required for reasonable and customary use in describing the
|
| 141 |
+
origin of the Work and reproducing the content of the NOTICE file.
|
| 142 |
+
|
| 143 |
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
| 144 |
+
agreed to in writing, Licensor provides the Work (and each
|
| 145 |
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
| 146 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
| 147 |
+
implied, including, without limitation, any warranties or conditions
|
| 148 |
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
| 149 |
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
| 150 |
+
appropriateness of using or redistributing the Work and assume any
|
| 151 |
+
risks associated with Your exercise of permissions under this License.
|
| 152 |
+
|
| 153 |
+
8. Limitation of Liability. In no event and under no legal theory,
|
| 154 |
+
whether in tort (including negligence), contract, or otherwise,
|
| 155 |
+
unless required by applicable law (such as deliberate and grossly
|
| 156 |
+
negligent acts) or agreed to in writing, shall any Contributor be
|
| 157 |
+
liable to You for damages, including any direct, indirect, special,
|
| 158 |
+
incidental, or consequential damages of any character arising as a
|
| 159 |
+
result of this License or out of the use or inability to use the
|
| 160 |
+
Work (including but not limited to damages for loss of goodwill,
|
| 161 |
+
work stoppage, computer failure or malfunction, or any and all
|
| 162 |
+
other commercial damages or losses), even if such Contributor
|
| 163 |
+
has been advised of the possibility of such damages.
|
| 164 |
+
|
| 165 |
+
9. Accepting Warranty or Additional Liability. While redistributing
|
| 166 |
+
the Work or Derivative Works thereof, You may choose to offer,
|
| 167 |
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
| 168 |
+
or other liability obligations and/or rights consistent with this
|
| 169 |
+
License. However, in accepting such obligations, You may act only
|
| 170 |
+
on Your own behalf and on Your sole responsibility, not on behalf
|
| 171 |
+
of any other Contributor, and only if You agree to indemnify,
|
| 172 |
+
defend, and hold each Contributor harmless for any liability
|
| 173 |
+
incurred by, or claims asserted against, such Contributor by reason
|
| 174 |
+
of your accepting any such warranty or additional liability.
|
| 175 |
+
|
| 176 |
+
END OF TERMS AND CONDITIONS
|
| 177 |
+
|
| 178 |
+
APPENDIX: How to apply the Apache License to your work.
|
| 179 |
+
|
| 180 |
+
To apply the Apache License to your work, attach the following
|
| 181 |
+
boilerplate notice, with the fields enclosed by brackets "{}"
|
| 182 |
+
replaced with your own identifying information. (Don't include
|
| 183 |
+
the brackets!) The text should be enclosed in the appropriate
|
| 184 |
+
comment syntax for the file format. We also recommend that a
|
| 185 |
+
file or class name and description of purpose be included on the
|
| 186 |
+
same "printed page" as the copyright notice for easier
|
| 187 |
+
identification within third-party archives.
|
| 188 |
+
|
| 189 |
+
Copyright {yyyy} {name of copyright owner}
|
| 190 |
+
|
| 191 |
+
Licensed under the Apache License, Version 2.0 (the "License");
|
| 192 |
+
you may not use this file except in compliance with the License.
|
| 193 |
+
You may obtain a copy of the License at
|
| 194 |
+
|
| 195 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
| 196 |
+
|
| 197 |
+
Unless required by applicable law or agreed to in writing, software
|
| 198 |
+
distributed under the License is distributed on an "AS IS" BASIS,
|
| 199 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 200 |
+
See the License for the specific language governing permissions and
|
| 201 |
+
limitations under the License.
|
local-test-tika-full-01-vuln_7/fuzz-tooling/infra/base-images/base-builder/sanitizers/pysecsan/tests/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
# Tests including Proof of Exploits
|
local-test-tika-full-01-vuln_7/fuzz-tooling/infra/base-images/base-builder/sanitizers/pysecsan/tests/poe/libvcs-cve-2022-21187/build.sh
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash -eu
|
| 2 |
+
# Copyright 2022 Google LLC
|
| 3 |
+
#
|
| 4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
# you may not use this file except in compliance with the License.
|
| 6 |
+
# You may obtain a copy of the License at
|
| 7 |
+
#
|
| 8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
#
|
| 10 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
# See the License for the specific language governing permissions and
|
| 14 |
+
# limitations under the License.
|
| 15 |
+
#
|
| 16 |
+
################################################################################
|
| 17 |
+
|
| 18 |
+
python3 -m pip install pysecsan
|
| 19 |
+
|
| 20 |
+
python3 -m pip install libvcs==0.11.0
|
| 21 |
+
python3 ./fuzz_libvcs.py
|
local-test-tika-full-01-vuln_7/fuzz-tooling/infra/base-images/base-builder/sanitizers/pysecsan/tests/poe/libvcs-cve-2022-21187/fuzz_libvcs.py
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/python3
|
| 2 |
+
# Copyright 2022 Google LLC
|
| 3 |
+
#
|
| 4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
# you may not use this file except in compliance with the License.
|
| 6 |
+
# You may obtain a copy of the License at
|
| 7 |
+
#
|
| 8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
#
|
| 10 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
# See the License for the specific language governing permissions and
|
| 14 |
+
# limitations under the License.
|
| 15 |
+
"""Targets https://github.com/advisories/GHSA-mv2w-4jqc-6fg4."""
|
| 16 |
+
|
| 17 |
+
import sys
|
| 18 |
+
import atheris
|
| 19 |
+
import pysecsan
|
| 20 |
+
from libvcs.shortcuts import create_repo
|
| 21 |
+
|
| 22 |
+
pysecsan.add_hooks()
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
def test_one_input(data):
|
| 26 |
+
"""Target code injection in libvcs."""
|
| 27 |
+
fdp = atheris.FuzzedDataProvider(data)
|
| 28 |
+
mercurial_repo = create_repo(url=fdp.ConsumeUnicodeNoSurrogates(128),
|
| 29 |
+
vcs='hg',
|
| 30 |
+
repo_dir='./')
|
| 31 |
+
try:
|
| 32 |
+
mercurial_repo.update_repo()
|
| 33 |
+
except (ValueError, FileNotFoundError) as exception:
|
| 34 |
+
_ = exception # Satisfy lint
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
def main():
|
| 38 |
+
"""Set up and start fuzzing."""
|
| 39 |
+
atheris.instrument_all()
|
| 40 |
+
atheris.Setup(sys.argv, test_one_input, enable_python_coverage=True)
|
| 41 |
+
atheris.Fuzz()
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
if __name__ == '__main__':
|
| 45 |
+
main()
|
local-test-tika-full-01-vuln_7/fuzz-tooling/infra/base-images/base-runner/gocoverage/convertcorpus/main.go
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
package main
|
| 2 |
+
|
| 3 |
+
import (
|
| 4 |
+
"fmt"
|
| 5 |
+
"log"
|
| 6 |
+
"os"
|
| 7 |
+
"path/filepath"
|
| 8 |
+
|
| 9 |
+
"github.com/AdamKorcz/go-118-fuzz-build/coverage"
|
| 10 |
+
)
|
| 11 |
+
|
| 12 |
+
// reads all corpus files in a directory and converts
|
| 13 |
+
// them from libFuzzer format to native Go format.
|
| 14 |
+
func main() {
|
| 15 |
+
if len(os.Args) != 3 {
|
| 16 |
+
fmt.Println(os.Args)
|
| 17 |
+
log.Fatalf("need exactly two argument")
|
| 18 |
+
}
|
| 19 |
+
FUZZERNAME := os.Args[1]
|
| 20 |
+
CORPUS_PATH := os.Args[2]
|
| 21 |
+
|
| 22 |
+
filepath.Walk(CORPUS_PATH, func(path string, info os.FileInfo, err error) error {
|
| 23 |
+
if err != nil {
|
| 24 |
+
return nil
|
| 25 |
+
}
|
| 26 |
+
if !info.Mode().IsRegular() {
|
| 27 |
+
return nil
|
| 28 |
+
}
|
| 29 |
+
libFuzzerSeed, err := os.ReadFile(path)
|
| 30 |
+
if err != nil {
|
| 31 |
+
panic(err)
|
| 32 |
+
}
|
| 33 |
+
out := os.Getenv("OUT")
|
| 34 |
+
fuzzerContents, err := os.ReadFile(filepath.Join(out, "rawfuzzers", FUZZERNAME))
|
| 35 |
+
if err != nil {
|
| 36 |
+
panic(err)
|
| 37 |
+
}
|
| 38 |
+
goSeed := coverage.ConvertLibfuzzerSeedToGoSeed(fuzzerContents, libFuzzerSeed, FUZZERNAME)
|
| 39 |
+
err = os.Remove(path)
|
| 40 |
+
if err != nil {
|
| 41 |
+
panic(err)
|
| 42 |
+
}
|
| 43 |
+
f, err := os.Create(path)
|
| 44 |
+
if err != nil {
|
| 45 |
+
panic(err)
|
| 46 |
+
}
|
| 47 |
+
defer f.Close()
|
| 48 |
+
_, err = f.Write([]byte(goSeed))
|
| 49 |
+
if err != nil {
|
| 50 |
+
panic(err)
|
| 51 |
+
}
|
| 52 |
+
return nil
|
| 53 |
+
})
|
| 54 |
+
}
|
local-test-tika-full-01-vuln_7/fuzz-tooling/infra/base-images/base-runner/gocoverage/go.sum
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
|
| 2 |
+
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
|
| 3 |
+
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
|
| 4 |
+
github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5 h1:zIaiqGYDQwa4HVx5wGRTXbx38Pqxjemn4BP98wpzpXo=
|
| 5 |
+
github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
|
| 6 |
+
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
| 7 |
+
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
| 8 |
+
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
| 9 |
+
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
| 10 |
+
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
| 11 |
+
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
| 12 |
+
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
| 13 |
+
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
| 14 |
+
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
| 15 |
+
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
| 16 |
+
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
| 17 |
+
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
| 18 |
+
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
| 19 |
+
golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
| 20 |
+
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
| 21 |
+
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
| 22 |
+
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
| 23 |
+
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
| 24 |
+
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
| 25 |
+
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
| 26 |
+
golang.org/x/tools v0.1.0 h1:po9/4sTYwZU9lPhi1tOrb4hCv3qrhiQ77LZfGa2OjwY=
|
| 27 |
+
golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
|
| 28 |
+
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
| 29 |
+
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
| 30 |
+
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
local-test-tika-full-01-vuln_7/fuzz-tooling/infra/base-images/base-runner/gocoverage/gocovmerge/gocovmerge.go
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// gocovmerge takes the results from multiple `go test -coverprofile` runs and
|
| 2 |
+
// merges them into one profile
|
| 3 |
+
package main
|
| 4 |
+
|
| 5 |
+
import (
|
| 6 |
+
"flag"
|
| 7 |
+
"fmt"
|
| 8 |
+
"io"
|
| 9 |
+
"log"
|
| 10 |
+
"os"
|
| 11 |
+
"sort"
|
| 12 |
+
|
| 13 |
+
"golang.org/x/tools/cover"
|
| 14 |
+
)
|
| 15 |
+
|
| 16 |
+
func mergeProfiles(p *cover.Profile, merge *cover.Profile) {
|
| 17 |
+
if p.Mode != merge.Mode {
|
| 18 |
+
log.Fatalf("cannot merge profiles with different modes")
|
| 19 |
+
}
|
| 20 |
+
// Since the blocks are sorted, we can keep track of where the last block
|
| 21 |
+
// was inserted and only look at the blocks after that as targets for merge
|
| 22 |
+
startIndex := 0
|
| 23 |
+
for _, b := range merge.Blocks {
|
| 24 |
+
startIndex = mergeProfileBlock(p, b, startIndex)
|
| 25 |
+
}
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
func mergeProfileBlock(p *cover.Profile, pb cover.ProfileBlock, startIndex int) int {
|
| 29 |
+
sortFunc := func(i int) bool {
|
| 30 |
+
pi := p.Blocks[i+startIndex]
|
| 31 |
+
return pi.StartLine >= pb.StartLine && (pi.StartLine != pb.StartLine || pi.StartCol >= pb.StartCol)
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
i := 0
|
| 35 |
+
if sortFunc(i) != true {
|
| 36 |
+
i = sort.Search(len(p.Blocks)-startIndex, sortFunc)
|
| 37 |
+
}
|
| 38 |
+
i += startIndex
|
| 39 |
+
if i < len(p.Blocks) && p.Blocks[i].StartLine == pb.StartLine && p.Blocks[i].StartCol == pb.StartCol {
|
| 40 |
+
if p.Blocks[i].EndLine != pb.EndLine || p.Blocks[i].EndCol != pb.EndCol {
|
| 41 |
+
log.Fatalf("OVERLAP MERGE: %v %v %v", p.FileName, p.Blocks[i], pb)
|
| 42 |
+
}
|
| 43 |
+
switch p.Mode {
|
| 44 |
+
case "set":
|
| 45 |
+
p.Blocks[i].Count |= pb.Count
|
| 46 |
+
case "count", "atomic":
|
| 47 |
+
p.Blocks[i].Count += pb.Count
|
| 48 |
+
default:
|
| 49 |
+
log.Fatalf("unsupported covermode: '%s'", p.Mode)
|
| 50 |
+
}
|
| 51 |
+
} else {
|
| 52 |
+
if i > 0 {
|
| 53 |
+
pa := p.Blocks[i-1]
|
| 54 |
+
if pa.EndLine >= pb.EndLine && (pa.EndLine != pb.EndLine || pa.EndCol > pb.EndCol) {
|
| 55 |
+
log.Fatalf("OVERLAP BEFORE: %v %v %v", p.FileName, pa, pb)
|
| 56 |
+
}
|
| 57 |
+
}
|
| 58 |
+
if i < len(p.Blocks)-1 {
|
| 59 |
+
pa := p.Blocks[i+1]
|
| 60 |
+
if pa.StartLine <= pb.StartLine && (pa.StartLine != pb.StartLine || pa.StartCol < pb.StartCol) {
|
| 61 |
+
log.Fatalf("OVERLAP AFTER: %v %v %v", p.FileName, pa, pb)
|
| 62 |
+
}
|
| 63 |
+
}
|
| 64 |
+
p.Blocks = append(p.Blocks, cover.ProfileBlock{})
|
| 65 |
+
copy(p.Blocks[i+1:], p.Blocks[i:])
|
| 66 |
+
p.Blocks[i] = pb
|
| 67 |
+
}
|
| 68 |
+
return i + 1
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
func addProfile(profiles []*cover.Profile, p *cover.Profile) []*cover.Profile {
|
| 72 |
+
i := sort.Search(len(profiles), func(i int) bool { return profiles[i].FileName >= p.FileName })
|
| 73 |
+
if i < len(profiles) && profiles[i].FileName == p.FileName {
|
| 74 |
+
mergeProfiles(profiles[i], p)
|
| 75 |
+
} else {
|
| 76 |
+
profiles = append(profiles, nil)
|
| 77 |
+
copy(profiles[i+1:], profiles[i:])
|
| 78 |
+
profiles[i] = p
|
| 79 |
+
}
|
| 80 |
+
return profiles
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
+
func dumpProfiles(profiles []*cover.Profile, out io.Writer) {
|
| 84 |
+
if len(profiles) == 0 {
|
| 85 |
+
return
|
| 86 |
+
}
|
| 87 |
+
fmt.Fprintf(out, "mode: %s\n", profiles[0].Mode)
|
| 88 |
+
for _, p := range profiles {
|
| 89 |
+
for _, b := range p.Blocks {
|
| 90 |
+
fmt.Fprintf(out, "%s:%d.%d,%d.%d %d %d\n", p.FileName, b.StartLine, b.StartCol, b.EndLine, b.EndCol, b.NumStmt, b.Count)
|
| 91 |
+
}
|
| 92 |
+
}
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
func main() {
|
| 96 |
+
flag.Parse()
|
| 97 |
+
|
| 98 |
+
var merged []*cover.Profile
|
| 99 |
+
|
| 100 |
+
for _, file := range flag.Args() {
|
| 101 |
+
profiles, err := cover.ParseProfiles(file)
|
| 102 |
+
if err != nil {
|
| 103 |
+
log.Fatalf("failed to parse profiles: %v", err)
|
| 104 |
+
}
|
| 105 |
+
for _, p := range profiles {
|
| 106 |
+
merged = addProfile(merged, p)
|
| 107 |
+
}
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
dumpProfiles(merged, os.Stdout)
|
| 111 |
+
}
|
local-test-tika-full-01-vuln_7/fuzz-tooling/infra/experimental/SystemSan/Makefile
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
.POSIX:
|
| 2 |
+
CXX = clang++
|
| 3 |
+
CFLAGS = -std=c++17 -Wall -Wextra -O3 -g3 -Werror
|
| 4 |
+
|
| 5 |
+
all: SystemSan target target_file target_dns
|
| 6 |
+
|
| 7 |
+
SystemSan: SystemSan.cpp inspect_dns.cpp inspect_utils.cpp
|
| 8 |
+
$(CXX) $(CFLAGS) -lpthread -o $@ $^
|
| 9 |
+
|
| 10 |
+
# Needs atheris.
|
| 11 |
+
python-test: all
|
| 12 |
+
./SystemSan python shell_injection_poc_fuzzer.py
|
| 13 |
+
|
| 14 |
+
target: target.cpp
|
| 15 |
+
$(CXX) $(CFLAGS) -fsanitize=address,fuzzer -o $@ $^
|
| 16 |
+
|
| 17 |
+
target_file: target_file.cpp
|
| 18 |
+
$(CXX) $(CFLAGS) -fsanitize=address,fuzzer -o $@ $^
|
| 19 |
+
|
| 20 |
+
target_dns: target_dns.cpp
|
| 21 |
+
$(CXX) $(CFLAGS) -fsanitize=address,fuzzer -o $@ $^
|
| 22 |
+
|
| 23 |
+
test: all vuln.dict
|
| 24 |
+
./SystemSan ./target -dict=vuln.dict
|
| 25 |
+
./SystemSan ./target_file -dict=vuln.dict
|
| 26 |
+
./SystemSan ./target_dns -dict=vuln.dict
|
| 27 |
+
|
| 28 |
+
pytorch-lightning-1.5.10:
|
| 29 |
+
cp SystemSan.cpp PoEs/pytorch-lightning-1.5.10/; \
|
| 30 |
+
cd PoEs/pytorch-lightning-1.5.10/; \
|
| 31 |
+
docker build . --tag syssan_pytorch-lightning; \
|
| 32 |
+
docker run -t systemsan_pytorch-lightning:latest;
|
| 33 |
+
|
| 34 |
+
node-shell-quote-v1.7.3:
|
| 35 |
+
cp SystemSan.cpp PoEs/node-shell-quote-v1.7.3/; \
|
| 36 |
+
cd PoEs/node-shell-quote-v1.7.3/; \
|
| 37 |
+
docker build . --tag systemsan_node-shell-quote; \
|
| 38 |
+
docker run -t systemsan_node-shell-quote:latest;
|
| 39 |
+
|
| 40 |
+
clean:
|
| 41 |
+
rm -f SystemSan /tmp/tripwire target target_file target_dns
|
local-test-tika-full-01-vuln_7/fuzz-tooling/infra/experimental/SystemSan/PoEs/node-shell-quote-v1.7.3/target.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2022 Google LLC
|
| 3 |
+
|
| 4 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
* you may not use this file except in compliance with the License.
|
| 6 |
+
* You may obtain a copy of the License at
|
| 7 |
+
|
| 8 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
|
| 10 |
+
* Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
* See the License for the specific language governing permissions and
|
| 14 |
+
* limitations under the License.
|
| 15 |
+
*/
|
| 16 |
+
/* Exploit shell quote with fuzzer's input as a parameter of echo.
|
| 17 |
+
* This PoC is extended from a report in GitHub Advisory Database:
|
| 18 |
+
* https://github.com/advisories/GHSA-g4rg-993r-mgx7
|
| 19 |
+
* The original report records a shell injection exploit in shell-quote v1.7.2,
|
| 20 |
+
* we show that a similar shell corruption exploit still persists in v1.7.3,
|
| 21 |
+
* after a commit that intends to fix the original exploit.
|
| 22 |
+
* */
|
| 23 |
+
|
| 24 |
+
/* Fuzz the target program with buf generated by Jsfuzz. */
|
| 25 |
+
function fuzz(buf) {
|
| 26 |
+
buf = String(buf)
|
| 27 |
+
const childProcess = require('child_process');
|
| 28 |
+
const shellQuote = require('shell-quote');
|
| 29 |
+
childProcess.execSync(shellQuote.quote(['echo', buf]));
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
/* Run Jsfuzz. */
|
| 33 |
+
module.exports = {
|
| 34 |
+
fuzz
|
| 35 |
+
};
|
local-test-tika-full-01-vuln_7/fuzz-tooling/infra/experimental/SystemSan/PoEs/pytorch-lightning-1.5.10/build.sh
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash -eu
|
| 2 |
+
# Copyright 2022 Google LLC
|
| 3 |
+
#
|
| 4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
# you may not use this file except in compliance with the License.
|
| 6 |
+
# You may obtain a copy of the License at
|
| 7 |
+
#
|
| 8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
#
|
| 10 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
# See the License for the specific language governing permissions and
|
| 14 |
+
# limitations under the License.
|
| 15 |
+
#
|
| 16 |
+
################################################################################
|
| 17 |
+
|
| 18 |
+
# Build and install project (using current CFLAGS, CXXFLAGS).
|
| 19 |
+
cd pytorch-lightning
|
| 20 |
+
pip3 install .
|
| 21 |
+
|
| 22 |
+
# Build fuzzers in $OUT.
|
| 23 |
+
for fuzzer in $(find $SRC -name '*_fuzzer.py'); do
|
| 24 |
+
compile_python_fuzzer $fuzzer
|
| 25 |
+
done
|
local-test-tika-full-01-vuln_7/fuzz-tooling/infra/experimental/SystemSan/PoEs/pytorch-lightning-1.5.10/fuzz_pytorch_lightning.py
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/local/bin/python3
|
| 2 |
+
#
|
| 3 |
+
# Copyright 2022 Google LLC
|
| 4 |
+
#
|
| 5 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
+
# you may not use this file except in compliance with the License.
|
| 7 |
+
# You may obtain a copy of the License at
|
| 8 |
+
#
|
| 9 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
#
|
| 11 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 12 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 13 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 14 |
+
# See the License for the specific language governing permissions and
|
| 15 |
+
# limitations under the License.
|
| 16 |
+
#
|
| 17 |
+
################################################################################
|
| 18 |
+
"""Exploit pytorch lightning with fuzzer's input as a random env variable.
|
| 19 |
+
|
| 20 |
+
This PoC is extended from a report in GitHub Advisory Database:
|
| 21 |
+
https://github.com/advisories/GHSA-r5qj-cvf9-p85h
|
| 22 |
+
The original report documents an exploit using a specific environment variable,
|
| 23 |
+
we show a way to achieve the same exploit with an arbitrary env variable.
|
| 24 |
+
"""
|
| 25 |
+
|
| 26 |
+
import os
|
| 27 |
+
import sys
|
| 28 |
+
import atheris
|
| 29 |
+
|
| 30 |
+
with atheris.instrument_imports():
|
| 31 |
+
from pytorch_lightning import Trainer
|
| 32 |
+
from pytorch_lightning.utilities.argparse import parse_env_variables
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
def prepare_fuzzing_input(data):
|
| 36 |
+
"""Prepare the data needed by the exploit with input data from fuzzers."""
|
| 37 |
+
data = data.replace(b'\0', b'')
|
| 38 |
+
env_name = 'AN_ARBITRARY_ENV_NAME'
|
| 39 |
+
return data, env_name
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
def exploit_target(env_value, env_name):
|
| 43 |
+
"""This target is based on a snippet from the official documentation of
|
| 44 |
+
`parse_env_variables`:
|
| 45 |
+
https://pytorch-lightning.readthedocs.io/en/stable/api/pytorch_lightning.utilities.argparse.html # pylint: disable=line-too-long
|
| 46 |
+
It might not be the most realistic example,
|
| 47 |
+
but serves as a PoC to show that SystemSan works for Python."""
|
| 48 |
+
os.environb[env_name.encode()] = env_value
|
| 49 |
+
parse_env_variables(Trainer, template=env_name)
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
def TestOneInput(data): # pylint: disable=invalid-name
|
| 53 |
+
"""Exploit the target only with input data from fuzzers."""
|
| 54 |
+
env_value, env_name = prepare_fuzzing_input(data)
|
| 55 |
+
exploit_target(env_value, env_name)
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
def main():
|
| 59 |
+
"""Fuzz target with atheris."""
|
| 60 |
+
atheris.Setup(sys.argv, TestOneInput)
|
| 61 |
+
atheris.Fuzz()
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
if __name__ == '__main__':
|
| 65 |
+
main()
|
local-test-tika-full-01-vuln_7/fuzz-tooling/infra/experimental/SystemSan/SystemSan.cpp
ADDED
|
@@ -0,0 +1,493 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2022 Google LLC
|
| 3 |
+
|
| 4 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
* you may not use this file except in compliance with the License.
|
| 6 |
+
* You may obtain a copy of the License at
|
| 7 |
+
|
| 8 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
|
| 10 |
+
* Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
* See the License for the specific language governing permissions and
|
| 14 |
+
* limitations under the License.
|
| 15 |
+
*/
|
| 16 |
+
/* A detector that uses ptrace to identify shell injection vulnerabilities. */
|
| 17 |
+
|
| 18 |
+
/* C standard library */
|
| 19 |
+
#include <errno.h>
|
| 20 |
+
#include <signal.h>
|
| 21 |
+
#include <stdio.h>
|
| 22 |
+
#include <string.h>
|
| 23 |
+
|
| 24 |
+
/* POSIX */
|
| 25 |
+
#include <sys/stat.h>
|
| 26 |
+
#include <sys/user.h>
|
| 27 |
+
#include <sys/wait.h>
|
| 28 |
+
#include <unistd.h>
|
| 29 |
+
|
| 30 |
+
/* Linux */
|
| 31 |
+
#include <sys/ptrace.h>
|
| 32 |
+
#include <syscall.h>
|
| 33 |
+
#include <fcntl.h>
|
| 34 |
+
|
| 35 |
+
#include <fstream>
|
| 36 |
+
#include <iostream>
|
| 37 |
+
#include <map>
|
| 38 |
+
#include <set>
|
| 39 |
+
#include <sstream>
|
| 40 |
+
#include <string>
|
| 41 |
+
#include <vector>
|
| 42 |
+
|
| 43 |
+
#include "inspect_utils.h"
|
| 44 |
+
#include "inspect_dns.h"
|
| 45 |
+
|
| 46 |
+
#define DEBUG_LOGS 0
|
| 47 |
+
|
| 48 |
+
#if DEBUG_LOGS
|
| 49 |
+
#define debug_log(...) \
|
| 50 |
+
do { \
|
| 51 |
+
fprintf(stderr, __VA_ARGS__); \
|
| 52 |
+
fflush(stdout); \
|
| 53 |
+
fputc('\n', stderr); \
|
| 54 |
+
} while (0)
|
| 55 |
+
#else
|
| 56 |
+
#define debug_log(...)
|
| 57 |
+
#endif
|
| 58 |
+
|
| 59 |
+
#define fatal_log(...) \
|
| 60 |
+
do { \
|
| 61 |
+
fprintf(stderr, __VA_ARGS__); \
|
| 62 |
+
fputc('\n', stderr); \
|
| 63 |
+
exit(EXIT_FAILURE); \
|
| 64 |
+
} while (0)
|
| 65 |
+
|
| 66 |
+
// The magic string that we'll use to detect full control over the command
|
| 67 |
+
// executed.
|
| 68 |
+
const std::string kTripWire = "/tmp/tripwire";
|
| 69 |
+
// Shell injection bug confirmed with /tmp/tripwire.
|
| 70 |
+
const std::string kInjectionError = "Shell injection";
|
| 71 |
+
// Shell corruption bug detected based on syntax error.
|
| 72 |
+
const std::string kCorruptionError = "Shell corruption";
|
| 73 |
+
// The magic string that we'll use to detect arbitrary file open
|
| 74 |
+
const std::string kFzAbsoluteDirectory = "/fz/";
|
| 75 |
+
// Arbitrary file open in /fz/
|
| 76 |
+
const std::string kArbitraryFileOpenError = "Arbitrary file open";
|
| 77 |
+
// Assuming only shorter (than this constant) top dir are legitly used.
|
| 78 |
+
constexpr int kRootDirMaxLength = 16;
|
| 79 |
+
|
| 80 |
+
// The PID of the root process we're fuzzing.
|
| 81 |
+
pid_t g_root_pid;
|
| 82 |
+
|
| 83 |
+
// Map of a PID/TID its PID/TID creator and wether it ran exec.
|
| 84 |
+
std::map<pid_t, ThreadParent> root_pids;
|
| 85 |
+
|
| 86 |
+
// Assuming the longest pathname is "/bin/bash".
|
| 87 |
+
constexpr int kShellPathnameLength = 20;
|
| 88 |
+
|
| 89 |
+
// Syntax error messages of each shell.
|
| 90 |
+
const std::map<std::string, std::set<std::string>> kShellSyntaxErrors = {
|
| 91 |
+
{"bash",
|
| 92 |
+
{
|
| 93 |
+
": command not found", // General
|
| 94 |
+
": syntax error", // Unfinished " or ' or ` or if, leading | or ;
|
| 95 |
+
": missing `]'", // Unfinished [
|
| 96 |
+
": event not found", // ! leads large numbers
|
| 97 |
+
": No such file or directory", // Leading < or /
|
| 98 |
+
}},
|
| 99 |
+
{"csh",
|
| 100 |
+
{
|
| 101 |
+
": Command not found.", // General
|
| 102 |
+
": Missing }.", // Unfinished {
|
| 103 |
+
"Too many ('s.", // Unfinished (
|
| 104 |
+
"Invalid null command.", // Leading | or < or >
|
| 105 |
+
"Missing name for redirect.", // Single < or >
|
| 106 |
+
": No match.", // Leading ? or [ or *
|
| 107 |
+
"Modifier failed.", // Leading ^
|
| 108 |
+
"No previous left hand side.", // A ^
|
| 109 |
+
": No such job.", // Leading %
|
| 110 |
+
": No current job.", // A %
|
| 111 |
+
": Undefined variable.", // Containing $
|
| 112 |
+
": Event not found.", // ! leads large numbers
|
| 113 |
+
// TODO: Make this more specific.
|
| 114 |
+
"Unmatched", // Unfinished " or ' or `, leading ;
|
| 115 |
+
}},
|
| 116 |
+
{"dash",
|
| 117 |
+
{
|
| 118 |
+
"not found", // General
|
| 119 |
+
"Syntax error", // Unfinished " or ' or ` or if, leading | or ; or &
|
| 120 |
+
"missing ]", // Unfinished [
|
| 121 |
+
"No such file", // Leading <
|
| 122 |
+
}},
|
| 123 |
+
{"zsh",
|
| 124 |
+
{
|
| 125 |
+
": command not found", // General
|
| 126 |
+
": syntax error", // Unfinished " or ' or `
|
| 127 |
+
": ']' expected", // Unfinished [
|
| 128 |
+
": no such file or directory", // Leading < or /
|
| 129 |
+
": parse error near", // Leading |, or &
|
| 130 |
+
": no such user or named directory", // Leading ~
|
| 131 |
+
}},
|
| 132 |
+
};
|
| 133 |
+
|
| 134 |
+
// Shells used by Processes.
|
| 135 |
+
std::map<pid_t, std::string> g_shell_pids;
|
| 136 |
+
|
| 137 |
+
struct Tracee {
|
| 138 |
+
pid_t pid;
|
| 139 |
+
bool syscall_enter = true;
|
| 140 |
+
|
| 141 |
+
Tracee(pid_t pid) : pid(pid) {}
|
| 142 |
+
};
|
| 143 |
+
|
| 144 |
+
pid_t run_child(char **argv) {
|
| 145 |
+
// Run the program under test with its args as a child process
|
| 146 |
+
pid_t pid = fork();
|
| 147 |
+
switch (pid) {
|
| 148 |
+
case -1:
|
| 149 |
+
fatal_log("Fork failed: %s", strerror(errno));
|
| 150 |
+
case 0:
|
| 151 |
+
raise(SIGSTOP);
|
| 152 |
+
execvp(argv[0], argv);
|
| 153 |
+
fatal_log("execvp: %s", strerror(errno));
|
| 154 |
+
}
|
| 155 |
+
return pid;
|
| 156 |
+
}
|
| 157 |
+
|
| 158 |
+
// Construct a string with the memory specified in a register.
|
| 159 |
+
std::string read_string(pid_t pid, unsigned long reg, unsigned long length) {
|
| 160 |
+
auto memory = read_memory(pid, reg, length);
|
| 161 |
+
if (!memory.size()) {
|
| 162 |
+
return "";
|
| 163 |
+
}
|
| 164 |
+
|
| 165 |
+
std::string content(reinterpret_cast<char *>(memory.data()),
|
| 166 |
+
std::min(memory.size(), length));
|
| 167 |
+
return content;
|
| 168 |
+
}
|
| 169 |
+
|
| 170 |
+
void inspect_for_injection(pid_t pid, const user_regs_struct ®s) {
|
| 171 |
+
// Inspect a PID's registers for the sign of shell injection.
|
| 172 |
+
std::string path = read_string(pid, regs.rdi, kTripWire.length());
|
| 173 |
+
if (!path.length()) {
|
| 174 |
+
return;
|
| 175 |
+
}
|
| 176 |
+
debug_log("inspecting");
|
| 177 |
+
if (path == kTripWire) {
|
| 178 |
+
report_bug(kInjectionError, pid);
|
| 179 |
+
}
|
| 180 |
+
}
|
| 181 |
+
|
| 182 |
+
std::string get_pathname(pid_t pid, const user_regs_struct ®s) {
|
| 183 |
+
// Parse the pathname from the memory specified in the RDI register.
|
| 184 |
+
std::string pathname = read_string(pid, regs.rdi, kShellPathnameLength);
|
| 185 |
+
debug_log("Pathname is %s (len %lu)\n", pathname.c_str(), pathname.length());
|
| 186 |
+
return pathname;
|
| 187 |
+
}
|
| 188 |
+
|
| 189 |
+
std::string match_shell(std::string binary_pathname);
|
| 190 |
+
|
| 191 |
+
// Identify the exact shell behind sh
|
| 192 |
+
std::string identify_sh(std::string path) {
|
| 193 |
+
char shell_pathname[kShellPathnameLength];
|
| 194 |
+
auto written = readlink(path.c_str(), shell_pathname, kShellPathnameLength - 1);
|
| 195 |
+
if (written == -1) {
|
| 196 |
+
std::cerr << "Cannot query which shell is behind sh: readlink failed on "
|
| 197 |
+
<< path << ": "
|
| 198 |
+
<< strerror(errno) << "\n";
|
| 199 |
+
std::cerr << "Assuming the shell is dash\n";
|
| 200 |
+
return "dash";
|
| 201 |
+
}
|
| 202 |
+
shell_pathname[written] = '\0';
|
| 203 |
+
|
| 204 |
+
debug_log("sh links to %s\n", shell_pathname);
|
| 205 |
+
std::string shell_pathname_str(shell_pathname);
|
| 206 |
+
|
| 207 |
+
return match_shell(shell_pathname_str);
|
| 208 |
+
}
|
| 209 |
+
|
| 210 |
+
std::string match_shell(std::string binary_pathname) {
|
| 211 |
+
// Identify the name of the shell used in the pathname.
|
| 212 |
+
if (!binary_pathname.length()) {
|
| 213 |
+
return "";
|
| 214 |
+
}
|
| 215 |
+
|
| 216 |
+
// We use c_str() to accept only the null terminated string.
|
| 217 |
+
std::string binary_name = binary_pathname.substr(
|
| 218 |
+
binary_pathname.find_last_of("/") + 1).c_str();
|
| 219 |
+
|
| 220 |
+
debug_log("Binary is %s (%lu)\n", binary_name.c_str(),
|
| 221 |
+
binary_name.length());
|
| 222 |
+
|
| 223 |
+
for (const auto &item : kShellSyntaxErrors) {
|
| 224 |
+
std::string known_shell = item.first;
|
| 225 |
+
if (binary_name == "sh") {
|
| 226 |
+
debug_log("Matched sh: Needs to identify which specific shell it is.\n");
|
| 227 |
+
return identify_sh(binary_pathname);
|
| 228 |
+
}
|
| 229 |
+
if (binary_name == known_shell) {
|
| 230 |
+
debug_log("Matched %s\n", binary_name.c_str());
|
| 231 |
+
return known_shell;
|
| 232 |
+
}
|
| 233 |
+
}
|
| 234 |
+
return "";
|
| 235 |
+
}
|
| 236 |
+
|
| 237 |
+
std::string get_shell(pid_t pid, const user_regs_struct ®s) {
|
| 238 |
+
// Get shell name used in a process.
|
| 239 |
+
std::string binary_pathname = get_pathname(pid, regs);
|
| 240 |
+
return match_shell(binary_pathname);
|
| 241 |
+
}
|
| 242 |
+
|
| 243 |
+
void match_error_pattern(std::string buffer, std::string shell, pid_t pid) {
|
| 244 |
+
auto error_patterns = kShellSyntaxErrors.at(shell);
|
| 245 |
+
for (const auto &pattern : error_patterns) {
|
| 246 |
+
if (buffer.find(pattern) != std::string::npos) {
|
| 247 |
+
std::cerr << "--- Found a sign of shell corruption ---\n"
|
| 248 |
+
<< buffer.c_str()
|
| 249 |
+
<< "\n----------------------------------------\n";
|
| 250 |
+
// If a shell corruption error happens, kill its parent.
|
| 251 |
+
auto parent = root_pids[pid];
|
| 252 |
+
while (!parent.ran_exec) {
|
| 253 |
+
if (parent.parent_tid == g_root_pid) {
|
| 254 |
+
break;
|
| 255 |
+
}
|
| 256 |
+
parent = root_pids[parent.parent_tid];
|
| 257 |
+
}
|
| 258 |
+
report_bug(kCorruptionError, parent.parent_tid);
|
| 259 |
+
}
|
| 260 |
+
}
|
| 261 |
+
}
|
| 262 |
+
|
| 263 |
+
void inspect_for_corruption(pid_t pid, const user_regs_struct ®s) {
|
| 264 |
+
// Inspect a PID's registers for shell corruption.
|
| 265 |
+
std::string buffer = read_string(pid, regs.rsi, regs.rdx);
|
| 266 |
+
debug_log("Write buffer: %s\n", buffer.c_str());
|
| 267 |
+
match_error_pattern(buffer, g_shell_pids[pid], pid);
|
| 268 |
+
}
|
| 269 |
+
|
| 270 |
+
void log_file_open(std::string path, int flags, pid_t pid) {
|
| 271 |
+
report_bug(kArbitraryFileOpenError, pid);
|
| 272 |
+
std::cerr << "===File opened: " << path.c_str() << ", flags = " << flags << ",";
|
| 273 |
+
switch (flags & 3) {
|
| 274 |
+
case O_RDONLY:
|
| 275 |
+
std::cerr << "O_RDONLY";
|
| 276 |
+
break;
|
| 277 |
+
case O_WRONLY:
|
| 278 |
+
std::cerr << "O_WRONLY";
|
| 279 |
+
break;
|
| 280 |
+
case O_RDWR:
|
| 281 |
+
std::cerr << "O_RDWR";
|
| 282 |
+
break;
|
| 283 |
+
default:
|
| 284 |
+
std::cerr << "unknown";
|
| 285 |
+
}
|
| 286 |
+
std::cerr << "===\n";
|
| 287 |
+
}
|
| 288 |
+
|
| 289 |
+
bool has_unprintable(const std::string &value) {
|
| 290 |
+
for (size_t i = 0; i < value.length(); i++) {
|
| 291 |
+
if (value[i] & 0x80) {
|
| 292 |
+
return true;
|
| 293 |
+
}
|
| 294 |
+
}
|
| 295 |
+
return false;
|
| 296 |
+
}
|
| 297 |
+
|
| 298 |
+
void inspect_for_arbitrary_file_open(pid_t pid, const user_regs_struct ®s) {
|
| 299 |
+
// Inspect a PID's register for the sign of arbitrary file open.
|
| 300 |
+
std::string path = read_string(pid, regs.rsi, kRootDirMaxLength);
|
| 301 |
+
if (!path.length()) {
|
| 302 |
+
return;
|
| 303 |
+
}
|
| 304 |
+
if (path.substr(0, kFzAbsoluteDirectory.length()) == kFzAbsoluteDirectory) {
|
| 305 |
+
log_file_open(path, regs.rdx, pid);
|
| 306 |
+
return;
|
| 307 |
+
}
|
| 308 |
+
if (path[0] == '/' && path.length() > 1) {
|
| 309 |
+
std::string path_absolute_topdir = path;
|
| 310 |
+
size_t root_dir_end = path.find('/', 1);
|
| 311 |
+
if (root_dir_end != std::string::npos) {
|
| 312 |
+
path_absolute_topdir = path.substr(0, root_dir_end);
|
| 313 |
+
}
|
| 314 |
+
if (has_unprintable(path_absolute_topdir)) {
|
| 315 |
+
struct stat dirstat;
|
| 316 |
+
if (stat(path_absolute_topdir.c_str(), &dirstat) != 0) {
|
| 317 |
+
log_file_open(path, regs.rdx, pid);
|
| 318 |
+
}
|
| 319 |
+
}
|
| 320 |
+
}
|
| 321 |
+
}
|
| 322 |
+
|
| 323 |
+
int trace(std::map<pid_t, Tracee> pids) {
|
| 324 |
+
unsigned long exit_status = 0;
|
| 325 |
+
while (!pids.empty()) {
|
| 326 |
+
std::vector<pid_t> new_pids;
|
| 327 |
+
|
| 328 |
+
auto it = pids.begin();
|
| 329 |
+
|
| 330 |
+
while (it != pids.end()) {
|
| 331 |
+
auto pid = it->first;
|
| 332 |
+
auto &tracee = it->second;
|
| 333 |
+
int status = 0;
|
| 334 |
+
|
| 335 |
+
int result = waitpid(pid, &status, __WALL | WNOHANG);
|
| 336 |
+
if (result == -1) {
|
| 337 |
+
it = pids.erase(it);
|
| 338 |
+
continue;
|
| 339 |
+
}
|
| 340 |
+
|
| 341 |
+
if (result == 0) {
|
| 342 |
+
// Nothing to report yet.
|
| 343 |
+
++it;
|
| 344 |
+
continue;
|
| 345 |
+
}
|
| 346 |
+
|
| 347 |
+
if (WIFEXITED(status) || WIFSIGNALED(status)) {
|
| 348 |
+
debug_log("%d exited", pid);
|
| 349 |
+
it = pids.erase(it);
|
| 350 |
+
// Remove pid from the watchlist when it exits
|
| 351 |
+
g_shell_pids.erase(pid);
|
| 352 |
+
root_pids.erase(pid);
|
| 353 |
+
continue;
|
| 354 |
+
}
|
| 355 |
+
|
| 356 |
+
// ptrace sets 0x80 for syscalls (with PTRACE_O_TRACESYSGOOD set).
|
| 357 |
+
bool is_syscall =
|
| 358 |
+
WIFSTOPPED(status) && WSTOPSIG(status) == (SIGTRAP | 0x80);
|
| 359 |
+
int sig = 0;
|
| 360 |
+
if (!is_syscall) {
|
| 361 |
+
// Handle generic signal.
|
| 362 |
+
siginfo_t siginfo;
|
| 363 |
+
if (ptrace(PTRACE_GETSIGINFO, pid, nullptr, &siginfo) == -1) {
|
| 364 |
+
debug_log("ptrace(PTRACE_GETSIGINFO, %d): %s", pid, strerror(errno));
|
| 365 |
+
continue;
|
| 366 |
+
}
|
| 367 |
+
sig = siginfo.si_signo;
|
| 368 |
+
debug_log("forwarding signal %d to %d", sig, pid);
|
| 369 |
+
}
|
| 370 |
+
|
| 371 |
+
if ((status >> 8 == (SIGTRAP | (PTRACE_EVENT_EXIT << 8)))) {
|
| 372 |
+
debug_log("%d exiting", pid);
|
| 373 |
+
if (pid == g_root_pid) {
|
| 374 |
+
if (ptrace(PTRACE_GETEVENTMSG, pid, 0, &exit_status) == -1) {
|
| 375 |
+
debug_log("ptrace(PTRACE_GETEVENTMSG, %d): %s", pid, strerror(errno));
|
| 376 |
+
}
|
| 377 |
+
debug_log("got exit status from root process: %lu", exit_status);
|
| 378 |
+
}
|
| 379 |
+
|
| 380 |
+
if (ptrace(PTRACE_DETACH, pid, 0, 0) == -1) {
|
| 381 |
+
debug_log("ptrace(PTRACE_DETACH, %d): %s", pid, strerror(errno));
|
| 382 |
+
}
|
| 383 |
+
continue;
|
| 384 |
+
}
|
| 385 |
+
|
| 386 |
+
if (WIFSTOPPED(status) &&
|
| 387 |
+
(status >> 8 == (SIGTRAP | (PTRACE_EVENT_CLONE << 8)) ||
|
| 388 |
+
status >> 8 == (SIGTRAP | (PTRACE_EVENT_FORK << 8)) ||
|
| 389 |
+
status >> 8 == (SIGTRAP | (PTRACE_EVENT_VFORK << 8)))) {
|
| 390 |
+
long new_pid;
|
| 391 |
+
if (ptrace(PTRACE_GETEVENTMSG, pid, 0, &new_pid) == -1) {
|
| 392 |
+
debug_log("ptrace(PTRACE_GETEVENTMSG, %d): %s", pid, strerror(errno));
|
| 393 |
+
continue;
|
| 394 |
+
}
|
| 395 |
+
debug_log("forked %ld", new_pid);
|
| 396 |
+
new_pids.push_back(new_pid);
|
| 397 |
+
root_pids.emplace(new_pid, ThreadParent(pid));
|
| 398 |
+
}
|
| 399 |
+
|
| 400 |
+
if (is_syscall) {
|
| 401 |
+
user_regs_struct regs;
|
| 402 |
+
if (ptrace(PTRACE_GETREGS, pid, 0, ®s) == -1) {
|
| 403 |
+
debug_log("ptrace(PTRACE_GETREGS, %d): %s", pid, strerror(errno));
|
| 404 |
+
continue;
|
| 405 |
+
}
|
| 406 |
+
|
| 407 |
+
if (tracee.syscall_enter) {
|
| 408 |
+
if (regs.orig_rax == __NR_execve) {
|
| 409 |
+
// This is a new process.
|
| 410 |
+
auto parent = root_pids[pid];
|
| 411 |
+
parent.ran_exec = true;
|
| 412 |
+
root_pids[pid] = parent;
|
| 413 |
+
inspect_for_injection(pid, regs);
|
| 414 |
+
std::string shell = get_shell(pid, regs);
|
| 415 |
+
if (shell != "") {
|
| 416 |
+
debug_log("Shell parsed: %s", shell.c_str());
|
| 417 |
+
g_shell_pids.insert(std::make_pair(pid, shell));
|
| 418 |
+
}
|
| 419 |
+
}
|
| 420 |
+
|
| 421 |
+
inspect_dns_syscalls(pid, regs);
|
| 422 |
+
|
| 423 |
+
if (regs.orig_rax == __NR_openat) {
|
| 424 |
+
// TODO(metzman): Re-enable this once we have config/flag support.
|
| 425 |
+
// inspect_for_arbitrary_file_open(pid, regs);
|
| 426 |
+
}
|
| 427 |
+
|
| 428 |
+
if (regs.orig_rax == __NR_write &&
|
| 429 |
+
g_shell_pids.find(pid) != g_shell_pids.end()) {
|
| 430 |
+
debug_log("Inspecting the `write` buffer of shell process %d.",
|
| 431 |
+
pid);
|
| 432 |
+
inspect_for_corruption(pid, regs);
|
| 433 |
+
}
|
| 434 |
+
}
|
| 435 |
+
|
| 436 |
+
// TODO: Check for commands with invalid syntax passed to /bin/sh and
|
| 437 |
+
// other shells.
|
| 438 |
+
// TODO: It's possible the process we're fuzzing can communicate with
|
| 439 |
+
// another process to execute code. Our check wouldn't catch this
|
| 440 |
+
// currently.
|
| 441 |
+
tracee.syscall_enter = !tracee.syscall_enter;
|
| 442 |
+
}
|
| 443 |
+
|
| 444 |
+
if (ptrace(PTRACE_SYSCALL, pid, nullptr, sig) == -1) {
|
| 445 |
+
debug_log("ptrace(PTRACE_SYSCALL, %d): %s", pid, strerror(errno));
|
| 446 |
+
continue;
|
| 447 |
+
}
|
| 448 |
+
|
| 449 |
+
++it;
|
| 450 |
+
}
|
| 451 |
+
|
| 452 |
+
for (const auto &pid : new_pids) {
|
| 453 |
+
pids.emplace(pid, Tracee(pid));
|
| 454 |
+
}
|
| 455 |
+
}
|
| 456 |
+
return static_cast<int>(exit_status >> 8);
|
| 457 |
+
}
|
| 458 |
+
|
| 459 |
+
int main(int argc, char **argv) {
|
| 460 |
+
if (argc <= 1) {
|
| 461 |
+
fatal_log("Expecting at least one arguments, received %d", argc - 1);
|
| 462 |
+
}
|
| 463 |
+
|
| 464 |
+
// Create an executable tripwire file, as programs may check for existence
|
| 465 |
+
// before actually calling exec.
|
| 466 |
+
std::ofstream tripwire(kTripWire);
|
| 467 |
+
tripwire.close();
|
| 468 |
+
chmod(kTripWire.c_str(), 0755);
|
| 469 |
+
|
| 470 |
+
pid_t pid = run_child(argv + 1);
|
| 471 |
+
|
| 472 |
+
long options = PTRACE_O_TRACESYSGOOD | PTRACE_O_TRACEFORK |
|
| 473 |
+
PTRACE_O_TRACEVFORK | PTRACE_O_TRACECLONE |
|
| 474 |
+
PTRACE_O_TRACEEXIT;
|
| 475 |
+
|
| 476 |
+
if (ptrace(PTRACE_SEIZE, pid, nullptr, options) == -1) {
|
| 477 |
+
fatal_log("ptrace(PTRACE_SEIZE): %s", strerror(errno));
|
| 478 |
+
}
|
| 479 |
+
|
| 480 |
+
if (waitpid(pid, nullptr, __WALL) == -1) {
|
| 481 |
+
fatal_log("waitpid: %s", strerror(errno));
|
| 482 |
+
}
|
| 483 |
+
|
| 484 |
+
if (ptrace(PTRACE_SYSCALL, pid, 0, 0) == -1) {
|
| 485 |
+
fatal_log("ptrace(PTRACE_SYSCALL): %s", strerror(errno));
|
| 486 |
+
}
|
| 487 |
+
|
| 488 |
+
g_root_pid = pid;
|
| 489 |
+
std::map<pid_t, Tracee> pids;
|
| 490 |
+
pids.emplace(pid, Tracee(pid));
|
| 491 |
+
root_pids.emplace(pid, ThreadParent(pid));
|
| 492 |
+
return trace(pids);
|
| 493 |
+
}
|
local-test-tika-full-01-vuln_7/fuzz-tooling/infra/experimental/chronos/build_all.sh
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
# Copyright 2024 Google LLC
|
| 3 |
+
#
|
| 4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
# you may not use this file except in compliance with the License.
|
| 6 |
+
# You may obtain a copy of the License at
|
| 7 |
+
#
|
| 8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
#
|
| 10 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
# See the License for the specific language governing permissions and
|
| 14 |
+
# limitations under the License.
|
| 15 |
+
#
|
| 16 |
+
################################################################################
|
| 17 |
+
|
| 18 |
+
# Build all C/C++ projects.
|
| 19 |
+
c_project_yaml=$(find projects/ -name project.yaml -exec grep -l 'language: c' {} \;)
|
| 20 |
+
projs=$(echo $c_project_yaml | xargs dirname | xargs basename -a | sort)
|
| 21 |
+
|
| 22 |
+
cd infra/experimental/chronos
|
| 23 |
+
|
| 24 |
+
for proj in $projs; do
|
| 25 |
+
if [ ! -f ../../../projects/$proj/Dockerfile ]; then
|
| 26 |
+
# Incomplete integration.
|
| 27 |
+
echo "Skipping $proj as it's incomplete."
|
| 28 |
+
continue
|
| 29 |
+
fi
|
| 30 |
+
|
| 31 |
+
echo ./build_on_cloudbuild.sh $proj c
|
| 32 |
+
./build_on_cloudbuild.sh $proj c
|
| 33 |
+
done
|
local-test-tika-full-01-vuln_7/fuzz-tooling/infra/experimental/chronos/build_cache_local.sh
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash -eu
|
| 2 |
+
# Copyright 2024 Google LLC
|
| 3 |
+
#
|
| 4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
# you may not use this file except in compliance with the License.
|
| 6 |
+
# You may obtain a copy of the License at
|
| 7 |
+
#
|
| 8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
#
|
| 10 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
# See the License for the specific language governing permissions and
|
| 14 |
+
# limitations under the License.
|
| 15 |
+
#
|
| 16 |
+
################################################################################
|
| 17 |
+
|
| 18 |
+
_PROJECT=$1
|
| 19 |
+
_FUZZING_LANGUAGE=$2
|
| 20 |
+
_SANITIZER=${3:-address}
|
| 21 |
+
|
| 22 |
+
BASE=$PWD
|
| 23 |
+
|
| 24 |
+
# Final image is either ccache or replay script, depending on which worked.
|
| 25 |
+
FINAL_IMAGE_NAME=us-central1-docker.pkg.dev/oss-fuzz/oss-fuzz-gen/${_PROJECT}-ofg-cached-${_SANITIZER}
|
| 26 |
+
|
| 27 |
+
# Always build an image with ccache.
|
| 28 |
+
CCACHE_IMAGE_NAME=us-central1-docker.pkg.dev/oss-fuzz/oss-fuzz-gen/${_PROJECT}-ofg-ccache-${_SANITIZER}
|
| 29 |
+
|
| 30 |
+
# Step 1: build the base image
|
| 31 |
+
cd projects/${_PROJECT}
|
| 32 |
+
docker build -t gcr.io/oss-fuzz/${_PROJECT} .
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
# Step 2: create a container where `compile` has run which enables ccaching
|
| 36 |
+
# and also generates a replay build script.
|
| 37 |
+
cd ${BASE}
|
| 38 |
+
mkdir -p ccaches/${_PROJECT}
|
| 39 |
+
mkdir -p build/out/${_PROJECT}
|
| 40 |
+
B_START=$SECONDS
|
| 41 |
+
|
| 42 |
+
docker container rm -f ${_PROJECT}-origin-${_SANITIZER}
|
| 43 |
+
|
| 44 |
+
docker run \
|
| 45 |
+
--env=SANITIZER=${_SANITIZER} \
|
| 46 |
+
--env=CCACHE_DIR=/workspace/ccache \
|
| 47 |
+
--env=FUZZING_LANGUAGE=${_FUZZING_LANGUAGE} \
|
| 48 |
+
--env=CAPTURE_REPLAY_SCRIPT=1 \
|
| 49 |
+
--name=${_PROJECT}-origin-${_SANITIZER} \
|
| 50 |
+
-v=$PWD/ccaches/${_PROJECT}/ccache:/workspace/ccache \
|
| 51 |
+
-v=$PWD/build/out/${_PROJECT}/:/out/ \
|
| 52 |
+
gcr.io/oss-fuzz/${_PROJECT} \
|
| 53 |
+
/bin/bash -c \
|
| 54 |
+
"export PATH=/ccache/bin:\$PATH && compile"
|
| 55 |
+
B_TIME=$(($SECONDS - $B_START))
|
| 56 |
+
|
| 57 |
+
# Step 3: save (commit, locally) the cached container as an image
|
| 58 |
+
docker container commit -c "ENV REPLAY_ENABLED=1" -c "ENV CAPTURE_REPLAY_SCRIPT=" ${_PROJECT}-origin-${_SANITIZER} $FINAL_IMAGE_NAME
|
| 59 |
+
|
| 60 |
+
# Step 4: save the list of executables created from a vanilla build. This is
|
| 61 |
+
# needed for validating if replay and ccaching works.
|
| 62 |
+
# notes: run a shell the container with e.g.
|
| 63 |
+
# `docker run --entrypoint /bin/bash -it local/ossfuzz/htslib-origin-address`
|
| 64 |
+
executables_vanilla="$(find ./build/out/${_PROJECT} -executable -type f | sort)"
|
| 65 |
+
|
| 66 |
+
|
| 67 |
+
# Step 5: Build with replay enabled, and validate the executables are the same
|
| 68 |
+
# in terms of naming.
|
| 69 |
+
# Note that an important step is removing everything in $OUT/ which is done
|
| 70 |
+
# in the docker command.
|
| 71 |
+
R_START=$SECONDS
|
| 72 |
+
docker run \
|
| 73 |
+
--rm \
|
| 74 |
+
--env=SANITIZER=${_SANITIZER} \
|
| 75 |
+
--env=FUZZING_LANGUAGE=${_FUZZING_LANGUAGE} \
|
| 76 |
+
-v=$PWD/build/out/${_PROJECT}/:/out/ \
|
| 77 |
+
--name=${_PROJECT}-origin-${_SANITIZER}-replay-recached \
|
| 78 |
+
$FINAL_IMAGE_NAME \
|
| 79 |
+
/bin/bash -c \
|
| 80 |
+
"export PATH=/ccache/bin:\$PATH && rm -rf /out/* && compile"
|
| 81 |
+
R_TIME=$(($SECONDS - $R_START))
|
| 82 |
+
|
| 83 |
+
# Step 6: Extract the newly build executables
|
| 84 |
+
executables_replay="$(find ./build/out/${_PROJECT}/ -executable -type f | sort)"
|
| 85 |
+
|
| 86 |
+
echo "Executables vanilla: "
|
| 87 |
+
echo ${executables_vanilla}
|
| 88 |
+
|
| 89 |
+
echo "------------------------------------------------------"
|
| 90 |
+
echo "Executables replay: "
|
| 91 |
+
echo ${executables_replay}
|
| 92 |
+
|
| 93 |
+
REPLAY_WORKED=
|
| 94 |
+
|
| 95 |
+
# Step 7: match executables from vanilla builds and replay builds.
|
| 96 |
+
# If this step is successful, then the process can exit as it's ready.
|
| 97 |
+
if [[ "$executables_replay" == "$executables_vanilla" ]]
|
| 98 |
+
then
|
| 99 |
+
REPLAY_WORKED=1
|
| 100 |
+
|
| 101 |
+
if [ -z "${RUN_ALL+1}" ]; then
|
| 102 |
+
echo "${_PROJECT}: Replay worked."
|
| 103 |
+
echo "${_PROJECT}: Compile times: Vanilla=${B_TIME}; Replay=${R_TIME};"
|
| 104 |
+
exit 0
|
| 105 |
+
fi
|
| 106 |
+
else
|
| 107 |
+
echo "${_PROJECT}: Replay did not work"
|
| 108 |
+
R_TIME="N/A"
|
| 109 |
+
fi
|
| 110 |
+
|
| 111 |
+
# Step 8: prepare Dockerfile for ccache
|
| 112 |
+
cp -rf ccaches/${_PROJECT}/ccache ./projects/${_PROJECT}/ccache-cache
|
| 113 |
+
|
| 114 |
+
infra/experimental/chronos/prepare-ccache ${_PROJECT}
|
| 115 |
+
|
| 116 |
+
cd projects/${_PROJECT}
|
| 117 |
+
|
| 118 |
+
# Step 9: Build an image with CCache's new items (modifications are done on the
|
| 119 |
+
# dockerfile)
|
| 120 |
+
docker build -t $CCACHE_IMAGE_NAME .
|
| 121 |
+
|
| 122 |
+
cd ${BASE}
|
| 123 |
+
|
| 124 |
+
# Step 10: Run a `compile` with ccache's image.
|
| 125 |
+
# Run the ccache build
|
| 126 |
+
A_START=$SECONDS
|
| 127 |
+
docker run \
|
| 128 |
+
--rm \
|
| 129 |
+
--env=SANITIZER=${_SANITIZER} \
|
| 130 |
+
--env=FUZZING_LANGUAGE=${_FUZZING_LANGUAGE} \
|
| 131 |
+
--name=${_PROJECT}-origin-${_SANITIZER}-recached \
|
| 132 |
+
-v=$PWD/build/out/${_PROJECT}/:/out/ \
|
| 133 |
+
$CCACHE_IMAGE_NAME \
|
| 134 |
+
/bin/bash -c \
|
| 135 |
+
"export PATH=/ccache/bin:\$PATH && rm -rf /out/* && compile"
|
| 136 |
+
A_TIME=$(($SECONDS - $A_START))
|
| 137 |
+
|
| 138 |
+
# Step 11: extract the executables from the ccache build
|
| 139 |
+
executables_ccache="$(find ./build/out/${_PROJECT}/ -executable -type f | sort)"
|
| 140 |
+
|
| 141 |
+
|
| 142 |
+
# Step 12: validate the ccache builds are successful
|
| 143 |
+
if [[ "$executables_ccache" == "$executables_vanilla" ]]
|
| 144 |
+
then
|
| 145 |
+
echo "${_PROJECT}: Compile times: Vanilla=${B_TIME}; Replay=${R_TIME}; CCache=${A_TIME};"
|
| 146 |
+
|
| 147 |
+
if [[ -z "${REPLAY_WORKED}" || ${R_TIME} -gt ${A_TIME} ]]; then
|
| 148 |
+
if [ ${R_TIME} -gt ${A_TIME} ]; then
|
| 149 |
+
echo "Replay was slower than ccache."
|
| 150 |
+
fi
|
| 151 |
+
|
| 152 |
+
# Replay didn't work or was slower, so make the default "cached" image use the ccache one.
|
| 153 |
+
docker image tag \
|
| 154 |
+
$CCACHE_IMAGE_NAME \
|
| 155 |
+
$FINAL_IMAGE_NAME
|
| 156 |
+
fi
|
| 157 |
+
|
| 158 |
+
exit 0
|
| 159 |
+
else
|
| 160 |
+
echo "${_PROJECT}: Replay and ccaching did not work."
|
| 161 |
+
exit 1
|
| 162 |
+
fi
|
| 163 |
+
|
local-test-tika-full-01-vuln_7/fuzz-tooling/infra/experimental/chronos/build_on_cloudbuild.sh
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
# Copyright 2024 Google LLC
|
| 3 |
+
#
|
| 4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
# you may not use this file except in compliance with the License.
|
| 6 |
+
# You may obtain a copy of the License at
|
| 7 |
+
#
|
| 8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
#
|
| 10 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
# See the License for the specific language governing permissions and
|
| 14 |
+
# limitations under the License.
|
| 15 |
+
#
|
| 16 |
+
################################################################################
|
| 17 |
+
PROJECT=$1
|
| 18 |
+
FUZZING_LANGUAGE=$2
|
| 19 |
+
|
| 20 |
+
gcloud builds submit "https://github.com/google/oss-fuzz" \
|
| 21 |
+
--async \
|
| 22 |
+
--git-source-revision=master \
|
| 23 |
+
--config=cloudbuild.yaml \
|
| 24 |
+
--substitutions=_PROJECT=$PROJECT,_FUZZING_LANGUAGE=$FUZZING_LANGUAGE \
|
| 25 |
+
--project=oss-fuzz \
|
| 26 |
+
--region=us-central1
|
local-test-tika-full-01-vuln_7/fuzz-tooling/infra/experimental/chronos/chronos.sh
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2024 Google LLC
|
| 2 |
+
#
|
| 3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
# you may not use this file except in compliance with the License.
|
| 5 |
+
# You may obtain a copy of the License at
|
| 6 |
+
#
|
| 7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
#
|
| 9 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
# See the License for the specific language governing permissions and
|
| 13 |
+
# limitations under the License.
|
| 14 |
+
#
|
| 15 |
+
################################################################################
|
| 16 |
+
|
| 17 |
+
# This script records the ENV and commands needed for fuzz target recompilation.
|
| 18 |
+
# It intercepts bash commands to save: 1) the ENV variable values before
|
| 19 |
+
# building the fuzz target (`recompile_env.sh`) and 2) all subsequent bash
|
| 20 |
+
# commands from that point (`recompile`). Combined with Docker, this setup
|
| 21 |
+
# allows for recompiling the fuzz target without rebuilding the entire project.
|
| 22 |
+
# Usage:
|
| 23 |
+
# 1. Set FUZZ_TARGET (e.g., in project's Dockerfile)
|
| 24 |
+
# 2. Source this file before compiling the fuzz target (e.g., source chronos.sh
|
| 25 |
+
# at the beginning of project's build.sh).
|
| 26 |
+
|
| 27 |
+
export START_RECORDING="false"
|
| 28 |
+
RECOMPILE_ENV="/usr/local/bin/recompile_env.sh"
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
# Initialize the recompile script as compile in case Chronos did not trap any
|
| 32 |
+
# command containing the fuzz target.
|
| 33 |
+
initialize_recompile_script() {
|
| 34 |
+
export RECOMPILE_SCRIPT="/usr/local/bin/recompile"
|
| 35 |
+
cp "/usr/local/bin/compile" "$RECOMPILE_SCRIPT"
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
reset_recompile_script() {
|
| 39 |
+
rm "$RECOMPILE_SCRIPT"
|
| 40 |
+
echo "#!/bin/bash" > "$RECOMPILE_SCRIPT"
|
| 41 |
+
echo "source $RECOMPILE_ENV" >> "$RECOMPILE_SCRIPT"
|
| 42 |
+
chmod +x "$RECOMPILE_SCRIPT"
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
# Execute or record command for recompilation.
|
| 47 |
+
execute_or_record_command() {
|
| 48 |
+
record_command() {
|
| 49 |
+
echo "cd \"$(pwd)\"" >> "$RECOMPILE_SCRIPT"
|
| 50 |
+
echo "$@" >> "$RECOMPILE_SCRIPT"
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
# Check if any element in the command array contains the FUZZ_TARGET.
|
| 54 |
+
if [[ "$BASH_COMMAND" == *"$FUZZ_TARGET"* ]]; then
|
| 55 |
+
export START_RECORDING="true"
|
| 56 |
+
# Save all environment variables, excluding read-only ones
|
| 57 |
+
reset_recompile_script
|
| 58 |
+
declare -p | grep -Ev 'declare -[^ ]*r[^ ]*' > "$RECOMPILE_ENV"
|
| 59 |
+
fi
|
| 60 |
+
|
| 61 |
+
if [[ "$START_RECORDING" == "true" ]]; then
|
| 62 |
+
record_command "$BASH_COMMAND"
|
| 63 |
+
echo "Recorded execution of: $BASH_COMMAND"
|
| 64 |
+
fi
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
|
| 68 |
+
main() {
|
| 69 |
+
# Initialize.
|
| 70 |
+
initialize_recompile_script
|
| 71 |
+
|
| 72 |
+
# Set up trap for DEBUG to intercept commands.
|
| 73 |
+
trap 'execute_or_record_command' DEBUG
|
| 74 |
+
|
| 75 |
+
# Enable extended debugging mode
|
| 76 |
+
shopt -s extdebug
|
| 77 |
+
# Ensure trap works in subshells and functions.
|
| 78 |
+
set -T
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
main
|
local-test-tika-full-01-vuln_7/fuzz-tooling/infra/experimental/chronos/cloudbuild_all.yaml
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2024 Google LLC
|
| 2 |
+
#
|
| 3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
# you may not use this file except in compliance with the License.
|
| 5 |
+
# You may obtain a copy of the License at
|
| 6 |
+
#
|
| 7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
#
|
| 9 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
# See the License for the specific language governing permissions and
|
| 13 |
+
# limitations under the License.
|
| 14 |
+
#
|
| 15 |
+
################################################################################
|
| 16 |
+
# CloudBuild for generating Chronos-cached images.
|
| 17 |
+
steps:
|
| 18 |
+
- name: 'gcr.io/cloud-builders/docker'
|
| 19 |
+
args:
|
| 20 |
+
- build
|
| 21 |
+
- -t
|
| 22 |
+
- gcloud
|
| 23 |
+
- .
|
| 24 |
+
dir: infra/experimental/chronos
|
| 25 |
+
- name: 'gcloud'
|
| 26 |
+
args:
|
| 27 |
+
- infra/experimental/chronos/build_all.sh
|
| 28 |
+
entrypoint: /bin/bash
|
| 29 |
+
timeout: 1800s
|
| 30 |
+
serviceAccount: 'projects/oss-fuzz/serviceAccounts/llm-eval@oss-fuzz.iam.gserviceaccount.com'
|
| 31 |
+
options:
|
| 32 |
+
logging: CLOUD_LOGGING_ONLY
|
| 33 |
+
tags:
|
| 34 |
+
- chronos-all
|
local-test-tika-full-01-vuln_7/fuzz-tooling/infra/experimental/chronos/e2e-replay-build.sh
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/bash
|
| 2 |
+
# Copyright 2024 Google LLC
|
| 3 |
+
#
|
| 4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
# you may not use this file except in compliance with the License.
|
| 6 |
+
# You may obtain a copy of the License at
|
| 7 |
+
#
|
| 8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
#
|
| 10 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
# See the License for the specific language governing permissions and
|
| 14 |
+
# limitations under the License.
|
| 15 |
+
#
|
| 16 |
+
################################################################################
|
| 17 |
+
|
| 18 |
+
# Sample projects: simd, wt, libheif, htslib
|
| 19 |
+
PROJECT=liblouis
|
| 20 |
+
LOG=replay-${PROJECT}.txt
|
| 21 |
+
OUT1=replay-out-${PROJECT}-1
|
| 22 |
+
OUT2=replay-out-${PROJECT}-2
|
| 23 |
+
python infra/helper.py build_image --no-pull "$PROJECT"
|
| 24 |
+
|
| 25 |
+
# AddressSanitizer.
|
| 26 |
+
mkdir -p build/out/${PROJECT}
|
| 27 |
+
echo "start" >> ${LOG}
|
| 28 |
+
echo $(date +%Y:%m:%d:%H:%M:%S) >> ${LOG}
|
| 29 |
+
# Remove container name we are about to use.
|
| 30 |
+
docker container rm "${PROJECT}-origin-asan"
|
| 31 |
+
|
| 32 |
+
# Build once, clean container if needed
|
| 33 |
+
docker run -v $PWD/build/out/${PROJECT}:/out \
|
| 34 |
+
-ti --entrypoint="/bin/sh" \
|
| 35 |
+
--env FUZZING_LANGUAGE=c --env SANITIZER="address" \
|
| 36 |
+
--name "${PROJECT}-origin-asan" \
|
| 37 |
+
"gcr.io/oss-fuzz/${PROJECT}" -c "compile"
|
| 38 |
+
|
| 39 |
+
# Copy outs and log data
|
| 40 |
+
cp -rf $PWD/build/out/${PROJECT} ${OUT1}
|
| 41 |
+
rm -rf $PWD/build/out/${PROJECT}
|
| 42 |
+
ls -la $PWD/build/out/ >> ${LOG}
|
| 43 |
+
echo "next" >> ${LOG}
|
| 44 |
+
echo $(date +%Y:%m:%d:%H:%M:%S) >> ${LOG}
|
| 45 |
+
docker commit "${PROJECT}-origin-asan" "gcr.io/oss-fuzz/${PROJECT}-ofg-cached-asan"
|
| 46 |
+
|
| 47 |
+
# Run the replay command
|
| 48 |
+
docker run -v $PWD/build/out/${PROJECT}:/out \
|
| 49 |
+
-e REPLAY_ENABLED=1 -ti --entrypoint="/bin/sh" \
|
| 50 |
+
--env FUZZING_LANGUAGE=c --env SANITIZER="address" \
|
| 51 |
+
"gcr.io/oss-fuzz/${PROJECT}-ofg-cached-asan" -c "compile"
|
| 52 |
+
echo "finish" >> ${LOG}
|
| 53 |
+
echo $(date +%Y:%m:%d:%H:%M:%S) >> ${LOG}
|
| 54 |
+
cp -rf $PWD/build/out/${PROJECT} ${OUT2}
|
| 55 |
+
|
| 56 |
+
# Now match the artifacts
|
| 57 |
+
SUCCESS=$(infra/experimental/chronos/match_artifacts $OUT1 $OUT2)
|
| 58 |
+
|
| 59 |
+
if [[ $SUCCESS -eq 0 ]]; then
|
| 60 |
+
echo "SUCCESS REPLAY" >> ${LOG}
|
| 61 |
+
else
|
| 62 |
+
echo "FAIL REPLAY" >> ${LOG}
|
| 63 |
+
fi
|
local-test-tika-full-01-vuln_7/fuzz-tooling/infra/experimental/sanitizers/ExecSan/README.md
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Moved
|
| 2 |
+
|
| 3 |
+
This has moved to <https://github.com/google/oss-fuzz/tree/master/infra/experimental/SystemSan>.
|