github / github/codeql

[python] The tuple (*) argument of a call cannot step to function parameter for the CommandInjectionCustomizations flow

オープン
#19,900 コメント 7 件 リアクション 0 件 担当者 0 名 GitHub で見る
question
主要言語
CodeQL
スター
10.1k
フォーク
2.1k
平均マージ
2日 15時間
マージ済み PR(30日)
141

説明

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.
Image

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
django, python
領域
security
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。