From 3a227bd77da9ca96155e76b605bf4cae9cf7f8e7 Mon Sep 17 00:00:00 2001 From: Fabian Meumertzheim Date: Wed, 10 Mar 2021 22:28:02 +0100 Subject: [PATCH] [json-sanitizer] Add severity markup (#5350) Annotates the findings of the various json-sanitizer fuzzers with severities as follows: * XSS: High * Comment injection: Medium * Invalid JSON: Low * Failure to be idempotent: Not a security issue * Undeclared exceptions: Not a security issue This commit takes advantage of the support for severity markers in stack traces introduced in https://github.com/google/clusterfuzz/pull/2270. --- projects/json-sanitizer/DenylistFuzzer.java | 25 +++++++++++++------ .../json-sanitizer/IdempotenceFuzzer.java | 16 ++++++------ projects/json-sanitizer/ValidJsonFuzzer.java | 9 ++++--- 3 files changed, 30 insertions(+), 20 deletions(-) diff --git a/projects/json-sanitizer/DenylistFuzzer.java b/projects/json-sanitizer/DenylistFuzzer.java index 9f810224a..4e73cfcb7 100644 --- a/projects/json-sanitizer/DenylistFuzzer.java +++ b/projects/json-sanitizer/DenylistFuzzer.java @@ -15,7 +15,8 @@ //////////////////////////////////////////////////////////////////////////////// import com.code_intelligence.jazzer.api.FuzzedDataProvider; - +import com.code_intelligence.jazzer.api.FuzzerSecurityIssueHigh; +import com.code_intelligence.jazzer.api.FuzzerSecurityIssueMedium; import com.google.json.JsonSanitizer; public class DenylistFuzzer { @@ -29,12 +30,20 @@ public class DenylistFuzzer { // exceeded. return; } - // See https://github.com/OWASP/json-sanitizer#output. - if (output.contains("")) { - System.err.println("input : " + input); - System.err.println("output: " + output); - throw new IllegalStateException("Output contains forbidden substring"); - } + + // Check for forbidden substrings. As these would enable Cross-Site + // Scripting, treat every finding as a high severity vulnerability. + assert !output.contains("") + : new FuzzerSecurityIssueHigh("Output contains ]]>"); + + // Check for more forbidden substrings. As these would not directly enable + // Cross-Site Scripting in general, but may impact script execution on the + // embedding page, treat each finding as a medium severity vulnerability. + assert !output.contains("