[python] The tuple (*) argument of a call cannot step to function parameter for the CommandInjectionCustomizations flow
- Vorherrschende Sprache
- CodeQL
- Sterne
- 10.1k
- Forks
- 2.1k
- Ø Merge
- 2 T. 15 Std.
- Gemergte PRs (30 T.)
- 141
Beschreibung
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.
Beitragsleitfaden
Rechercherichtung
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.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- django, python
- Bereich
- security
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100