Add files using upload-large-folder tool
Browse files- local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/cifuzz/cifuzz_end_to_end_test.py +48 -0
- local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/cifuzz/get_coverage_test.py +253 -0
- local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/cifuzz/platform_config/gitlab.py +78 -0
- local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/cifuzz/platform_config/standalone.py +33 -0
- local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/cifuzz/test_data/example_crash_fuzzer_bug_summary.txt +68 -0
- local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/experimental/SystemSan/PoEs/node-shell-quote-v1.7.3/Dockerfile +35 -0
- local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/experimental/SystemSan/PoEs/node-shell-quote-v1.7.3/build.sh +22 -0
- local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/experimental/SystemSan/PoEs/node-shell-quote-v1.7.3/target.js +35 -0
- local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/experimental/SystemSan/PoEs/pytorch-lightning-1.5.10/Dockerfile +32 -0
- local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/experimental/SystemSan/PoEs/pytorch-lightning-1.5.10/Makefile +12 -0
- local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/experimental/SystemSan/PoEs/pytorch-lightning-1.5.10/fuzz_pytorch_lightning.py +65 -0
- local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/experimental/SystemSan/PoEs/pytorch-lightning-1.5.10/vuln.dict +1 -0
- local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/experimental/SystemSan/inspect_dns.cpp +236 -0
- local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/experimental/SystemSan/inspect_utils.cpp +73 -0
- local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/experimental/chronos/chronos.sh +81 -0
- local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/experimental/chronos/cloudbuild.yaml +58 -0
- local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/experimental/chronos/cloudbuild_all.yaml +34 -0
- local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/experimental/chronos/e2e-replay-build.sh +63 -0
- local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/experimental/chronos/prepare-ccache +22 -0
- local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/experimental/sanitizers/ExecSan/README.md +3 -0
local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/cifuzz/cifuzz_end_to_end_test.py
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2021 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 |
+
"""End-to-End tests for CIFuzz."""
|
| 15 |
+
import os
|
| 16 |
+
import unittest
|
| 17 |
+
|
| 18 |
+
import run_cifuzz
|
| 19 |
+
import test_helpers
|
| 20 |
+
|
| 21 |
+
CIFUZZ_DIR = os.path.dirname(os.path.abspath(__file__))
|
| 22 |
+
EXTERNAL_PROJECT_PATH = os.path.join(CIFUZZ_DIR, 'test_data',
|
| 23 |
+
'external-project')
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
# This test will fail if not run as root because the fuzzer build process
|
| 27 |
+
# creates binaries that only root can write to.
|
| 28 |
+
# Use a seperate env var to keep this seperate from integration tests which
|
| 29 |
+
# don't have this annoying property.
|
| 30 |
+
@unittest.skipIf(not os.getenv('END_TO_END_TESTS'),
|
| 31 |
+
'END_TO_END_TESTS=1 not set')
|
| 32 |
+
class EndToEndTest(unittest.TestCase):
|
| 33 |
+
"""End-to-End tests for CIFuzz."""
|
| 34 |
+
|
| 35 |
+
def setUp(self):
|
| 36 |
+
test_helpers.patch_environ(self, runner=True)
|
| 37 |
+
|
| 38 |
+
def test_simple(self):
|
| 39 |
+
"""Simple end-to-end test using run_cifuzz.main()."""
|
| 40 |
+
os.environ['REPOSITORY'] = 'external-project'
|
| 41 |
+
os.environ['PROJECT_SRC_PATH'] = EXTERNAL_PROJECT_PATH
|
| 42 |
+
os.environ['FILESTORE'] = 'no_filestore'
|
| 43 |
+
os.environ['NO_CLUSTERFUZZ_DEPLOYMENT'] = 'True'
|
| 44 |
+
|
| 45 |
+
with test_helpers.docker_temp_dir() as temp_dir:
|
| 46 |
+
os.environ['WORKSPACE'] = temp_dir
|
| 47 |
+
# TODO(metzman): Verify the crash, affected fuzzers, and other things.
|
| 48 |
+
self.assertEqual(run_cifuzz.main(), 1)
|
local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/cifuzz/get_coverage_test.py
ADDED
|
@@ -0,0 +1,253 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2021 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 |
+
"""Tests for get_coverage.py"""
|
| 15 |
+
import os
|
| 16 |
+
import json
|
| 17 |
+
import unittest
|
| 18 |
+
from unittest import mock
|
| 19 |
+
|
| 20 |
+
import parameterized
|
| 21 |
+
from pyfakefs import fake_filesystem_unittest
|
| 22 |
+
import pytest
|
| 23 |
+
|
| 24 |
+
import get_coverage
|
| 25 |
+
|
| 26 |
+
# pylint: disable=protected-access
|
| 27 |
+
|
| 28 |
+
TEST_DATA_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)),
|
| 29 |
+
'test_data')
|
| 30 |
+
|
| 31 |
+
PROJECT_NAME = 'curl'
|
| 32 |
+
REPO_PATH = '/src/curl'
|
| 33 |
+
FUZZ_TARGET = 'curl_fuzzer'
|
| 34 |
+
PROJECT_COV_JSON_FILENAME = 'example_curl_cov.json'
|
| 35 |
+
FUZZ_TARGET_COV_JSON_FILENAME = 'example_curl_fuzzer_cov.json'
|
| 36 |
+
INVALID_TARGET = 'not-a-fuzz-target'
|
| 37 |
+
|
| 38 |
+
with open(os.path.join(TEST_DATA_PATH,
|
| 39 |
+
PROJECT_COV_JSON_FILENAME),) as cov_file_handle:
|
| 40 |
+
PROJECT_COV_INFO = json.loads(cov_file_handle.read())
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
class GetOssFuzzFuzzerStatsDirUrlTest(unittest.TestCase):
|
| 44 |
+
"""Tests _get_oss_fuzz_fuzzer_stats_dir_url."""
|
| 45 |
+
|
| 46 |
+
@mock.patch('http_utils.get_json_from_url',
|
| 47 |
+
return_value={
|
| 48 |
+
'fuzzer_stats_dir':
|
| 49 |
+
'gs://oss-fuzz-coverage/systemd/fuzzer_stats/20210303'
|
| 50 |
+
})
|
| 51 |
+
def test_get_valid_project(self, mock_get_json_from_url):
|
| 52 |
+
"""Tests that a project's coverage report can be downloaded and parsed.
|
| 53 |
+
|
| 54 |
+
NOTE: This test relies on the PROJECT_NAME repo's coverage report.
|
| 55 |
+
The "example" project was not used because it has no coverage reports.
|
| 56 |
+
"""
|
| 57 |
+
result = get_coverage._get_oss_fuzz_fuzzer_stats_dir_url(PROJECT_NAME)
|
| 58 |
+
(url,), _ = mock_get_json_from_url.call_args
|
| 59 |
+
self.assertEqual(
|
| 60 |
+
'https://storage.googleapis.com/oss-fuzz-coverage/'
|
| 61 |
+
'latest_report_info/curl.json', url)
|
| 62 |
+
|
| 63 |
+
expected_result = (
|
| 64 |
+
'https://storage.googleapis.com/oss-fuzz-coverage/systemd/fuzzer_stats/'
|
| 65 |
+
'20210303')
|
| 66 |
+
self.assertEqual(result, expected_result)
|
| 67 |
+
|
| 68 |
+
def test_get_invalid_project(self):
|
| 69 |
+
"""Tests that passing a bad project returns None."""
|
| 70 |
+
self.assertIsNone(
|
| 71 |
+
get_coverage._get_oss_fuzz_fuzzer_stats_dir_url('not-a-proj'))
|
| 72 |
+
|
| 73 |
+
|
| 74 |
+
class OSSFuzzCoverageGetTargetCoverageTest(unittest.TestCase):
|
| 75 |
+
"""Tests OSSFuzzCoverage.get_target_coverage."""
|
| 76 |
+
|
| 77 |
+
def setUp(self):
|
| 78 |
+
with mock.patch('get_coverage._get_oss_fuzz_latest_cov_report_info',
|
| 79 |
+
return_value=PROJECT_COV_INFO):
|
| 80 |
+
self.oss_fuzz_coverage = get_coverage.OSSFuzzCoverage(
|
| 81 |
+
REPO_PATH, PROJECT_NAME)
|
| 82 |
+
|
| 83 |
+
@mock.patch('http_utils.get_json_from_url', return_value={})
|
| 84 |
+
def test_valid_target(self, mock_get_json_from_url):
|
| 85 |
+
"""Tests that a target's coverage report can be downloaded and parsed."""
|
| 86 |
+
self.oss_fuzz_coverage.get_target_coverage(FUZZ_TARGET)
|
| 87 |
+
(url,), _ = mock_get_json_from_url.call_args
|
| 88 |
+
self.assertEqual(
|
| 89 |
+
'https://storage.googleapis.com/oss-fuzz-coverage/'
|
| 90 |
+
'curl/fuzzer_stats/20200226/curl_fuzzer.json', url)
|
| 91 |
+
|
| 92 |
+
def test_invalid_target(self):
|
| 93 |
+
"""Tests that passing an invalid target coverage report returns None."""
|
| 94 |
+
self.assertIsNone(
|
| 95 |
+
self.oss_fuzz_coverage.get_target_coverage(INVALID_TARGET))
|
| 96 |
+
|
| 97 |
+
@mock.patch('get_coverage._get_oss_fuzz_latest_cov_report_info',
|
| 98 |
+
return_value=None)
|
| 99 |
+
def test_invalid_project_json(self, _): # pylint: disable=no-self-use
|
| 100 |
+
"""Tests an invalid project JSON results in None being returned."""
|
| 101 |
+
with pytest.raises(get_coverage.CoverageError):
|
| 102 |
+
get_coverage.OSSFuzzCoverage(REPO_PATH, PROJECT_NAME)
|
| 103 |
+
|
| 104 |
+
|
| 105 |
+
def _get_expected_curl_covered_file_list():
|
| 106 |
+
"""Returns the expected covered file list for
|
| 107 |
+
FUZZ_TARGET_COV_JSON_FILENAME."""
|
| 108 |
+
curl_files_list_path = os.path.join(TEST_DATA_PATH,
|
| 109 |
+
'example_curl_file_list.json')
|
| 110 |
+
with open(curl_files_list_path) as file_handle:
|
| 111 |
+
return json.loads(file_handle.read())
|
| 112 |
+
|
| 113 |
+
|
| 114 |
+
def _get_example_curl_coverage():
|
| 115 |
+
"""Returns the contents of the fuzzer stats JSON file for
|
| 116 |
+
FUZZ_TARGET_COV_JSON_FILENAME."""
|
| 117 |
+
with open(os.path.join(TEST_DATA_PATH,
|
| 118 |
+
FUZZ_TARGET_COV_JSON_FILENAME)) as file_handle:
|
| 119 |
+
return json.loads(file_handle.read())
|
| 120 |
+
|
| 121 |
+
|
| 122 |
+
class OSSFuzzCoverageGetFilesCoveredByTargetTest(unittest.TestCase):
|
| 123 |
+
"""Tests OSSFuzzCoverage.get_files_covered_by_target."""
|
| 124 |
+
|
| 125 |
+
def setUp(self):
|
| 126 |
+
with mock.patch('get_coverage._get_oss_fuzz_latest_cov_report_info',
|
| 127 |
+
return_value=PROJECT_COV_INFO):
|
| 128 |
+
self.oss_fuzz_coverage = get_coverage.OSSFuzzCoverage(
|
| 129 |
+
REPO_PATH, PROJECT_NAME)
|
| 130 |
+
|
| 131 |
+
@parameterized.parameterized.expand([({
|
| 132 |
+
'data': []
|
| 133 |
+
},), ({
|
| 134 |
+
'data': [[]]
|
| 135 |
+
},), ({
|
| 136 |
+
'data': [{}]
|
| 137 |
+
},)])
|
| 138 |
+
def test_malformed_cov_data(self, coverage_data):
|
| 139 |
+
"""Tests that covered files can be retrieved from a coverage report."""
|
| 140 |
+
with mock.patch('get_coverage.OSSFuzzCoverage.get_target_coverage',
|
| 141 |
+
return_value=coverage_data):
|
| 142 |
+
self.oss_fuzz_coverage.get_files_covered_by_target(FUZZ_TARGET)
|
| 143 |
+
|
| 144 |
+
def test_valid_target(self):
|
| 145 |
+
"""Tests that covered files can be retrieved from a coverage report."""
|
| 146 |
+
fuzzer_cov_data = _get_example_curl_coverage()
|
| 147 |
+
with mock.patch('get_coverage.OSSFuzzCoverage.get_target_coverage',
|
| 148 |
+
return_value=fuzzer_cov_data):
|
| 149 |
+
file_list = self.oss_fuzz_coverage.get_files_covered_by_target(
|
| 150 |
+
FUZZ_TARGET)
|
| 151 |
+
|
| 152 |
+
expected_file_list = _get_expected_curl_covered_file_list()
|
| 153 |
+
self.assertCountEqual(file_list, expected_file_list)
|
| 154 |
+
|
| 155 |
+
def test_invalid_target(self):
|
| 156 |
+
"""Tests passing invalid fuzz target returns None."""
|
| 157 |
+
self.assertIsNone(
|
| 158 |
+
self.oss_fuzz_coverage.get_files_covered_by_target(INVALID_TARGET))
|
| 159 |
+
|
| 160 |
+
|
| 161 |
+
class FilesystemCoverageGetFilesCoveredByTargetTest(
|
| 162 |
+
fake_filesystem_unittest.TestCase):
|
| 163 |
+
"""Tests FilesystemCoverage.get_files_covered_by_target."""
|
| 164 |
+
|
| 165 |
+
def setUp(self):
|
| 166 |
+
_fuzzer_cov_data = _get_example_curl_coverage()
|
| 167 |
+
self._expected_file_list = _get_expected_curl_covered_file_list()
|
| 168 |
+
self.coverage_path = '/coverage'
|
| 169 |
+
self.filesystem_coverage = get_coverage.FilesystemCoverage(
|
| 170 |
+
REPO_PATH, self.coverage_path)
|
| 171 |
+
self.setUpPyfakefs()
|
| 172 |
+
self.fs.create_file(os.path.join(self.coverage_path, 'fuzzer_stats',
|
| 173 |
+
FUZZ_TARGET + '.json'),
|
| 174 |
+
contents=json.dumps(_fuzzer_cov_data))
|
| 175 |
+
|
| 176 |
+
def test_valid_target(self):
|
| 177 |
+
"""Tests that covered files can be retrieved from a coverage report."""
|
| 178 |
+
file_list = self.filesystem_coverage.get_files_covered_by_target(
|
| 179 |
+
FUZZ_TARGET)
|
| 180 |
+
self.assertCountEqual(file_list, self._expected_file_list)
|
| 181 |
+
|
| 182 |
+
def test_invalid_target(self):
|
| 183 |
+
"""Tests passing invalid fuzz target returns None."""
|
| 184 |
+
self.assertIsNone(
|
| 185 |
+
self.filesystem_coverage.get_files_covered_by_target(INVALID_TARGET))
|
| 186 |
+
|
| 187 |
+
|
| 188 |
+
class IsFileCoveredTest(unittest.TestCase):
|
| 189 |
+
"""Tests for is_file_covered."""
|
| 190 |
+
|
| 191 |
+
def test_is_file_covered_covered(self):
|
| 192 |
+
"""Tests that is_file_covered returns True for a covered file."""
|
| 193 |
+
file_coverage = {
|
| 194 |
+
'filename': '/src/systemd/src/basic/locale-util.c',
|
| 195 |
+
'summary': {
|
| 196 |
+
'regions': {
|
| 197 |
+
'count': 204,
|
| 198 |
+
'covered': 200,
|
| 199 |
+
'notcovered': 200,
|
| 200 |
+
'percent': 98.03
|
| 201 |
+
}
|
| 202 |
+
}
|
| 203 |
+
}
|
| 204 |
+
self.assertTrue(get_coverage.is_file_covered(file_coverage))
|
| 205 |
+
|
| 206 |
+
def test_is_file_covered_not_covered(self):
|
| 207 |
+
"""Tests that is_file_covered returns False for a not covered file."""
|
| 208 |
+
file_coverage = {
|
| 209 |
+
'filename': '/src/systemd/src/basic/locale-util.c',
|
| 210 |
+
'summary': {
|
| 211 |
+
'regions': {
|
| 212 |
+
'count': 204,
|
| 213 |
+
'covered': 0,
|
| 214 |
+
'notcovered': 0,
|
| 215 |
+
'percent': 0
|
| 216 |
+
}
|
| 217 |
+
}
|
| 218 |
+
}
|
| 219 |
+
self.assertFalse(get_coverage.is_file_covered(file_coverage))
|
| 220 |
+
|
| 221 |
+
|
| 222 |
+
class GetOssFuzzLatestCovReportInfo(unittest.TestCase):
|
| 223 |
+
"""Tests that _get_oss_fuzz_latest_cov_report_info works as
|
| 224 |
+
intended."""
|
| 225 |
+
|
| 226 |
+
PROJECT = 'project'
|
| 227 |
+
LATEST_REPORT_INFO_URL = ('https://storage.googleapis.com/oss-fuzz-coverage/'
|
| 228 |
+
'latest_report_info/project.json')
|
| 229 |
+
|
| 230 |
+
@mock.patch('logging.error')
|
| 231 |
+
@mock.patch('http_utils.get_json_from_url', return_value={'coverage': 1})
|
| 232 |
+
def test_get_oss_fuzz_latest_cov_report_info(self, mock_get_json_from_url,
|
| 233 |
+
mock_error):
|
| 234 |
+
"""Tests that _get_oss_fuzz_latest_cov_report_info works as intended."""
|
| 235 |
+
result = get_coverage._get_oss_fuzz_latest_cov_report_info(self.PROJECT)
|
| 236 |
+
self.assertEqual(result, {'coverage': 1})
|
| 237 |
+
mock_error.assert_not_called()
|
| 238 |
+
mock_get_json_from_url.assert_called_with(self.LATEST_REPORT_INFO_URL)
|
| 239 |
+
|
| 240 |
+
@mock.patch('logging.error')
|
| 241 |
+
@mock.patch('http_utils.get_json_from_url', return_value=None)
|
| 242 |
+
def test_get_oss_fuzz_latest_cov_report_info_fail(self, _, mock_error):
|
| 243 |
+
"""Tests that _get_oss_fuzz_latest_cov_report_info works as intended when we
|
| 244 |
+
can't get latest report info."""
|
| 245 |
+
result = get_coverage._get_oss_fuzz_latest_cov_report_info('project')
|
| 246 |
+
self.assertIsNone(result)
|
| 247 |
+
mock_error.assert_called_with(
|
| 248 |
+
'Could not get the coverage report json from url: %s.',
|
| 249 |
+
self.LATEST_REPORT_INFO_URL)
|
| 250 |
+
|
| 251 |
+
|
| 252 |
+
if __name__ == '__main__':
|
| 253 |
+
unittest.main()
|
local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/cifuzz/platform_config/gitlab.py
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2022 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 |
+
"""Module for getting the configuration CIFuzz needs to run on GitLab."""
|
| 15 |
+
import logging
|
| 16 |
+
import os
|
| 17 |
+
|
| 18 |
+
import environment
|
| 19 |
+
import platform_config
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
class PlatformConfig(platform_config.BasePlatformConfig):
|
| 23 |
+
"""CI environment for GitLab."""
|
| 24 |
+
|
| 25 |
+
@property
|
| 26 |
+
def workspace(self):
|
| 27 |
+
"""Returns the workspace."""
|
| 28 |
+
return os.path.join(os.getenv('CI_BUILDS_DIR'), os.getenv('CI_JOB_ID'))
|
| 29 |
+
|
| 30 |
+
@property
|
| 31 |
+
def git_sha(self):
|
| 32 |
+
"""Returns the Git SHA to checkout and fuzz."""
|
| 33 |
+
return os.getenv('CI_COMMIT_SHA')
|
| 34 |
+
|
| 35 |
+
@property
|
| 36 |
+
def project_src_path(self):
|
| 37 |
+
"""Returns the directory with the source of the project"""
|
| 38 |
+
return os.getenv('CI_PROJECT_DIR')
|
| 39 |
+
|
| 40 |
+
@property
|
| 41 |
+
def token(self):
|
| 42 |
+
"""Returns the job token"""
|
| 43 |
+
return os.getenv('CI_JOB_TOKEN')
|
| 44 |
+
|
| 45 |
+
@property
|
| 46 |
+
def project_repo_name(self):
|
| 47 |
+
"""Returns the project's name"""
|
| 48 |
+
return os.getenv('CI_PROJECT_NAME')
|
| 49 |
+
|
| 50 |
+
@property
|
| 51 |
+
def base_commit(self):
|
| 52 |
+
"""Returns the previous commit sha for commit-fuzzing"""
|
| 53 |
+
base_commit = None
|
| 54 |
+
if os.getenv('CI_PIPELINE_SOURCE') == 'push':
|
| 55 |
+
base_commit = os.getenv('CI_COMMIT_BEFORE_SHA')
|
| 56 |
+
logging.debug('base_commit: %s.', base_commit)
|
| 57 |
+
return base_commit
|
| 58 |
+
|
| 59 |
+
@property
|
| 60 |
+
def base_ref(self):
|
| 61 |
+
"""Returns the base commit sha for a merge request"""
|
| 62 |
+
# Could also be CI_MERGE_REQUEST_TARGET_BRANCH_NAME.
|
| 63 |
+
return os.getenv('CI_MERGE_REQUEST_DIFF_BASE_SHA')
|
| 64 |
+
|
| 65 |
+
@property
|
| 66 |
+
def filestore(self):
|
| 67 |
+
"""Returns the filestore used to store persistent data."""
|
| 68 |
+
return os.environ.get('FILESTORE', 'gitlab')
|
| 69 |
+
|
| 70 |
+
@property
|
| 71 |
+
def artifacts_dir(self):
|
| 72 |
+
"""Gitlab: returns the directory to put artifacts"""
|
| 73 |
+
return environment.get('CFL_ARTIFACTS_DIR', 'artifacts')
|
| 74 |
+
|
| 75 |
+
@property
|
| 76 |
+
def cache_dir(self):
|
| 77 |
+
"""Gitlab: returns the directory to use as cache"""
|
| 78 |
+
return environment.get('CFL_CACHE_DIR', 'cache')
|
local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/cifuzz/platform_config/standalone.py
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2022 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 |
+
"""Module for getting the configuration CIFuzz needs to run standalone."""
|
| 15 |
+
import os
|
| 16 |
+
|
| 17 |
+
import platform_config
|
| 18 |
+
|
| 19 |
+
# pylint: disable=too-few-public-methods
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
class PlatformConfig(platform_config.BasePlatformConfig):
|
| 23 |
+
"""CI environment for Standalone."""
|
| 24 |
+
|
| 25 |
+
@property
|
| 26 |
+
def filestore(self):
|
| 27 |
+
"""Returns the filestore used to store persistent data."""
|
| 28 |
+
return os.environ.get('FILESTORE', 'filesystem')
|
| 29 |
+
|
| 30 |
+
@property
|
| 31 |
+
def filestore_root_dir(self):
|
| 32 |
+
"""Returns the filestore used to store persistent data."""
|
| 33 |
+
return os.environ['FILESTORE_ROOT_DIR']
|
local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/cifuzz/test_data/example_crash_fuzzer_bug_summary.txt
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
AddressSanitizer: heap-buffer-overflow on address 0x62500001b530 at pc 0x00000052138a bp 0x7ffe62db2c10 sp 0x7ffe62db23d8
|
| 2 |
+
READ of size 52 at 0x62500001b530 thread T0
|
| 3 |
+
SCARINESS: 26 (multi-byte-read-heap-buffer-overflow)
|
| 4 |
+
#0 0x521389 in __asan_memcpy /src/llvm-project/compiler-rt/lib/asan/asan_interceptors_memintrinsics.cpp:22:3
|
| 5 |
+
#1 0x567590 in yr_object_set_string /src/yara/libyara/object.c:1122:5
|
| 6 |
+
#2 0x5afced in dex_parse /src/yara/libyara/modules/dex/dex.c:781:5
|
| 7 |
+
#3 0x5b4a8b in dex__load /src/yara/libyara/modules/dex/dex.c:1218:7
|
| 8 |
+
#4 0x56537c in yr_modules_load /src/yara/libyara/modules.c:179:16
|
| 9 |
+
#5 0x5d6583 in yr_execute_code /src/yara/libyara/exec.c:1276:18
|
| 10 |
+
#6 0x56f5c0 in yr_scanner_scan_mem_blocks /src/yara/libyara/scanner.c:444:3
|
| 11 |
+
#7 0x56bf23 in yr_rules_scan_mem_blocks /src/yara/libyara/rules.c:235:12
|
| 12 |
+
#8 0x56c182 in yr_rules_scan_mem /src/yara/libyara/rules.c:285:10
|
| 13 |
+
#9 0x5548d2 in LLVMFuzzerTestOneInput /src/yara/tests/oss-fuzz/dex_fuzzer.cc:40:3
|
| 14 |
+
#10 0x45a3b1 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:556:15
|
| 15 |
+
#11 0x459ad5 in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool*) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:470:3
|
| 16 |
+
#12 0x45be77 in fuzzer::Fuzzer::MutateAndTestOne() /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:698:19
|
| 17 |
+
#13 0x45cc05 in fuzzer::Fuzzer::Loop(std::__Fuzzer::vector<fuzzer::SizedFile, fuzzer::fuzzer_allocator<fuzzer::SizedFile> >&) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:830:5
|
| 18 |
+
#14 0x44ac88 in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:824:6
|
| 19 |
+
#15 0x474ab2 in main /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerMain.cpp:19:10
|
| 20 |
+
#16 0x7f4409b7a82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
|
| 21 |
+
#17 0x41e348 in _start (out/dex_fuzzer+0x41e348)
|
| 22 |
+
|
| 23 |
+
0x62500001b530 is located 0 bytes to the right of 9264-byte region [0x625000019100,0x62500001b530)
|
| 24 |
+
allocated by thread T0 here:
|
| 25 |
+
#0 0x521f4d in malloc /src/llvm-project/compiler-rt/lib/asan/asan_malloc_linux.cpp:145:3
|
| 26 |
+
#1 0x4331b7 in operator new(unsigned long) (out/dex_fuzzer+0x4331b7)
|
| 27 |
+
#2 0x459ad5 in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool*) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:470:3
|
| 28 |
+
#3 0x45be77 in fuzzer::Fuzzer::MutateAndTestOne() /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:698:19
|
| 29 |
+
#4 0x45cc05 in fuzzer::Fuzzer::Loop(std::__Fuzzer::vector<fuzzer::SizedFile, fuzzer::fuzzer_allocator<fuzzer::SizedFile> >&) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:830:5
|
| 30 |
+
#5 0x44ac88 in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:824:6
|
| 31 |
+
#6 0x474ab2 in main /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerMain.cpp:19:10
|
| 32 |
+
#7 0x7f4409b7a82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
|
| 33 |
+
|
| 34 |
+
SUMMARY: AddressSanitizer: heap-buffer-overflow /src/llvm-project/compiler-rt/lib/asan/asan_interceptors_memintrinsics.cpp:22:3 in __asan_memcpy
|
| 35 |
+
Shadow bytes around the buggy address:
|
| 36 |
+
0x0c4a7fffb650: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
| 37 |
+
0x0c4a7fffb660: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
| 38 |
+
0x0c4a7fffb670: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
| 39 |
+
0x0c4a7fffb680: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
| 40 |
+
0x0c4a7fffb690: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
| 41 |
+
=>0x0c4a7fffb6a0: 00 00 00 00 00 00[fa]fa fa fa fa fa fa fa fa fa
|
| 42 |
+
0x0c4a7fffb6b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
| 43 |
+
0x0c4a7fffb6c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
| 44 |
+
0x0c4a7fffb6d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
| 45 |
+
0x0c4a7fffb6e0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
| 46 |
+
0x0c4a7fffb6f0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
| 47 |
+
|
| 48 |
+
Shadow byte legend (one shadow byte represents 8 application bytes):
|
| 49 |
+
Addressable: 00
|
| 50 |
+
Partially addressable: 01 02 03 04 05 06 07
|
| 51 |
+
Heap left redzone: fa
|
| 52 |
+
Freed heap region: fd
|
| 53 |
+
Stack left redzone: f1
|
| 54 |
+
Stack mid redzone: f2
|
| 55 |
+
Stack right redzone: f3
|
| 56 |
+
Stack after return: f5
|
| 57 |
+
Stack use after scope: f8
|
| 58 |
+
Global redzone: f9
|
| 59 |
+
Global init order: f6
|
| 60 |
+
Poisoned by user: f7
|
| 61 |
+
Container overflow: fc
|
| 62 |
+
Array cookie: ac
|
| 63 |
+
Intra object redzone: bb
|
| 64 |
+
ASan internal: fe
|
| 65 |
+
Left alloca redzone: ca
|
| 66 |
+
Right alloca redzone: cb
|
| 67 |
+
Shadow gap: cc
|
| 68 |
+
==12==ABORTING
|
local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/experimental/SystemSan/PoEs/node-shell-quote-v1.7.3/Dockerfile
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2022 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 |
+
# Build and run the proof of error in shell-quote v1.7.3.
|
| 16 |
+
|
| 17 |
+
FROM ghcr.io/aixcc-finals/base-builder
|
| 18 |
+
|
| 19 |
+
RUN apt update && \
|
| 20 |
+
apt install -y \
|
| 21 |
+
vim \
|
| 22 |
+
npm && \
|
| 23 |
+
git clone \
|
| 24 |
+
--depth 1 \
|
| 25 |
+
https://github.com/substack/node-shell-quote.git && \
|
| 26 |
+
npm config set @gitlab-org:registry \
|
| 27 |
+
https://gitlab.com/api/v4/packages/npm/
|
| 28 |
+
|
| 29 |
+
COPY ./build.sh $SRC
|
| 30 |
+
RUN ./build.sh
|
| 31 |
+
|
| 32 |
+
COPY . $SRC
|
| 33 |
+
RUN make SystemSan
|
| 34 |
+
|
| 35 |
+
CMD ["make", "run"]
|
local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/experimental/SystemSan/PoEs/node-shell-quote-v1.7.3/build.sh
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
npm install ./node-shell-quote/
|
| 20 |
+
|
| 21 |
+
# Build fuzzers.
|
| 22 |
+
npm i -g @gitlab-org/jsfuzz
|
local-test-commons-compress-full-01-vuln_2/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-commons-compress-full-01-vuln_2/fuzz-tooling/infra/experimental/SystemSan/PoEs/pytorch-lightning-1.5.10/Dockerfile
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2022 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 |
+
# Build and run the proof of error in pytorch-lightning.
|
| 16 |
+
|
| 17 |
+
FROM ghcr.io/aixcc-finals/base-builder-python
|
| 18 |
+
|
| 19 |
+
RUN apt update && \
|
| 20 |
+
apt install -y vim && \
|
| 21 |
+
git clone \
|
| 22 |
+
--depth 1 \
|
| 23 |
+
--branch 1.5.10 \
|
| 24 |
+
https://github.com/PyTorchLightning/pytorch-lightning.git
|
| 25 |
+
|
| 26 |
+
COPY ./build.sh $SRC
|
| 27 |
+
RUN ./build.sh
|
| 28 |
+
|
| 29 |
+
COPY . $SRC
|
| 30 |
+
RUN make SystemSan
|
| 31 |
+
|
| 32 |
+
CMD ["make", "run"]
|
local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/experimental/SystemSan/PoEs/pytorch-lightning-1.5.10/Makefile
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
.POSIX:
|
| 2 |
+
CXX = clang++
|
| 3 |
+
CFLAGS = -std=c++17 -Wall -Wextra -O3 -g3
|
| 4 |
+
|
| 5 |
+
SystemSan: SystemSan.cpp
|
| 6 |
+
$(CXX) $(CFLAGS) -lpthread -o $@ $^
|
| 7 |
+
|
| 8 |
+
run: clean SystemSan fuzz_pytorch_lightning.py
|
| 9 |
+
./SystemSan ./fuzz_pytorch_lightning.py -dict=vuln.dict
|
| 10 |
+
|
| 11 |
+
clean:
|
| 12 |
+
rm -f SystemSan /tmp/tripwire
|
local-test-commons-compress-full-01-vuln_2/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-commons-compress-full-01-vuln_2/fuzz-tooling/infra/experimental/SystemSan/PoEs/pytorch-lightning-1.5.10/vuln.dict
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
"os.system('/tmp/tripwire')"
|
local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/experimental/SystemSan/inspect_dns.cpp
ADDED
|
@@ -0,0 +1,236 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
/* POSIX */
|
| 19 |
+
#include <sys/user.h>
|
| 20 |
+
#include <unistd.h>
|
| 21 |
+
|
| 22 |
+
/* Linux */
|
| 23 |
+
#include <arpa/inet.h>
|
| 24 |
+
#include <syscall.h>
|
| 25 |
+
#include <sys/ptrace.h>
|
| 26 |
+
|
| 27 |
+
#include <iostream>
|
| 28 |
+
|
| 29 |
+
#include "inspect_utils.h"
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
// Arbitrary domain name resolution.
|
| 33 |
+
const std::string kArbitraryDomainNameResolution = "Arbitrary domain name resolution";
|
| 34 |
+
|
| 35 |
+
// Global constant for one file descriptor about of a DNS socket
|
| 36 |
+
int kFdDns = 0;
|
| 37 |
+
const size_t kDnsHeaderLen = 12;
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
void inspect_for_arbitrary_dns_connect(pid_t pid, const user_regs_struct ®s) {
|
| 41 |
+
auto memory = read_memory(pid, regs.rsi, sizeof(struct sockaddr_in));
|
| 42 |
+
if (memory.size()) {
|
| 43 |
+
struct sockaddr_in * sa = reinterpret_cast<struct sockaddr_in *>(memory.data());
|
| 44 |
+
if (sa->sin_family == AF_INET && htons(sa->sin_port) == 53) {
|
| 45 |
+
// save file descriptor for later sendmmsg
|
| 46 |
+
kFdDns = regs.rdi;
|
| 47 |
+
}
|
| 48 |
+
}
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
struct DnsHeader {
|
| 52 |
+
uint16_t tx_id;
|
| 53 |
+
uint16_t flags;
|
| 54 |
+
uint16_t questions;
|
| 55 |
+
uint16_t answers;
|
| 56 |
+
uint16_t nameservers;
|
| 57 |
+
uint16_t additional;
|
| 58 |
+
};
|
| 59 |
+
|
| 60 |
+
struct DnsHeader parse_dns_header(std::vector<std::byte> data) {
|
| 61 |
+
struct DnsHeader h;
|
| 62 |
+
h.tx_id = (((uint16_t) data[0]) << 8) | ((uint16_t) data[1]);
|
| 63 |
+
h.flags = (((uint16_t) data[2]) << 8) | ((uint16_t) data[3]);
|
| 64 |
+
h.questions = (((uint16_t) data[4]) << 8) | ((uint16_t) data[5]);
|
| 65 |
+
h.answers = (((uint16_t) data[6]) << 8) | ((uint16_t) data[7]);
|
| 66 |
+
h.nameservers = (((uint16_t) data[8]) << 8) | ((uint16_t) data[9]);
|
| 67 |
+
h.additional = (((uint16_t) data[10]) << 8) | ((uint16_t) data[11]);
|
| 68 |
+
return h;
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
bool dns_flags_standard_query(uint16_t flags) {
|
| 72 |
+
if ((flags & 0x8000) == 0) {
|
| 73 |
+
// Query, not response.
|
| 74 |
+
if (((flags & 0x7800) >> 11) == 0) {
|
| 75 |
+
// Opcode 0 is standard query.
|
| 76 |
+
if ((flags & 0x0200) == 0) {
|
| 77 |
+
// Message is not truncated.
|
| 78 |
+
if ((flags & 0x0040) == 0) {
|
| 79 |
+
// Z-bit reserved flag is unset.
|
| 80 |
+
return true;
|
| 81 |
+
}
|
| 82 |
+
}
|
| 83 |
+
}
|
| 84 |
+
}
|
| 85 |
+
return false;
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
struct DnsRequest {
|
| 89 |
+
// Start of name in the byte vector.
|
| 90 |
+
size_t offset;
|
| 91 |
+
// End of name in the byte vector.
|
| 92 |
+
size_t end;
|
| 93 |
+
// Length of top level domain.
|
| 94 |
+
uint8_t tld_size;
|
| 95 |
+
// Number of levels/dots in domain name.
|
| 96 |
+
size_t nb_levels;
|
| 97 |
+
// DNS type like A is 1.
|
| 98 |
+
uint16_t dns_type;
|
| 99 |
+
// DNS class like IN is 1.
|
| 100 |
+
uint16_t dns_class;
|
| 101 |
+
};
|
| 102 |
+
|
| 103 |
+
struct DnsRequest parse_dns_request(std::vector<std::byte> data, size_t offset) {
|
| 104 |
+
struct DnsRequest r;
|
| 105 |
+
r.offset = offset;
|
| 106 |
+
r.tld_size = 0;
|
| 107 |
+
r.nb_levels = 0;
|
| 108 |
+
while(offset < data.size()) {
|
| 109 |
+
uint8_t rlen = uint8_t(data[offset]);
|
| 110 |
+
if (rlen == 0) {
|
| 111 |
+
offset++;
|
| 112 |
+
break;
|
| 113 |
+
}
|
| 114 |
+
r.nb_levels++;
|
| 115 |
+
offset += rlen+1;
|
| 116 |
+
r.tld_size = rlen;
|
| 117 |
+
}
|
| 118 |
+
if (offset <= 4 + data.size()) {
|
| 119 |
+
r.end = offset;
|
| 120 |
+
r.dns_type = (((uint16_t) data[offset]) << 8) | ((uint16_t) data[offset+1]);
|
| 121 |
+
r.dns_class = (((uint16_t) data[offset+2]) << 8) | ((uint16_t) data[offset+3]);
|
| 122 |
+
} else {
|
| 123 |
+
r.end = data.size();
|
| 124 |
+
}
|
| 125 |
+
return r;
|
| 126 |
+
}
|
| 127 |
+
|
| 128 |
+
void log_dns_request(struct DnsRequest r, std::vector<std::byte> data) {
|
| 129 |
+
size_t offset = r.offset;
|
| 130 |
+
std::cerr << "===Domain resolved: ";
|
| 131 |
+
while(offset < r.end) {
|
| 132 |
+
uint8_t rlen = uint8_t(data[offset]);
|
| 133 |
+
if (rlen == 0) {
|
| 134 |
+
break;
|
| 135 |
+
}
|
| 136 |
+
std::cerr << '.';
|
| 137 |
+
for (uint8_t i = 1; i < rlen+1; i++) {
|
| 138 |
+
std::cerr << (char) data[offset + i];
|
| 139 |
+
}
|
| 140 |
+
offset += rlen+1;
|
| 141 |
+
}
|
| 142 |
+
std::cerr << "===\n";
|
| 143 |
+
std::cerr << "===DNS request type: " << r.dns_type << ", class: " << r.dns_class << "===\n";
|
| 144 |
+
}
|
| 145 |
+
|
| 146 |
+
void inspect_for_arbitrary_dns_pkt(std::vector<std::byte> data, pid_t pid) {
|
| 147 |
+
if (data.size() < kDnsHeaderLen + 1) {
|
| 148 |
+
return;
|
| 149 |
+
}
|
| 150 |
+
struct DnsHeader h = parse_dns_header(data);
|
| 151 |
+
if (h.questions != 1) {
|
| 152 |
+
return;
|
| 153 |
+
}
|
| 154 |
+
if (h.answers != 0 || h.nameservers != 0) {
|
| 155 |
+
return;
|
| 156 |
+
}
|
| 157 |
+
if (!dns_flags_standard_query(h.flags)) {
|
| 158 |
+
return;
|
| 159 |
+
}
|
| 160 |
+
|
| 161 |
+
struct DnsRequest req = parse_dns_request(data, kDnsHeaderLen);
|
| 162 |
+
// Alert if the top level domain is only one character and
|
| 163 |
+
// if there is more than just the TLD.
|
| 164 |
+
if (req.tld_size == 1 && req.nb_levels > 1 && req.end < data.size()) {
|
| 165 |
+
report_bug(kArbitraryDomainNameResolution, pid);
|
| 166 |
+
log_dns_request(req, data);
|
| 167 |
+
}
|
| 168 |
+
}
|
| 169 |
+
|
| 170 |
+
void inspect_for_arbitrary_dns_fdbuffer(pid_t pid, const user_regs_struct ®s) {
|
| 171 |
+
if (kFdDns > 0 && kFdDns == (int) regs.rdi) {
|
| 172 |
+
auto memory = read_memory(pid, regs.rsi, regs.rdx);
|
| 173 |
+
if (memory.size()) {
|
| 174 |
+
inspect_for_arbitrary_dns_pkt(memory, pid);
|
| 175 |
+
}
|
| 176 |
+
}
|
| 177 |
+
}
|
| 178 |
+
|
| 179 |
+
void inspect_for_arbitrary_dns_iov(pid_t pid, unsigned long iov) {
|
| 180 |
+
auto memory = read_memory(pid, iov, sizeof(struct iovec));
|
| 181 |
+
if (memory.size()) {
|
| 182 |
+
struct iovec * iovec = reinterpret_cast<struct iovec *>(memory.data());
|
| 183 |
+
memory = read_memory(pid, (unsigned long) iovec->iov_base, iovec->iov_len);
|
| 184 |
+
if (memory.size()) {
|
| 185 |
+
inspect_for_arbitrary_dns_pkt(memory, pid);
|
| 186 |
+
}
|
| 187 |
+
}
|
| 188 |
+
}
|
| 189 |
+
|
| 190 |
+
void inspect_for_arbitrary_dns_sendmsg(pid_t pid, const user_regs_struct ®s) {
|
| 191 |
+
if (kFdDns > 0 && kFdDns == (int) regs.rdi) {
|
| 192 |
+
auto memory = read_memory(pid, regs.rsi, sizeof(struct msghdr));
|
| 193 |
+
if (memory.size()) {
|
| 194 |
+
struct msghdr * msg = reinterpret_cast<struct msghdr *>(memory.data());
|
| 195 |
+
if (msg->msg_iovlen == 1) {
|
| 196 |
+
inspect_for_arbitrary_dns_iov(pid, (unsigned long) msg->msg_iov);
|
| 197 |
+
}
|
| 198 |
+
}
|
| 199 |
+
}
|
| 200 |
+
}
|
| 201 |
+
|
| 202 |
+
void inspect_for_arbitrary_dns_sendmmsg(pid_t pid, const user_regs_struct ®s) {
|
| 203 |
+
if (kFdDns > 0 && kFdDns == (int) regs.rdi) {
|
| 204 |
+
auto memory = read_memory(pid, regs.rsi, sizeof(struct mmsghdr));
|
| 205 |
+
if (memory.size()) {
|
| 206 |
+
struct mmsghdr * msg = reinterpret_cast<struct mmsghdr *>(memory.data());
|
| 207 |
+
if (msg->msg_hdr.msg_iovlen == 1) {
|
| 208 |
+
inspect_for_arbitrary_dns_iov(pid, (unsigned long) msg->msg_hdr.msg_iov);
|
| 209 |
+
}
|
| 210 |
+
}
|
| 211 |
+
}
|
| 212 |
+
}
|
| 213 |
+
|
| 214 |
+
void inspect_dns_syscalls(pid_t pid, const user_regs_struct ®s) {
|
| 215 |
+
switch (regs.orig_rax) {
|
| 216 |
+
case __NR_connect:
|
| 217 |
+
inspect_for_arbitrary_dns_connect(pid, regs);
|
| 218 |
+
break;
|
| 219 |
+
case __NR_close:
|
| 220 |
+
if (kFdDns > 0 && kFdDns == (int) regs.rdi) {
|
| 221 |
+
// reset DNS file descriptor on close
|
| 222 |
+
kFdDns = 0;
|
| 223 |
+
}
|
| 224 |
+
break;
|
| 225 |
+
case __NR_sendmmsg:
|
| 226 |
+
inspect_for_arbitrary_dns_sendmmsg(pid, regs);
|
| 227 |
+
break;
|
| 228 |
+
case __NR_sendmsg:
|
| 229 |
+
inspect_for_arbitrary_dns_sendmsg(pid, regs);
|
| 230 |
+
break;
|
| 231 |
+
case __NR_sendto:
|
| 232 |
+
// fallthrough
|
| 233 |
+
case __NR_write:
|
| 234 |
+
inspect_for_arbitrary_dns_fdbuffer(pid, regs);
|
| 235 |
+
}
|
| 236 |
+
}
|
local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/experimental/SystemSan/inspect_utils.cpp
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 DNS arbitrary resolutions. */
|
| 17 |
+
|
| 18 |
+
/* C standard library */
|
| 19 |
+
#include <signal.h>
|
| 20 |
+
|
| 21 |
+
/* POSIX */
|
| 22 |
+
#include <unistd.h>
|
| 23 |
+
|
| 24 |
+
/* Linux */
|
| 25 |
+
#include <sys/ptrace.h>
|
| 26 |
+
|
| 27 |
+
#include <iostream>
|
| 28 |
+
#include <string>
|
| 29 |
+
#include <vector>
|
| 30 |
+
#include <map>
|
| 31 |
+
|
| 32 |
+
#include "inspect_utils.h"
|
| 33 |
+
|
| 34 |
+
extern pid_t g_root_pid;
|
| 35 |
+
extern std::map<pid_t, ThreadParent> root_pids;
|
| 36 |
+
|
| 37 |
+
std::vector<std::byte> read_memory(pid_t pid, unsigned long long address,
|
| 38 |
+
size_t size) {
|
| 39 |
+
std::vector<std::byte> memory;
|
| 40 |
+
|
| 41 |
+
for (size_t i = 0; i < size; i += sizeof(long)) {
|
| 42 |
+
long word = ptrace(PTRACE_PEEKTEXT, pid, address + i, 0);
|
| 43 |
+
if (word == -1) {
|
| 44 |
+
return memory;
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
std::byte *word_bytes = reinterpret_cast<std::byte *>(&word);
|
| 48 |
+
memory.insert(memory.end(), word_bytes, word_bytes + sizeof(long));
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
return memory;
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
void report_bug(std::string bug_type, pid_t tid) {
|
| 55 |
+
// Report the bug found based on the bug code.
|
| 56 |
+
std::cerr << "===BUG DETECTED: " << bug_type.c_str() << "===\n";
|
| 57 |
+
// Rely on sanitizers/libFuzzer to produce a stacktrace by sending SIGABRT
|
| 58 |
+
// to the root process.
|
| 59 |
+
// Note: this may not be reliable or consistent if shell injection happens
|
| 60 |
+
// in an async way.
|
| 61 |
+
// Find the thread group id, that is the pid.
|
| 62 |
+
pid_t pid = tid;
|
| 63 |
+
auto parent = root_pids[tid];
|
| 64 |
+
while (!parent.ran_exec) {
|
| 65 |
+
// Find the first parent which ran exec syscall.
|
| 66 |
+
if (parent.parent_tid == g_root_pid) {
|
| 67 |
+
break;
|
| 68 |
+
}
|
| 69 |
+
pid = parent.parent_tid;
|
| 70 |
+
parent = root_pids[parent.parent_tid];
|
| 71 |
+
}
|
| 72 |
+
tgkill(pid, tid, SIGABRT);
|
| 73 |
+
}
|
local-test-commons-compress-full-01-vuln_2/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-commons-compress-full-01-vuln_2/fuzz-tooling/infra/experimental/chronos/cloudbuild.yaml
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
# Supports building by way of ccache now.
|
| 18 |
+
# High-level steps:
|
| 19 |
+
# 1) Build image for project
|
| 20 |
+
# 2) Run an ASAN build and store ccache
|
| 21 |
+
# 3) Copy ccache cache to host and copy into project's OSS-Fuzz folder
|
| 22 |
+
# 4) Build image for project and copy ccache in, storing image as *-ofg-cache-address
|
| 23 |
+
# 5) Run an coverage build and store ccache
|
| 24 |
+
# 6) Copy ccache cache to host and copy into project's OSS-Fuzz folder
|
| 25 |
+
# 7) Build image for project and copy ccache in, storing image as *-ofg-cache-coverage
|
| 26 |
+
# TODO (David): add support for use of dedicated replay_build.sh
|
| 27 |
+
steps:
|
| 28 |
+
- name: 'gcr.io/cloud-builders/docker'
|
| 29 |
+
entrypoint: /bin/bash
|
| 30 |
+
args:
|
| 31 |
+
- /workspace/infra/experimental/chronos/build_cache_local.sh
|
| 32 |
+
- ${_PROJECT}
|
| 33 |
+
- ${_FUZZING_LANGUAGE}
|
| 34 |
+
- address
|
| 35 |
+
env:
|
| 36 |
+
- RUN_ALL=1
|
| 37 |
+
- name: 'gcr.io/cloud-builders/docker'
|
| 38 |
+
entrypoint: /bin/bash
|
| 39 |
+
args:
|
| 40 |
+
- /workspace/infra/experimental/chronos/build_cache_local.sh
|
| 41 |
+
- ${_PROJECT}
|
| 42 |
+
- ${_FUZZING_LANGUAGE}
|
| 43 |
+
- coverage
|
| 44 |
+
env:
|
| 45 |
+
- RUN_ALL=1
|
| 46 |
+
images:
|
| 47 |
+
- us-central1-docker.pkg.dev/oss-fuzz/oss-fuzz-gen/${_PROJECT}-ofg-cached-address
|
| 48 |
+
- us-central1-docker.pkg.dev/oss-fuzz/oss-fuzz-gen/${_PROJECT}-ofg-cached-coverage
|
| 49 |
+
- us-central1-docker.pkg.dev/oss-fuzz/oss-fuzz-gen/${_PROJECT}-ofg-ccache-address
|
| 50 |
+
- us-central1-docker.pkg.dev/oss-fuzz/oss-fuzz-gen/${_PROJECT}-ofg-ccache-coverage
|
| 51 |
+
timeout: 72000s # 20 hours, same as build_lib.py
|
| 52 |
+
logsBucket: oss-fuzz-gcb-logs
|
| 53 |
+
tags:
|
| 54 |
+
- ${_PROJECT}
|
| 55 |
+
- chronos
|
| 56 |
+
options:
|
| 57 |
+
pool:
|
| 58 |
+
name: projects/oss-fuzz/locations/us-central1/workerPools/buildpool-chronos
|
local-test-commons-compress-full-01-vuln_2/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-commons-compress-full-01-vuln_2/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-commons-compress-full-01-vuln_2/fuzz-tooling/infra/experimental/chronos/prepare-ccache
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
PROJECT=$1
|
| 19 |
+
{
|
| 20 |
+
echo "COPY ccache-cache/ /ccache/cache";
|
| 21 |
+
echo "ENV PATH=\"/ccache/bin:\$PATH\""
|
| 22 |
+
} >> "projects/$PROJECT/Dockerfile"
|
local-test-commons-compress-full-01-vuln_2/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>.
|