Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions modelaudit/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1435,6 +1435,14 @@ def _scan_file_internal(path: str, config: dict[str, Any] | None = None) -> Scan
},
)

# Ensure bytes_scanned reflects the actual file size even when a scanner
# returns early (e.g. missing optional dependency, parse error). The file
# size was already computed above via os.path.getsize and is guaranteed to
# be accurate. Without this fallback the scan summary reports "Size: 0
# bytes" for every file whose scanner didn't explicitly set the field.
if result.bytes_scanned == 0 and file_size > 0:
result.bytes_scanned = file_size

return result


Expand Down
65 changes: 65 additions & 0 deletions modelaudit/detectors/suspicious_symbols.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,71 @@
], # dill's load helpers can execute arbitrary code when unpickling
# References to the private dill._dill module are also suspicious
"dill._dill": "*",
# Dynamic resolution / import trampolines
"pkgutil": ["resolve_name", "get_importer", "walk_packages"],
"zipimport": "*",
# uuid — _get_command_stdout/_popen internally call subprocess.Popen
"uuid": ["_get_command_stdout", "_popen"],
# Network / exfiltration
"smtplib": "*",
"xmlrpc": "*",
"xmlrpc.client": "*",
"xmlrpc.server": "*",
"poplib": "*",
"imaplib": "*",
"nntplib": "*",
"ssl": "*",
"socketserver": "*",
"requests": "*",
"aiohttp": "*",
# Code execution / compilation
"codeop": "*",
"marshal": ["loads", "load", "dumps", "dump"],
"compileall": "*",
"py_compile": "*",
# FFI / native code
"_ctypes": "*",
# Profiling / debugging (can execute code)
"cProfile": "*",
"profile": "*",
"pdb": "*",
"timeit": ["timeit", "repeat"],
"trace": "*",
# Operator / functools bypasses
"functools": ["reduce", "partial"],
"_operator": "*",
# Pickle recursion
"cloudpickle": "*",
"joblib": "*",
# Filesystem / shell
"filecmp": "*",
"distutils": "*",
"pydoc": "*",
"pexpect": "*",
"fileinput": "*",
"glob": "*",
# Virtual environments / package install
"venv": "*",
"ensurepip": "*",
"pip": "*",
# Threading / process / signal
"_signal": "*",
"threading": "*",
"_thread": "*",
# Database / archive / other
"sqlite3": "*",
"_sqlite3": "*",
"select": "*",
"selectors": "*",
"logging": ["config"],
"syslog": "*",
"tarfile": "*",
"zipfile": "*",
"shelve": "*",
# Documentation / tooling (can execute code)
"doctest": "*",
"idlelib": "*",
"lib2to3": "*",
}

# Advanced pickle patterns targeting sophisticated exploitation techniques
Expand Down
Loading
Loading