[python] The tuple (*) argument of a call cannot step to function parameter for the CommandInjectionCustomizations flow
- Dominant language
- CodeQL
- Stars
- 10.1k
- Forks
- 2.1k
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 141
Description
In Python, when passing the typle (*) argument to function parameters, the taint propagation chain breaks. As shown in the following code snippet, this issue occurs. Are there plans to support this scenario? How do i resolve this issue?
```python
from django.contrib.auth.decorators import login_required
from django.conf.urls import url
import os
def build_cmd(cmd: str):
cmd = cmd + "; touch aa"
print(cmd)
return cmd
@login_required
def GetOperateLog(request):
cmd = request.POST.get('cmd', None)
args = []
args.append(cmd)
cmd3 = build_cmd(*args)
os.system(cmd3)
urlpatterns = [
url(r'^GetOperateLog', GetOperateLog, name='GetOperateLog'),
]
```
This is the taint propagation flow.
Contributor guide
Research direction
Start by reproducing the provided Python example and reviewing CodeQL's Python taint propagation handling for starred arguments. The issue mentions no source files or tests; the work is done when the taint flow reaches os.system through build_cmd(*args), with a regression test covering the example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- django, python
- Domain
- security
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100