Repository navigation
feat: FastAPI and CLI precision - #59
Merged
Merged
Conversation
…deserialization, redirect and CLI models
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Findings from four new repositories under
tests-project/:Vulnerable_fastapi(six documented vulnerabilities inreport/REPORT.md),InsecureGram(eleven in its README),DjangoGoaton itsbrokenbranch, andyt-fts, a real click command-line tool. Each fix is traced to a line they exposed.test: define FastAPI, SQL position, deserialization, redirect and CLI behaviour), implementation follows.get_conn().execute(...)in another file wasapp.database.get_conn.execute, unknown to the models, and hid the FastAPI login injection.Sink.positions: SQL sinks read the statement only, so a tainted value in the parameter tuple of a parameterised query is not an injection, while the credential kind keeps every argument. Without it the fix above would have flagged every parameterised query ofVulnerable_fastapi.db: Session = Depends(get_db)givesdb.executeits sink andsqlalchemy.textis a sink whose result carries no further SQL taint: InsecureGram's search injection.DESERIALIZATION(pickle,marshal,shelve,dill,jsonpickle, unsafeyamlloaders;insecure-deserialization, critical) andREDIRECT(Flask, Werkzeug, Django, FastAPI and Starlette redirects;open-redirect, medium). Existing expectations built onyaml.load(input())gain the deserialization finding.click.command,click.group, the commands of a group and of a Typer application make their parametersargvinput; a module-level function decorated by a symbol is an instance of that symbol, so@cli.command()resolves.argvinput carries every kind butPATH, a tool being expected to open the paths it is given;sys.argvfollows.On the four repositories: the FastAPI login injection and the guarded download traversal of
Vulnerable_fastapi; the injection, deserialization, redirect, command execution, SSRF and upload ofInsecureGram; two guarded redirects inDjangoGoat; nothing wrong inyt-fts. Still missing from their ground truth: Django views registered inurls.pyandModel.objects.raw, next pass; template XSS, IDOR and CSRF, outside static analysis of Python.