--- title: "Python" section: "Network Services" sectionSlug: "network-services-pentesting" sourcePath: "src/network-services-pentesting/pentesting-web/python.md" sourceUrl: "https://github.com/HackTricks-wiki/hacktricks/blob/188de82beb54e70956b2952367a0af91d26758b8/src/network-services-pentesting/pentesting-web/python.md" sha: "188de82beb54e70956b2952367a0af91d26758b8" isIndex: false modified: true license: "CC-BY-NC-4.0" --- # Python ## Python-specific execution probe When an input appears to be evaluated as a Python expression, a harmless call to `str()` can help confirm that the result is being executed rather than reflected verbatim. Adapt the surrounding quotes to the injection context:[[1]](#references) ```python "+str(True)+" # If True is printed, the expression was evaluated. ``` Do not treat this probe alone as proof that arbitrary statements or operating-system commands can run; the sink may expose only a restricted expression language. ## Related techniques [Readme](https://github.com/HackTricks-wiki/hacktricks/blob/188de82beb54e70956b2952367a0af91d26758b8/src/generic-methodologies-and-resources/python/bypass-python-sandboxes/README.md) [Readme](/hacktricks/pentesting-web/ssti-server-side-template-injection/overview) [Readme](/hacktricks/pentesting-web/deserialization/overview) ## References - [1] [Python documentation - Built-in Functions: `eval()` and `str()`](https://docs.python.org/3/library/functions.html)