github / github/codeql

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

Aberta
#19,900 7 comentários 0 reações 0 responsáveis Ver no GitHub
question
Linguagem predominante
CodeQL
Estrelas
10.1k
Forks
2.1k
Merge médio
2d 15h
PRs com merge (30d)
141

Descrição

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

Guia de contribuição

Abrir o guia de contribuição

Direção de pesquisa

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.

Escrita pelo modelo de indexação a partir do texto da issue.

Avaliação

Stack de tecnologia
django, python
Domínio
security
Tipo de issue
Bug
Dificuldade
4/5
Tempo estimado
3-5 dias
Status de atividade
Estagnada
Clareza
Razoavelmente clara
Facilidade para iniciantes
35/100

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.