google / grr

GRR Rapid Response: remote live forensics for incident response

Home Page:https://grr-doc.readthedocs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`magic_return_str` cannot contain `%` in first 200 characters or Flows will error

Ryxias opened this issue · comments

Environment

  • How did you install GRR? DEB
  • What GRR version are you running?: 3.4.2post4
  • What operating system does the GRR server run on? Ubuntu 18.04
  • What operating system does the affected GRR client run on, if applicable? MacOS 11.X

Describe the issue
When running PythonHacks, if the % character appears in any of the first 200 characters of the magic_return_str, the flow will ERROR with the following backtrace:

Traceback (most recent call last): 
File "/usr/share/grr-server/lib/python3.6/site-packages/grr_response_server/flow_base.py", line 685, in RunStateMethod method(responses) 
File "/usr/share/grr-server/lib/python3.6/site-packages/grr_response_server/flows/general/administrative.py", line 375, in Done self.Log("Result: %s" % str_result) 
File "/usr/share/grr-server/lib/python3.6/site-packages/grr_response_server/flow_base.py", line 632, in Log message=format_str % args) 
TypeError: not enough arguments for format string

To reproduce: Simply upload the following PythonHack and run it on any endpoint.

magic_return_str = 'Oh no this is 100% going to fail!'

Additionally, attempting to escape the % character with something like %% will allow the flow to run correctly, but it shows up as %% in the result:

Oh no this is 100%% going to fail!

Error logs
I think the error comes from this line of code:

self.Log("Result: %s" % str_result)

Additional context
Strange bug

The issue has been fixed in 6b8d459.