Skip to content

CLI Sui balance table strips the package address from coin type, enabling token-spoofing in the display #4

Description

@Kingvic300

Description

txio sui balance <addr> renders coin types by stripping the package address whenever the full type string is longer than 30 chars:

// cli/src/cli/handlers.rs:506-517
let short_coin = if coin_type.len() > 30 {
    let parts: Vec<&str> = coin_type.split("::").collect();
    if parts.len() >= 3 {
        format!("{}::{}", parts[1].blue(), parts[2].cyan())
    } else {
        truncate_utf8_for_display(coin_type, 10, 10)
            .cyan()
            .to_string()
    }
} else {
    coin_type.cyan().to_string()
};

Verified

A Sui coinType is <package_address>::<module>::<TypeName>. Package addresses are 66 chars (0x + 64 hex), so essentially every non-native coin takes the len() > 30 branch (0x2::sui::SUI at 13 chars is the only realistic exception), which discards parts[0] — the package address — entirely, showing only module::TypeName.

Since anyone can permissionlessly mint and send an arbitrary coin to any address on Sui, an attacker can deploy a scam coin using a common module/type naming pattern (e.g. coin::COIN, widely used by real wrapped-asset bridges) from a different package, and it becomes visually indistinguishable in this table from a legitimate token — the one field that actually identifies the coin (the package address) is never shown, not even truncated. Raw/--pretty JSON output is unaffected; this is specifically a spoofing risk in the human-facing table.

Suggested fix

Include a truncated prefix of the package address (e.g. 0x1234…abcd::coin::COIN) instead of dropping it, or show the full coinType and let terminal wrapping handle width.

Metadata

Metadata

Assignees

No one assigned

    Labels

    GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial Campaign | FWC26Campaign: Official Campaign | FWC26Third CampaignCampaign: Third CampaignbugSomething isn't workingpriority:mediumNormal prioritysecuritySecurity-relevant issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions