Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug(scan): Global Variable - custom_header does not parse correctly #19

Closed
1 task done
psyray opened this issue Apr 22, 2024 · 0 comments · Fixed by #90
Closed
1 task done

bug(scan): Global Variable - custom_header does not parse correctly #19

psyray opened this issue Apr 22, 2024 · 0 comments · Fixed by #90
Assignees
Labels
bug Something isn't working

Comments

@psyray
Copy link
Contributor

psyray commented Apr 22, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Submitted by @Zeetaz

When trying to run a scan utilzing the global variable "custom_header" it will be parsed differently depending on which tool it is assigned to.

For example, running the following YAML scanner config:

enable_http_crawl: true           # All tools
threads: 10                       # All tools

custom_header: 'User-Agent: Hello_I_Will_Die_PoC'

fetch_url: {
  'uses_tools': ['katana'],
}

It will break:

celery_1       |   warnings.warn(
celery_1       |
celery_1       | fetch_url                          | WARNING | Task fetch_url is RUNNING
celery_1       | fetch_url                          | ERROR | 'str' object has no attribute 'items'
celery_1       | Traceback (most recent call last):
celery_1       |   File "/usr/src/app/reNgine/celery_custom_task.py", line 129, in __call__
celery_1       |     self.result = self.run(*args, **kwargs)
celery_1       |   File "/usr/src/app/reNgine/tasks.py", line 1812, in fetch_url
celery_1       |     f'{key}: {value}' for key, value in custom_header.items()
celery_1       | AttributeError: 'str' object has no attribute 'items'
celery_1       | fetch_url                          | WARNING | Task fetch_url status is FAILED | Error: AttributeError("'str' object has no attribute 'items'")

If you instead were to run a vulnerability scan instead for fetch_url it will function correctly for nuclei.

It is possible to make this work as a temporary solution:

enable_http_crawl: true           # All tools
threads: 10                       # All tools

custom_header: {
  '"User-Agent': 'Hello_Working_PoC"'
}

fetch_url: {
  'uses_tools': ['katana'],
}

But this reuqires you to run two separate scans for vulnerability scans and fetching URL's... I am also not sure if it will break other tools or if it is only katana that is currently broken an expects "items" instead of strings.

Expected Behavior

The expected behavior, for most tools and for katan, would be to run the configuration as:

custom_header = 'User-Agent: testing'
etc, etc.

And it should be appended to the tool (katan in this case) as

-H "User-Agent: testing"

Steps To Reproduce

  1. Run the following scanner configuration on any target:
enable_http_crawl: true           # All tools
threads: 10                       # All tools

custom_header: 'User-Agent: Hello_I_Will_Die_PoC'

fetch_url: {
 'uses_tools': ['katana'],
}
  1. Note that the scan fails as it does not expect a str value.

  2. Run the following - modified - configuration:

enable_http_crawl: true           # All tools
threads: 10                       # All tools

custom_header: {
  '"User-Agent': 'Hello_Working_PoC"'
}

fetch_url: {
  'uses_tools': ['katana'],
}
  1. Note that this will work, however it does not follow the expected syntax. This is also an extremely bad work-around as it will not work with nuclei or any other tools as they won't parse it the same.

(it will append the header to katana as -H "User-Agent: Hello_Working_PoC")

Environment

- reNgine: 2.0.3
- OS: 
- Python: 
- Docker Engine: 
- Docker Compose: 
- Browser:

Anything else?

No response

@psyray psyray added the bug Something isn't working label Apr 22, 2024
@psyray psyray self-assigned this May 28, 2024
@psyray psyray changed the title bug: Global Variable - custom_header does not parse correctly bug(scan): Global Variable - custom_header does not parse correctly May 31, 2024
@psyray psyray added this to the v2.0.7 release milestone Jun 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant