Skip to content

TypeError: argument of type 'NoneType' is not iterable #14

@hyperreality

Description

@hyperreality

I ran vulnhuntr on https://github.com/ahmedkhlief/Ninja to see its analysis of a known AFO there:

poetry run vulnhuntr -l claude -r /home/abc/Downloads/Ninja/ -v

I get the following traceback after some number of rounds of results:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/abc/Downloads/vulnhuntr/vulnhuntr/__main__.py", line 411, in run
    match = code_extractor.extract(name, code_line, files)
  File "/home/abc/Downloads/vulnhuntr/vulnhuntr/symbol_finder.py", line 48, in extract
    match = self.project_search(symbol_name)
  File "/home/abc/Downloads/vulnhuntr/vulnhuntr/symbol_finder.py", line 156, in project_search
    if 'import ' in match['source']:

The exception seems to be triggered by the first line of the context_code:

context_code:
  - name='cmd' reason='The cmd module contains the COMMANDS dictionary and potentially the implementation of command execution, which is crucial for understanding the full extent of the RCE 
vulnerability.' code_line='from core.cmd import *'
  - name='webshell.webshell_execute' reason='This function is directly called with user input in webshell mode, making it a critical point for potential RCE.' 

A small reproduction:

from vulnhuntr.symbol_finder import SymbolExtractor

ROOT = "/home/abc/Downloads/Ninja"

code_extractor = SymbolExtractor(ROOT)

extracted = code_extractor.extract("cmd", "from core.cmd import *", [f"{ROOT}/Ninja.py", f"{ROOT}/core/payloads.py", f"{ROOT}/core/cmd.py"])                                             
print(extracted)

The problem seems to be that the modules code in symbol_finder.py doesn't handle that style of import. If the first argument to extract() is changed to the full module path core.cmd then the code doesn't crash, but the if statement doesn't trigger so Jedi doesn't goto the relevant source module file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions