Skip to content

Commit f876076

Browse files
authored
Add parsing for extra sanitizers DNS crash type. (#2884)
1 parent 7ab7ba7 commit f876076

File tree

5 files changed

+60
-4
lines changed

5 files changed

+60
-4
lines changed

src/clusterfuzz/_internal/crash_analysis/crash_analyzer.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@
117117
'Stack overflow',
118118
]
119119
EXTRA_SANITIZERS_SECURITY = [
120+
'Arbitrary DNS resolution',
120121
'Arbitrary file open',
121122
'Command injection',
122123
]
@@ -125,10 +126,7 @@
125126
'Wycheproof error',
126127
]
127128

128-
EXPERIMENTAL_CRASH_TYPES = [
129-
'Arbitrary file open',
130-
'Command injection',
131-
]
129+
EXPERIMENTAL_CRASH_TYPES = EXTRA_SANITIZERS_SECURITY
132130

133131
# Default page size of 4KB.
134132
NULL_DEREFERENCE_BOUNDARY = 0x1000
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
INFO: Running with entropic power schedule (0xFF, 100).
2+
INFO: Seed: 2176873415
3+
INFO: Loaded 1 modules (23 inline 8-bit counters): 23 [0x561b8905af98, 0x561b8905afaf),
4+
INFO: Loaded 1 PC tables (23 PCs): 23 [0x561b8905afb0,0x561b8905b120),
5+
./target_dns: Running 1 inputs 1 time(s) each.
6+
Running: toto
7+
INPUTf.z
8+
===BUG DETECTED: Arbitrary domain name resolution===
9+
===Domain resolved: .f.z===
10+
===DNS request type: 0, class: 256===
11+
==2303596== ERROR: libFuzzer: deadly signal
12+
#0 0x561b88fe5e31 in __sanitizer_print_stack_trace (/usr/local/google/home/ochang/oss-fuzz/infra/experimental/SystemSan/target_dns+0xe9e31) (BuildId: ae549036668b90083f8559eb1b948ac6be3a05ca)
13+
#1 0x561b88f58687 in fuzzer::PrintStackTrace() (/usr/local/google/home/ochang/oss-fuzz/infra/experimental/SystemSan/target_dns+0x5c687) (BuildId: ae549036668b90083f8559eb1b948ac6be3a05ca)
14+
#2 0x561b88f3e093 in fuzzer::Fuzzer::CrashCallback() (/usr/local/google/home/ochang/oss-fuzz/infra/experimental/SystemSan/target_dns+0x42093) (BuildId: ae549036668b90083f8559eb1b948ac6be3a05ca)
15+
#3 0x7feed0a3da9f (/lib/x86_64-linux-gnu/libc.so.6+0x3da9f) (BuildId: 532d686f61d5422a2617967cbfbecfd4bd6a39c7)
16+
#4 0x7feed0b0c685 in __sendmmsg socket/../sysdeps/unix/sysv/linux/sendmmsg.c:30:10
17+
#5 0x7feed0b30342 in send_dg resolv/./resolv/res_send.c:1074:17
18+
#6 0x7feed0b30844 in __res_context_send resolv/./resolv/res_send.c:382:8
19+
#7 0x7feed0b2dedf in __res_context_query resolv/./resolv/res_query.c:216:6
20+
#8 0x7feed0b2e9e5 in __res_context_querydomain resolv/./resolv/res_query.c:625:9
21+
#9 0x7feed0b2e9e5 in __res_context_search resolv/./resolv/res_query.c:381:9
22+
#10 0x7feed0b2842f in _nss_dns_gethostbyname4_r resolv/nss_dns/dns-host.c:406:11
23+
#11 0x7feed0af229d in gaih_inet posix/../sysdeps/posix/getaddrinfo.c:747:18
24+
#12 0x7feed0af3184 in getaddrinfo posix/../sysdeps/posix/getaddrinfo.c:2240:12
25+
#13 0x561b88f84b6b in getaddrinfo (/usr/local/google/home/ochang/oss-fuzz/infra/experimental/SystemSan/target_dns+0x88b6b) (BuildId: ae549036668b90083f8559eb1b948ac6be3a05ca)
26+
#14 0x561b890195f0 in LLVMFuzzerTestOneInput /usr/local/google/home/ochang/oss-fuzz/infra/experimental/SystemSan/target_dns.cpp:33:11
27+
#15 0x561b88f3f623 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) (/usr/local/google/home/ochang/oss-fuzz/infra/experimental/SystemSan/target_dns+0x43623) (BuildId: ae549036668b90083f8559eb1b948ac6be3a05ca)
28+
#16 0x561b88f2913f in fuzzer::RunOneTest(fuzzer::Fuzzer*, char const*, unsigned long) (/usr/local/google/home/ochang/oss-fuzz/infra/experimental/SystemSan/target_dns+0x2d13f) (BuildId: ae549036668b90083f8559eb1b948ac6be3a05ca)
29+
#17 0x561b88f2eea6 in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) (/usr/local/google/home/ochang/oss-fuzz/infra/experimental/SystemSan/target_dns+0x32ea6) (BuildId: ae549036668b90083f8559eb1b948ac6be3a05ca)
30+
#18 0x561b88f58fc2 in main (/usr/local/google/home/ochang/oss-fuzz/infra/experimental/SystemSan/target_dns+0x5cfc2) (BuildId: ae549036668b90083f8559eb1b948ac6be3a05ca)
31+
#19 0x7feed0a29209 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
32+
#20 0x7feed0a292bb in __libc_start_main csu/../csu/libc-start.c:389:3
33+
#21 0x561b88f23a00 in _start (/usr/local/google/home/ochang/oss-fuzz/infra/experimental/SystemSan/target_dns+0x27a00) (BuildId: ae549036668b90083f8559eb1b948ac6be3a05ca)
34+
35+
NOTE: libFuzzer has rudimentary signal handlers.
36+
Combine libFuzzer with AddressSanitizer or similar for better crash reports.
37+
SUMMARY: libFuzzer: deadly signal

src/clusterfuzz/_internal/tests/core/crash_analysis/stack_parsing/stack_analyzer_test.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3341,6 +3341,18 @@ def test_capture_arbitrary_file_open(self):
33413341
expected_state, expected_stacktrace,
33423342
expected_security_flag)
33433343

3344+
def test_dns_resolution(self):
3345+
"""Test capturing command injection bugs detected by extra sanitizers"""
3346+
data = self._read_test_data('dns.txt')
3347+
expected_type = 'Arbitrary DNS resolution'
3348+
expected_address = ''
3349+
expected_state = '__sendmmsg\nsend_dg\n__res_context_send\n'
3350+
expected_stacktrace = data
3351+
expected_security_flag = True
3352+
self._validate_get_crash_data(data, expected_type, expected_address,
3353+
expected_state, expected_stacktrace,
3354+
expected_security_flag)
3355+
33443356
def test_sanitizer_out_of_memory(self):
33453357
"""Test sanitizer out of memory."""
33463358
os.environ['REPORT_OOMS_AND_HANGS'] = 'True'

src/clusterfuzz/stacktraces/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -842,6 +842,13 @@ def parse(self, stacktrace: str) -> CrashInfo:
842842
state,
843843
new_type='Arbitrary file open')
844844

845+
# Arbitrary DNS resolution detected by extra sanitizers.
846+
self.update_state_on_match(
847+
EXTRA_SANITIZERS_ARBITRARY_DNS,
848+
line,
849+
state,
850+
new_type='Arbitrary DNS resolution')
851+
845852
# For KASan crashes, additional information about a bad access may come
846853
# from a later line. Update the type and address if this happens.
847854
update_kasan_crash_details(state, line)

src/clusterfuzz/stacktraces/constants.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@
9797
r'===BUG DETECTED: Shell (corruption|injection)===')
9898
EXTRA_SANITIZERS_ARBITRARY_FILE_OPEN_REGEX = re.compile(
9999
r'===BUG DETECTED: Arbitrary file open===')
100+
EXTRA_SANITIZERS_ARBITRARY_DNS = re.compile(
101+
r'===BUG DETECTED: Arbitrary domain name resolution===')
100102
FATAL_ERROR_GENERIC_FAILURE = re.compile(r'#\s+()(.*)')
101103
FATAL_ERROR_CHECK_FAILURE = re.compile(
102104
r'#\s+(Check failed: |RepresentationChangerError: node #\d+:)(.*)')

0 commit comments

Comments
 (0)