knownsec / pocsuite3

pocsuite3 is an open-sourced remote vulnerability testing framework developed by the Knownsec 404 Team.
https://pocsuite.org
Other
3.66k stars 783 forks source link

[bug] 报错:Exception: Invalid expression [a1], only a very simple subset of Python is allowed. #333

Closed ghost closed 2 years ago

ghost commented 2 years ago

MacOS brew方式安装 最新版本v2.0

使用命令: pocsuite --dork-quake '(app:"用友 NC") AND country: "China"' -r ~/weapon/myown-nuclei-poc/yongyou/yongyou-nc-beanshell-rce.yaml

使用的poc地址:https://github.com/soapffz/myown-nuclei-poc/blob/main/yongyou/yongyou-nc-beanshell-rce.yaml

报错内容如下:

Traceback (most recent call last): File "/opt/homebrew/Cellar/pocsuite3/2.0.0/libexec/lib/python3.10/site-packages/pocsuite3/lib/yaml/nuclei/protocols/common/expressions/init.py", line 842, in evaluate result = safe_eval(potential_match, variables) File "/opt/homebrew/Cellar/pocsuite3/2.0.0/libexec/lib/python3.10/site-packages/pocsuite3/lib/yaml/nuclei/protocols/common/expressions/safe_eval.py", line 216, in safe_eval raise Exception(f"Invalid expression [{expression}], only a very simple subset of Python is allowed.") Exception: Invalid expression [a1], only a very simple subset of Python is allowed. Traceback (most recent call last): File "/opt/homebrew/Cellar/pocsuite3/2.0.0/libexec/lib/python3.10/site-packages/pocsuite3/lib/yaml/nuclei/protocols/common/expressions/init.py", line 842, in evaluate result = safe_eval(potential_match, variables) File "/opt/homebrew/Cellar/pocsuite3/2.0.0/libexec/lib/python3.10/site-packages/pocsuite3/lib/yaml/nuclei/protocols/common/expressions/safe_eval.py", line 216, in safe_eval raise Exception(f"Invalid expression [{expression}], only a very simple subset of Python is allowed.") Exception: Invalid expression [a1], only a very simple subset of Python is allowed. Traceback (most recent call last): File "/opt/homebrew/Cellar/pocsuite3/2.0.0/libexec/lib/python3.10/site-packages/pocsuite3/lib/yaml/nuclei/protocols/common/expressions/init.py", line 842, in evaluate result = safe_eval(potential_match, variables) File "/opt/homebrew/Cellar/pocsuite3/2.0.0/libexec/lib/python3.10/site-packages/pocsuite3/lib/yaml/nuclei/protocols/common/expressions/safe_eval.py", line 216, in safe_eval raise Exception(f"Invalid expression [{expression}], only a very simple subset of Python is allowed.") Exception: Invalid expression [a1], only a very simple subset of Python is allowed. Traceback (most recent call last): File "/opt/homebrew/Cellar/pocsuite3/2.0.0/libexec/lib/python3.10/site-packages/pocsuite3/lib/yaml/nuclei/protocols/common/expressions/init.py", line 842, in evaluate result = safe_eval(potential_match, variables) File "/opt/homebrew/Cellar/pocsuite3/2.0.0/libexec/lib/python3.10/site-packages/pocsuite3/lib/yaml/nuclei/protocols/common/expressions/safe_eval.py", line 216, in safe_eval raise Exception(f"Invalid expression [{expression}], only a very simple subset of Python is allowed.") Exception: Invalid expression [a1], only a very simple subset of Python is allowed. Traceback (most recent call last): File "/opt/homebrew/Cellar/pocsuite3/2.0.0/libexec/lib/python3.10/site-packages/pocsuite3/lib/yaml/nuclei/protocols/common/expressions/init.py", line 842, in evaluate result = safe_eval(potential_match, variables) File "/opt/homebrew/Cellar/pocsuite3/2.0.0/libexec/lib/python3.10/site-packages/pocsuite3/lib/yaml/nuclei/protocols/common/expressions/safe_eval.py", line 216, in safe_eval raise Exception(f"Invalid expression [{expression}], only a very simple subset of Python is allowed.") Exception: Invalid expression [a1], only a very simple subset of Python is allowed. Traceback (most recent call last): File "/opt/homebrew/Cellar/pocsuite3/2.0.0/libexec/lib/python3.10/site-packages/pocsuite3/lib/yaml/nuclei/protocols/common/expressions/init.py", line 842, in evaluate result = safe_eval(potential_match, variables) File "/opt/homebrew/Cellar/pocsuite3/2.0.0/libexec/lib/python3.10/site-packages/pocsuite3/lib/yaml/nuclei/protocols/common/expressions/safe_eval.py", line 216, in safe_eval raise Exception(f"Invalid expression [{expression}], only a very simple subset of Python is allowed.") Exception: Invalid expression [a1], only a very simple subset of Python is allowed. Traceback (most recent call last): File "/opt/homebrew/Cellar/pocsuite3/2.0.0/libexec/lib/python3.10/site-packages/pocsuite3/lib/yaml/nuclei/protocols/common/expressions/init.py", line 842, in evaluate result = safe_eval(potential_match, variables) File "/opt/homebrew/Cellar/pocsuite3/2.0.0/libexec/lib/python3.10/site-packages/pocsuite3/lib/yaml/nuclei/protocols/common/expressions/safe_eval.py", line 216, in safe_eval raise Exception(f"Invalid expression [{expression}], only a very simple subset of Python is allowed.") Exception: Invalid expression [a1], only a very simple subset of Python is allowed. Traceback (most recent call last): File "/opt/homebrew/Cellar/pocsuite3/2.0.0/libexec/lib/python3.10/site-packages/pocsuite3/lib/yaml/nuclei/protocols/common/expressions/init.py", line 842, in evaluate result = safe_eval(potential_match, variables) File "/opt/homebrew/Cellar/pocsuite3/2.0.0/libexec/lib/python3.10/site-packages/pocsuite3/lib/yaml/nuclei/protocols/common/expressions/safe_eval.py", line 216, in safe_eval raise Exception(f"Invalid expression [{expression}], only a very simple subset of Python is allowed.") Exception: Invalid expression [a1], only a very simple subset of Python is allowed. Traceback (most recent call last): File "/opt/homebrew/Cellar/pocsuite3/2.0.0/libexec/lib/python3.10/site-packages/pocsuite3/lib/yaml/nuclei/protocols/common/expressions/init.py", line 842, in evaluate result = safe_eval(potential_match, variables) File "/opt/homebrew/Cellar/pocsuite3/2.0.0/libexec/lib/python3.10/site-packages/pocsuite3/lib/yaml/nuclei/protocols/common/expressions/safe_eval.py", line 216, in safe_eval raise Exception(f"Invalid expression [{expression}], only a very simple subset of Python is allowed.") Exception: Invalid expression [a1], only a very simple subset of Python is allowed. Traceback (most recent call last): File "/opt/homebrew/Cellar/pocsuite3/2.0.0/libexec/lib/python3.10/site-packages/pocsuite3/lib/yaml/nuclei/protocols/common/expressions/init.py", line 842, in evaluate result = safe_eval(potential_match, variables) File "/opt/homebrew/Cellar/pocsuite3/2.0.0/libexec/lib/python3.10/site-packages/pocsuite3/lib/yaml/nuclei/protocols/common/expressions/safe_eval.py", line 216, in safe_eval raise Exception(f"Invalid expression [{expression}], only a very simple subset of Python is allowed.") Exception: Invalid expression [a1], only a very simple subset of Python is allowed. [16:03:58] [INFO] Scan completed,ready to print

ghost commented 2 years ago

看起来似乎是因为不支持nuclei yaml中的表达式造成的

13ph03nix commented 2 years ago

https://github.com/knownsec/pocsuite3/blob/cf6b358a477c4a6eed07021c5df9879072949058/pocsuite3/lib/yaml/nuclei/protocols/http/__init__.py#L185-L192

L189 这里有个 bug,忘记传参了,可以临时 patch一下,将 {} 改为 resp_data。感谢指出 👍

13ph03nix commented 2 years ago

v2.0.1 版本已修复 :)