The set_secret
function should gracefully handle various input formats or provide clear validation errors when input doesn't meet requirements, allowing users to understand and correct their input.
The set_secret
function unconditionally calls string::utf8(secret)
without any validation or error handling, causing the entire transaction to abort when users provide invalid UTF-8 byte sequences. This creates a predictable denial of service vector where attackers can cause any call to set_secret
to fail by providing malformed UTF-8 data.
Likelihood:
Any invalid UTF-8 input triggers the vulnerability
Attack vectors are numerous and easy to construct
Binary data, encrypted data, or corrupted input naturally triggers this
No validation occurs before the vulnerable conversion
Impact:
Predictable DoS: Attackers can reliably prevent users from setting secrets
Poor user experience: Users storing binary data get cryptic UTF-8 errors
No graceful degradation: Entire transaction fails instead of providing helpful feedback
Limits functionality: Prevents storing encrypted secrets, hashes, or binary data
Economic attack vector: Failed transactions still consume gas but provide no value
The following test demonstrates the UTF-8 enforcement vulnerability:
Input Validation with Clear Errors:
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.