Clarify some nuance around JSON extraction in the docs #4270
byt3bl33d3r
started this conversation in
Ideas
Replies: 1 comment
-
Thanks for bringing this up! We appreciate you showing off this use case and bringing a solution, too! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Heya,
I struggled with this for a while and I think it would definitely be worth adding to the docs as this is a common situation. I have a template that basically looks like the below and the application returns a JSON response on each request:
Running nuclei in debug mode (e.g.
nuclei -debug -stats -svd -u http://127.0.0.1 -t lfi.yaml
) showed me thatexid
andrunid
we're being correctly parsed but they were also being "cleared out" by the time Nuclei issues the last request. Everything that I read from the docs/blogs told me this should be working and I initially thought it was a bug.However, the problem was the following: Nuclei attempts to extract the values of the specified json keys on each request and as Nuclei uses JQ under the hood if a JSON response doesn't contain the specified key JQ returns
null
which is a valid value that Nuclei will assign toexid
andrunid
.In order to keep the values of
exid
andrunid
I had to modify theextractors
to have the following JQ expression:This way if the key doesn't exist in one of the many JSON response, JQ won't return
null
and Nuclei will keep the previously extracted valid values of the keys.Hopefully this makes sense.
Beta Was this translation helpful? Give feedback.
All reactions