-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Added line number for file results + stats fixes #1495
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Due to the matches deduplication mechanism, the summary line information only reports the first match occurrence:
$ cat logs/a.txt
aaa
bbb
ccc
RequestDataTooBig
dddd
eeee
RequestDataTooBig
dd
RequestDataTooBig3
SuspiciousOperation
$ go run . -t file/logs/django-framework-exceptions.yaml -u logs -silent
[2022-01-19 09:09:31] [django-framework-exceptions:exception] [file] [medium] logs/a.txt [SuspiciousOperation,RequestDataTooBig] [Lines: 10,4]
I don't know if it's worth considering exposing all occurrences with something like:
RequestDataTooBig
logs/a.txt:4
logs/a.txt:7
logs/a.txt:9
SuspiciousOperation
logs/a.txt:10
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Ice3man543 @Mzack9999 we are looking to print number based on matchers and not extractors, so we don't need to handle / map extracted data with line number instead we can simply print the line number of all match occurrence which is the case currently.
Requesting a change since the present line number logic only works with extractors and not with matchers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test Template
id: django-framework-exceptions
info:
name: Django Framework Exceptions
description: Detects suspicious Django web application framework exceptions that could indicate exploitation attempts
author: geeknik
reference:
- https://docs.djangoproject.com/en/1.11/ref/exceptions/
- https://docs.djangoproject.com/en/1.11/topics/logging/#django-security
severity: medium
tags: file,logs,django
file:
- extensions:
- all
matchers:
- type: regex
name: exception
part: body
regex:
- 'SuspiciousOperation'
- 'DisallowedHost'
- 'DisallowedModelAdminLookup'
- 'DisallowedModelAdminToField'
- 'DisallowedRedirect'
- 'InvalidSessionKey'
- 'RequestDataTooBig'
- 'SuspiciousFileOperation'
- 'SuspiciousMultipartForm'
- 'SuspiciousSession'
- 'TooManyFieldsSent'
- 'PermissionDenied'
Test Input (input.txt)
aaa
bbb
ccc
RequestDataTooBig
dddd
eeee
RequestDataTooBig
dd
RequestDataTooBig3
SuspiciousOperation
Example Run:
echo input.txt | ./nuclei -t test.yaml
[django-framework-exceptions:exception] [file] [medium] input.txt [LN: 4,6,9,10]
JSON Output
{
"template-id":"django-framework-exceptions",
"info":{
"name":"Django Framework Exceptions",
"author":[
"geeknik"
],
"tags":[
"file",
"logs",
"django"
],
"description":"Detects suspicious Django web application framework exceptions that could indicate exploitation attempts",
"reference":[
"https://docs.djangoproject.com/en/1.11/ref/exceptions/",
"https://docs.djangoproject.com/en/1.11/topics/logging/#django-security"
],
"severity":"medium"
},
"matcher-name":"exception",
"type":"file",
"path":"input.txt",
"matched-at":"input.txt",
"matched-line":[
4,
6,
9,
10
],
"timestamp":"2022-02-03T00:03:38.195658+05:30",
"matcher-status":true,
"line-count":""
}
The implementation has been changed to add a new It works by default for extractors in file templates. |
SonarCloud Quality Gate failed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[django-framework-exceptions:exception] [file] [medium] input.txt [LN: 4,7,9,10]
Proposed changes
Added line number for file templates results + fixed total calculation for file templates stats.
Checklist