Skip to content

Fix empty location property for string literals in dynamically evaluated tainted scripts (partially fixes #321)#338

Closed
eleumasc wants to merge 4 commits into
SAP:mainfrom
eleumasc:fix-321
Closed

Fix empty location property for string literals in dynamically evaluated tainted scripts (partially fixes #321)#338
eleumasc wants to merge 4 commits into
SAP:mainfrom
eleumasc:fix-321

Conversation

@eleumasc

@eleumasc eleumasc commented Sep 18, 2025

Copy link
Copy Markdown
Contributor

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, as fetch.text() and fetch.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 allocate time in ParserAtom (?).
Then, in Taint.h we declare the functions ParseStringTaint and SerializeStringTaint to 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 ParseTaint with ParseStringTaintForE2E and serializeStringtaint with SerializeStringTaintForE2E for 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

  • Formatted String.cpp and jstaint.{cpp,h}.
  • Fixed naming and typing for TaintOperation::source and TaintOperation::native.
  • Minor naming fixes.

…ource. Format jstaint.{cpp,h} and String.cpp. Minor naming fixes
… for taintData in ParserAtom (fixes #321 involving XMLHttpRequest.response)
@eleumasc eleumasc changed the title Fix empty location property for stringsin dynamically evaluated tainted scripts (partially fixes #321) Fix empty location property for string literals in dynamically evaluated tainted scripts (partially fixes #321) Sep 18, 2025
@eleumasc eleumasc closed this Oct 6, 2025
@eleumasc eleumasc deleted the fix-321 branch October 6, 2025 16:01
@eleumasc eleumasc restored the fix-321 branch October 6, 2025 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Empty location property for network taint operations

1 participant