Security (EVM-18): Config derives Debug with terra_mnemonic field; any debug!(?cfg) leaks mnemonic #13
Labels
No labels
enhancement
governance
QA
testing
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
code/ust1-window#13
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@PlasticDigits finding from security review on #5.
Severity
Medium. Secrets exposure via a single debug statement.
Description
oracle-service/src/config.rs:#[derive(Debug)]on a struct containing a mnemonic means any of the following leaks the full seed phrase:debug!("{:?}", cfg)info!(?cfg, "starting")println!("{:#?}", cfg).context(format!("{:?}", cfg))in error chainsNo such call exists in
main.rstoday, but this is a one-line-change away from incident. Operator secrets (CL8Y bridge'sdocs/operator-secrets.mdspec) must not be formattable.Why this matters
The mnemonic controls the oracle operator key. With the key, an attacker can:
UpdateRatecalls (still bounded by on-chain caps, but see EVM-01/EVM-02 notes — the caps don't stop gradual manipulation if the attacker is patient)Logs are often shipped to remote aggregators (datadog, cloudwatch, grafana), increasing exposure.
Recommendation
Remove
Debugderive, or implementDebugmanually with mnemonic redacted:Alternatively wrap the mnemonic in a
secrecy::SecretStringfrom thesecrecycrate, which redacts on Debug automatically and requires explicit.expose_secret()to access.Related
mentioned in issue #5
mentioned in commit
673ac74579Done (pushed to
main)Debug / logging and mnemonics
#[derive(Debug)]onConfigandTerraSignerConfigwith manualstd::fmt::Debugimplementations that printterra_mnemonic/mnemonicas"<redacted>"sotracing(debug!,info!(?…), etc.),format!("{:?}", …), and panic-style dumps cannot leak the seed phrase.config::tests::config_debug_redacts_mnemonicto assert the formattedDebugstring never contains known mnemonic words and includes the redaction marker.Build fix (related)
mainhadbsc::read_exchange_rate_storedtaking chain-id parameters whilemain.rsstill called the old 3-argument form. Wiredverify_all_bsc_rpc_urlsat startup and passedallowed_bsc_chain_idsintoread_exchange_rate_storedso the oracle service compiles and enforcesBSC_ALLOWED_CHAIN_IDSconsistently.Commit:
673ac74.mentioned in commit
7cd0c45181@PlasticDigits verified fix on
673ac74+7cd0c45.Config::terra_mnemonic+TerraSignerConfig::mnemonicnow typed assecrecy::SecretStringDebugderive kept onConfigbecauseSecretStringauto-redacts (prints "REDACTED"/"SecretBox"/"SecretString" instead of the value)expose_secret()— compile-time safety against accidental readinto_boxed_str) — minor hardening via heap allocation rather than stackThis is the stronger of the two recommended options from the finding (wrap-type > manual Debug impl). Closing.