FuzzManager icon indicating copy to clipboard operation
FuzzManager copied to clipboard

[FTB] Back/forward slash confusion on Windows paths

Open nth10sd opened this issue 9 years ago • 4 comments

Filing first before I forget how to describe. FuzzManager creates suggested values for the value of the stderr output correctly for directories with only forward slashes "/".

It is unsuccessful for those involving a mix of back and forward slashes which are sometimes generated on Windows: https://fuzzmanager.fuzzing.mozilla.org/crashmanager/signatures/new/?crashid=298057

Creating a bucket results in a suggestion of:

"/Assertion failure: !lookup(l).found(), at c:\Users\Administrator\shell-cache\js-dbg-[0-9]{2,}-dm-windows-[0-9]{2,}f0fa[0-9]{2,}c\objdir-js\dist\include\js/HashTable.h:[0-9]+/"

(note the mix of back & forward slashes above) instead of:

"/Assertion failure: !lookup(l).found(), at ([a-zA-Z]:)?/.+/HashTable.h:[0-9]+/"

nth10sd avatar Apr 22 '16 08:04 nth10sd

Ref: https://fuzzmanager.fuzzing.mozilla.org/crashmanager/signatures/2016/

I found that changing the bucket's stderr output value to:

"/Assertion failure: !lookup\\(l\\)\\.found\\(\\), at ([a-zA-Z]:)?(/|\\\\).+/HashTable\\.h:[0-9]+/"

note the: (/|\\\\) portion, seems to allow for both back and forward slashes.

Also note that changing the above portion to (/|\\) then clicking Preview will cause:

error at /crashmanager/signatures/2016/edit/

unbalanced parenthesis

Request Method:     POST
Request URL:    https://fuzzmanager.fuzzing.mozilla.org/crashmanager/signatures/2016/edit/
Django Version:     <masked>
Exception Type:     error

nth10sd avatar Apr 22 '16 08:04 nth10sd

Traceback:
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response
1.                     response = wrapped_callback(request, _callback_args, *_callback_kwargs)
   File "/usr/local/lib/python2.7/dist-packages/django/contrib/auth/decorators.py" in _wrapped_view
2.                 return view_func(request, _args, *_kwargs)
   File "/srv/fuzzmanager.fuzzing.mozilla.org/FuzzManager/server/crashmanager/views.py" in editSignature
3.         return __handleSignaturePost(request, bucket)
   File "/srv/fuzzmanager.fuzzing.mozilla.org/FuzzManager/server/crashmanager/views.py" in __handleSignaturePost
4.         signature = bucket.getSignature()
   File "/srv/fuzzmanager.fuzzing.mozilla.org/FuzzManager/server/crashmanager/models.py" in getSignature
5.         return CrashSignature(self.signature)
   File "/srv/fuzzmanager.fuzzing.mozilla.org/FuzzManager/FTB/Signatures/CrashSignature.py" in **init**
6.                 self.symptoms.append(Symptom.fromJSONObject(rawSymptomsObj))
   File "/srv/fuzzmanager.fuzzing.mozilla.org/FuzzManager/FTB/Signatures/Symptom.py" in fromJSONObject
7.             return OutputSymptom(obj)
   File "/srv/fuzzmanager.fuzzing.mozilla.org/FuzzManager/FTB/Signatures/Symptom.py" in **init**
8.         self.output = StringMatch(JSONHelper.getObjectOrStringChecked(obj, "value", True))
   File "/srv/fuzzmanager.fuzzing.mozilla.org/FuzzManager/FTB/Signatures/Matchers.py" in **init**
9.                 self.compiledValue = re.compile(self.value)
   File "/usr/lib/python2.7/re.py" in compile
10.     return _compile(pattern, flags)
    File "/usr/lib/python2.7/re.py" in _compile
11.         raise error, v # invalid expression

Exception Type: error at /crashmanager/signatures/2016/edit/
Exception Value: unbalanced parenthesis

nth10sd avatar Apr 26 '16 13:04 nth10sd

We should implement a function in FTB that detects and sanitizes Windows paths (translates backward slashes to forward slashes) and call that function in the Collector to sanitize stderr and crashdata only when we are detecting Windows as the OS.

choller avatar Oct 26 '16 21:10 choller

I have this back on my plate as with the help of @jschwartzentruber, made a failing testcase.

nth10sd avatar Apr 25 '18 19:04 nth10sd