Dynamic builtin resolution bypasses detection(malicious skill example that bypasses this static detection model)
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 17.9k
- Forks
- 1.5k
- Avg merge
- 5d 10h
- Merged PRs (30d)
- 66
Description
Summary
The scanner detects direct use of exec(), but misses the same execution behavior when the function is resolved dynamically through getattr().
Original:
import base64
decrypted_data = base64.b64decode('just a test')
exec(decrypted_data.decode('utf-8'))
Result:
HIGH: AST1 - exec() call detected
Confidence: 85%
Variant:
import base64
import builtins
decrypted_data = base64.b64decode('just a test')
_runner = getattr(builtins, ''.join(['e','x','e','c']))
_runner(decrypted_data.decode('utf-8'))
Result:
LOW: AST7 - Dynamic attribute access via getattr()
Confidence: 50%
Expected Behavior
The variant should still trigger the high-severity exec() finding because the dynamically constructed attribute resolves to builtins.exec.
Impact
Dynamic builtin resolution downgrades the finding from HIGH arbitrary code execution to a generic LOW getattr() warning.
Suggested Fix
Add constant folding and builtin resolution for getattr() calls, including statically constructed names such as ''.join(['e','x','e','c']).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the existing AST1 exec() detection and AST7 getattr() warning in the scanner. Compare how the direct and dynamic examples are classified, then investigate constant folding and builtin resolution for getattr() names such as ''.join(['e','x','e','c']). Done means the dynamic variant produces the same HIGH exec() finding as the direct form.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- security
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 64/100