|
1 | 1 | from .base import BaseLightfuzz |
2 | 2 | from bbot.errors import HttpCompareError |
3 | | -from bbot.core.helpers.misc import get_waf_strings |
4 | 3 |
|
5 | 4 |
|
6 | 5 | class serial(BaseLightfuzz): |
@@ -48,10 +47,20 @@ class serial(BaseLightfuzz): |
48 | 47 | "java.io.optionaldataexception", |
49 | 48 | ] |
50 | 49 |
|
51 | | - GENERAL_ERRORS = [ |
| 50 | + GENERAL_ERROR_STRINGS = [ |
52 | 51 | "Internal Error", |
53 | 52 | "Internal Server Error", |
54 | | - ] + get_waf_strings() |
| 53 | + ] |
| 54 | + |
| 55 | + @property |
| 56 | + def general_error_yara_rules(self): |
| 57 | + if not hasattr(self.lightfuzz, "_serial_general_error_rules"): |
| 58 | + from bbot.core.helpers.misc import get_waf_strings |
| 59 | + |
| 60 | + self.lightfuzz._serial_general_error_rules = self.lightfuzz.helpers.yara.compile_strings( |
| 61 | + self.GENERAL_ERROR_STRINGS + get_waf_strings(), nocase=True |
| 62 | + ) |
| 63 | + return self.lightfuzz._serial_general_error_rules |
55 | 64 |
|
56 | 65 | def is_possibly_serialized(self, value): |
57 | 66 | # Use the is_base64 method from BaseLightfuzz via self |
@@ -101,7 +110,6 @@ async def fuzz(self): |
101 | 110 | php_raw_serialization_payloads = self.PHP_RAW_SERIALIZATION_PAYLOADS |
102 | 111 |
|
103 | 112 | serialization_errors = self.SERIALIZATION_ERRORS |
104 | | - general_errors = self.GENERAL_ERRORS |
105 | 113 |
|
106 | 114 | probe_value = self.incoming_probe_value(populate_empty=False) |
107 | 115 | if probe_value: |
@@ -172,12 +180,13 @@ async def fuzz(self): |
172 | 180 | ) |
173 | 181 | continue |
174 | 182 |
|
| 183 | + general_error_matches = await self.lightfuzz.helpers.yara.match( |
| 184 | + self.general_error_yara_rules, response.text |
| 185 | + ) |
175 | 186 | if ( |
176 | 187 | status_code == 200 |
177 | 188 | and "code" in diff_reasons |
178 | | - and not any( |
179 | | - error in response.text for error in general_errors |
180 | | - ) # ensure the 200 is not actually an error |
| 189 | + and not general_error_matches # ensure the 200 is not actually an error |
181 | 190 | ): |
182 | 191 | # Confirm the baseline error state is stable by re-sending the control payload. |
183 | 192 | # If the control also returns 200 now, the original error was transient. |
|
0 commit comments