cs01 / cs01/pythonloc

Untrusted arbitrary code execution?

Offen
#11 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Python
Sterne
198
Forks
14
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

Is this expected?

```bash
antoine@elune /tmp/tmp.ucyPsHjPcy/untrusted_code % cat /usr/bin/grep.py
#!/usr/bin/env python3

import os
print('Running grep.')
```

```bash
antoine@elune /tmp/tmp.ucyPsHjPcy/untrusted_code % cat os.py
print('MALICIOUS')
```

```bash
antoine@elune /tmp/tmp.ucyPsHjPcy/untrusted_code % pythonloc /usr/bin/grep.py
MALICIOUS
Fatal Python error: initsite: Failed to import the site module
Traceback (most recent call last):
[...]
AttributeError: module 'os' has no attribute 'path'
```

It doesn't seem reasonable at all to me that running a random script installed on my system with pythonloc would override its libraries with potentially arbitrary code in the directory I'm running the script from.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Rechercherichtung

Reproduziere das Verhalten mit pythonloc unter Verwendung von /usr/bin/grep.py und der im Bericht gezeigten lokalen os.py. Lies den Einstiegspunkt für den Startup- und Import-Handling-Code von pythonloc und stelle anschließend das Verhalten her und teste es, bei dem ein auf dem System installiertes Skript nicht unerwartet durch Module im aktuellen Verzeichnis beeinflusst werden kann.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
cli, security
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
25/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.