-
Notifications
You must be signed in to change notification settings - Fork 244
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
list is tainted by calling list.append(TAINT)
Taint is propagated by: ``` list += [TAINT] list = list + TAINT ``` but with lists we often use a function to mutate the list: ``` list = [] list.append(TAINT) list.insert(0, TAINT) list.extend(TAINT) ``` Previously this didn't taint `list` so we had FALSE NEGATIVES. Now `list.append(TAINT)` is treated like augmented assignment, so list will be tainted. `list += list.append(TAINT)` Of course this wouldn't work as real code since `append` returns `None` but it is how you can think about this function which mutates `list`. The same goes for `set.add()`, `list.extend()`, `list.insert()`, `dict.update()`, although we aren't actually doing type checking, just looking at the name of the method.
- Loading branch information
Showing
6 changed files
with
62 additions
and
6 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import os | ||
|
||
from flask import request | ||
|
||
|
||
def func(): | ||
TAINT = request.args.get("TAINT") | ||
|
||
cmd = [] | ||
cmd.append("echo") | ||
cmd.append(TAINT) | ||
|
||
os.system(" ".join(cmd)) |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,5 +8,10 @@ | |
"os.path.join", | ||
"graham", | ||
"minnesota_fats" | ||
], | ||
"mutates": [ | ||
"append", | ||
"insert", | ||
"add" | ||
] | ||
} | ||
} |
This file contains 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
This file contains 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