Snowman Merkle Airdrop

First Flight #42
Beginner FriendlyFoundrySolidityNFT
100 EXP
View results
Submission Details
Impact: medium
Likelihood: medium
Invalid

JSON Injection

Root + Impact

Description

  • Addresses and amounts are concatenated into JSON strings.

  • Unescaped user inputs allow JSON structure manipulation via special characters.


Root Cause

json = string.concat(
'"0": { "0": "',
whitelist[0], // @> Unescaped address
'", "1": "',
vm.toString(snowAmountAlice), // @> Unescaped numeric
'" },'
);


Likelihood:

  • Guaranteed if addresses contain " or \

  • High when using vanity addresses

  • Certain during fuzz testingImpact:


  • Impact:

    • Corrupted JSON output breaking dependent systems

    • Silent test data misinterpretation

    • False positive test results

Proof of Concept

address alice = address(0x22); // Hex 0x22 = ASCII double quote (")
// Generates malformed JSON:
// "0": { "0": """, ... } → Syntax error

Recommended Mitigation

+ import {Strings} from "@openzeppelin/utils/Strings.sol";
function _createJSON() internal returns (string memory) {
+ function _escape(string memory s) private pure returns (string memory) {
+ return Strings.toHexString(bytes(s)); // JSON-safe encoding
+ }
json = string.concat(
'"0": { "0": "',
- whitelist[0],
+ _escape(whitelist[0]),
// ... repeats for all fields
);
}
Updates

Lead Judging Commences

yeahchibyke Lead Judge 5 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.