Fix empty location property for string literals in dynamically evaluated tainted scripts (partially fixes #321)#338
Closed
eleumasc wants to merge 4 commits into
Closed
Fix empty location property for string literals in dynamically evaluated tainted scripts (partially fixes #321)#338eleumasc wants to merge 4 commits into
location property for string literals in dynamically evaluated tainted scripts (partially fixes #321)#338eleumasc wants to merge 4 commits into
Conversation
…nt with SerializeStringTaintForE2E
…ource. Format jstaint.{cpp,h} and String.cpp. Minor naming fixes
… for taintData in ParserAtom (fixes #321 involving XMLHttpRequest.response)
location property for string literals in dynamically evaluated tainted scripts (partially fixes #321)
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.
In this pull request, we propose a solution for the empty taint location issue involving
XMLHttpRequest.response, or better, string literals in dynamically evaluated tainted scripts. Hence, this pull request fixes #321 partially, asfetch.text()andfetch.json()taint operations are still flawed by this issue for other reasons.First, we add nlohmann/json (taint/json.hpp), a popular and maintained library for JSON parsing and serialization. We decided to add it because Firefox internals only provide JSONWriter, not JSONReader, and the JSON features provided by the JS engine require a JSContext*, which is not available everywhere we need it, including at
allocatetime inParserAtom(?).Then, in Taint.h we declare the functions
ParseStringTaintandSerializeStringTaintto parse and serialize, respectively, the whole StringTaint data structure as a simplified JSON string. Their implementation in Taint.cpp is based on nlohmann/json.Finally, in Taint.h we replace the functions
ParseTaintwithParseStringTaintForE2EandserializeStringtaintwithSerializeStringTaintForE2Efor the end-to-end tainting. We rewrite the functions using nlohmann/json and thus discarding the custom JSON parser, while preserving the expected behavior of these functions.Other
TaintOperation::sourceandTaintOperation::native.