Skip to content

Py: Why a sanitizer blocks a NotNormalized Path before Safe checking it ? #14361

Answered by RasmusWL
Sim4n6 asked this question in Q&A
Discussion options

You must be logged in to vote

In the additional taint step, we add an EXTRA edge to the taint-tracking graph to the new state. If there was an existing data-flow/taint-tracking edge to/from the same nodes, we would continue tracking with both states.

For example, if there is a general taint-step saying that the output of os.path.abspath is tainted if the first argument is tainted, in the code below, we would have that norm on the second line would be considered BOTH NormalizedUnchecked and NotNormalized, which is obviously wrong.

source # NotNormalized
norm = os.path.abspath(source) # norm is NormalizedUnchecked
if norm.startswith(f"{ROOT}/user_uploads/"):
    open(norm) # flow to norm is blocked
else:
    open(norm) #…

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
4 replies
@Sim4n6
Comment options

@Sim4n6
Comment options

@RasmusWL
Comment options

@Sim4n6
Comment options

Answer selected by Sim4n6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
2 participants