nuclei-templates icon indicating copy to clipboard operation
nuclei-templates copied to clipboard

如何写requests包里的cookie

Open wtdata99 opened this issue 1 year ago • 5 comments

我在写一个禅道命令执行漏洞时候,他先要访问misc-captcha-user.html获取一个有效的cookie,我如何在模板请求的时候将此cookie设为变量,供下一个包去使用?

### Tasks

wtdata99 avatar Sep 13 '23 03:09 wtdata99

@wtdata99, if I understand correctly, you want to extract the cookie values from a request and use them in the next request?"

You can simply use cookie-reuse: true for maintaining a browser-like session with cookie-based session handling between multiple requests.

http:
  - raw:
      - |
        GET / HTTP/1.1
        Host: {{Hostname}}
        Origin: {{BaseURL}}

      - |
        POST / HTTP/2
        Host: {{Hostname}}
        Origin: {{BaseURL}}
        Content-Type: application/x-www-form-urlencoded

    cookie-reuse: true

Example: https://github.com/projectdiscovery/nuclei-templates/blob/main/http/cves/2022/CVE-2022-2546.yaml

princechaddha avatar Sep 14 '23 14:09 princechaddha

@wtdata99,如果我理解正确的话,您想从请求中提取 cookie 值并在下一个请求中使用它们吗?”

您可以简单地使用cookie-reuse:true来维护类似的浏览器的会话,并在多个请求之间进行基于cookie的会话处理。

http:
  - raw:
      - |
        GET / HTTP/1.1
        Host: {{Hostname}}
        Origin: {{BaseURL}}

      - |
        POST / HTTP/2
        Host: {{Hostname}}
        Origin: {{BaseURL}}
        Content-Type: application/x-www-form-urlencoded

    cookie-reuse: true

示例:https://github.com/projectdiscovery/nuclei-templates/blob/main/http/cves/2022/CVE-2022-2546.yaml

Thank you very much for your answer, I will try it tomorrow

wtdata99 avatar Sep 15 '23 13:09 wtdata99

@wtdata99, if I understand correctly, you want to extract the cookie values from a request and use them in the next request?"

You can simply use cookie-reuse: true for maintaining a browser-like session with cookie-based session handling between multiple requests.

http:
  - raw:
      - |
        GET / HTTP/1.1
        Host: {{Hostname}}
        Origin: {{BaseURL}}

      - |
        POST / HTTP/2
        Host: {{Hostname}}
        Origin: {{BaseURL}}
        Content-Type: application/x-www-form-urlencoded

    cookie-reuse: true

Example: https://github.com/projectdiscovery/nuclei-templates/blob/main/http/cves/2022/CVE-2022-2546.yaml I want to ask a question. Nuclei has defined the request content. Can I still get the request content?

wtdata99 avatar Sep 17 '23 02:09 wtdata99

@wtdata99 I am not sure what you mean by request content?

princechaddha avatar Oct 03 '23 08:10 princechaddha

@wtdata99我不确定你的意思request content? There is such a loophole:There is such a vulnerability: before exploiting this vulnerability, you need to obtain a cookie. This cookie is automatically added when making a request. I want to obtain the requested cookie. Currently, I know that nuclei can only define the request content and cannot obtain the request. content.

wtdata99 avatar Oct 10 '23 05:10 wtdata99