Skip to content
Access control Write-up Advanced

Triaged to Spam: How Cosmos Dismissed Valid CosmWasm IBC v2 Bugs Before Shipping Patches

Three vulnerabilities in CosmWasm wasmd's IBC v2 handling allowed a malicious contract to write acknowledgements for packets it did not own, send packets under another contract's port, and have V1 port IDs passed to V2 handlers. An attacker could impersonate another contract's IBC identity and disrupt or spoof cross-chain communication.

hdny679 Follow

Published on medium.com

Cybersecurity

7Tecra7, on medium.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 8 min read.

Context

Cosmos CosmWasm wasmd is the smart contract module for Cosmos SDK chains, and IBC v2 (built on ibc-go v10) is the packet transport that contracts use to send and acknowledge packets. The reports here concern the glue between the two: the keeper code that turns contract submessage responses into IBC v2 operations, and the encoder that turns a contract's IBC2Msg into a MsgSendPacket.

Three reports were submitted against wasmd v0.61.7 and v0.61.8, covering one Critical and two High issues. All three were reproduced with ibctesting scripts, validated, and moved to Triaged by an official program reviewer. Two weeks later the program published revised eligibility rules and closed all three as Spam. Seven weeks after that, the technical fixes shipped in v0.70.0 and v0.61.11.

Report Severity Vulnerability class Git marker
#3547293 Critical Async ack authorization Commit 56ca5e5, PR #2480 / #2481
#3547382 High Unvalidated SourcePort send PR #2478 / #2479
#3551078 High V1 port passing to V2 PR #2478 / #2479

Setup

  • Target: CosmWasm wasmd / IBC v2 (ibc-go v10).
  • Tested versions: wasmd v0.61.7 and v0.61.8.
  • Patched releases: v0.61.11 and v0.70.0.
  • Tooling: each report included a fully functional ibctesting reproduction script.
  • Program contacts: triagers povim_serdar and cozartshmoopler; commits and merges by pinosu, approvals by DariuszDepta.

Finding it

The three findings share a theme: the contract-facing IBC v2 path trusts values supplied by the contract (a port string, a SourcePort, a V1 port ID) where it should be checking them against the contract's own identity or its IBC2 port.

#3547293: async WriteAck authorization (Critical)

In wasmd v0.61.7, IBC2RawPacketHandler received a port string from the handler chain and checked only that it was non-empty. It never verified whether the caller was the intended destination of the packet being acknowledged. The handler never verified whether the caller was the intended destination of the packet being acknowledged.

#3547382: unverified SourcePort on send (High)

The IBC v2 message encoder, EncodeIBCv2Msg, copied the contract-supplied SourcePort into MsgSendPacket without validation. An attacker contract could set SourcePort to another contract's IBC2 port and execute send, ack and timeout callbacks under the victim's identity.

#3551078: V1 port passed to V2 handlers (High)

Non-IBC entry points in wasmd (instantiate, execute, migrate, Sudo, reply) forwarded contractInfo.IBCPortID (the V1 port) instead of IBC2PortID to the handler chain. For pure IBC2 contracts, which have no V1 entry points, IBCPortID is "", so IBC2RawPacketHandler rejected every WriteAcknowledgement submessage with "ibc2 not supported".

Exploitation

Step 1: submit the three reports

Between 10 and 12 February 2026, three separate reports were submitted against wasmd v0.61.7 and v0.61.8, each with an ibctesting reproduction script.

Step 2: triage

On 16 and 19 February 2026, reviewer povim_serdar evaluated the reports, confirmed the underlying bugs, and updated all three statuses to Triaged.

Initial triage: povim_serdar validated and officially triaged Reports #3551078, #3547382, and #3547293 between February 16 and 19, 2026. From the original on medium.com

Initial triage: povim_serdar validated and officially triaged Reports #3551078, #3547382, and #3547293 between February 16 and 19, 2026.

Step 3: policy change and mass closure

On 2 March 2026 the Cosmos program published revised eligibility rules. The same day, cozartshmoopler closed all three previously Triaged reports as Spam.

Cosmos program policy update added on March 2, 2026, citing new criteria to mark triaged vulnerabilities as Spam. From the original on medium.com

Cosmos program policy update added on March 2, 2026, citing new criteria to mark triaged vulnerabilities as Spam.

Mass closure: On March 2, 2026, Cozartshmoopler re-closed all three valid reports as "Spam" using newly introduced retroactive rules. From the original on medium.com

Mass closure: On March 2, 2026, Cozartshmoopler re-closed all three valid reports as "Spam" using newly introduced retroactive rules.

On HackerOne, a Spam status is an administrative eligibility designation that applies a severe signal penalty (-17 points per report) to the researcher's profile. It is an administrative action, not a technical refutation of the finding.

Status transition history: Initial “+7 Triaged” reputation awards changed retroactively to “-17 Spam” on March 2, 2026 From the original on medium.com

Status transition history: Initial "+7 Triaged" reputation awards changed retroactively to "-17 Spam" on March 2, 2026

Step 4: the async ack fix lands

On 18 March 2026, commit 56ca5e5 by pinosu landed on the main branch with the commit message fix, altering the async-ack logic.

Commit 56ca5e5 ("fix") on March 18, modifying handler_plugin.go to patch the reported async ack authorization flaw. From the original on medium.com

Commit 56ca5e5 ("fix") on March 18, modifying handler_plugin.go to patch the reported async ack authorization flaw.

Step 5: backports merged

On 23 and 24 April 2026, four PRs (#2478, #2479, #2480, #2481) were opened and merged without descriptive text. Approved by DariuszDepta with LGTM, they were tagged g:fix and merged as a single release batch for main and v0.61.x.

Pull Requests #2478–#2481 merged on April 24, shipping backported fixes for IBC2 send and async ack handling. From the original on medium.com

Pull Requests #2478, #2481 merged on April 24, shipping backported fixes for IBC2 send and async ack handling.

Step 6: disclosure request

On 4 May 2026 a formal Request to Disclose was submitted. The program locked all three reports immediately. The justification split: for the Critical report, the triager claimed the changes related to audit fixes rather than the submissions; for the High reports, the disclosure request was labelled as "threatening in direct violation of our policies".

Disclosure request response: Following the formal disclosure request on May 4, 2026, Cozartshmoopler cancelled the requests and locked all comment threads. From the original on medium.com

Disclosure request response: Following the formal disclosure request on May 4, 2026, Cozartshmoopler cancelled the requests and locked all comment threads.

Step 7: escalation

In September 2026 a final escalation through HackerOne Support confirmed the program refused to alter its stance, citing "signal criteria", after which Support closed the ticket.

Root cause

#3547293: missing destination check on WriteAcknowledgement

The vulnerable code in x/wasm/keeper/handler_plugin.go:

Text
case msg.IBC2.WriteAcknowledgement != nil:    if contractIBC2PortID == "" {               return nil, nil, nil, errorsmod.Wrapf(types.ErrUnsupportedForContract, "ibc2 not supported")    }    err := h.channelKeeperV2.WriteAcknowledgement(        ctx,        packet.SourceClient,                       packet.PacketSequence,                      channeltypesv2.Acknowledgement{...},    )

The only guard is a non-empty check on contractIBC2PortID. The call into WriteAcknowledgement proceeds without verifying whether the caller was the intended destination of the packet.

The patched logic (commit 56ca5e5, PRs #2480 / #2481) integrates GetAsyncPacket to look up the pending async packet from the store and verify that pending.Payloads[].DestinationPort == contractIBC2PortID before allowing WriteAcknowledgement.

#3547382: SourcePort copied without validation

The vulnerable code in x/wasm/keeper/handler_plugin_encoders.go:

Text
func EncodeIBCv2Msg(sender sdk.AccAddress, msg *wasmvmtypes.IBC2Msg) ([]sdk.Msg, error) {    switch {    case msg.SendPacket != nil:        var payloads []channeltypesv2.Payload        for _, payload := range msg.SendPacket.Payloads {            payloads = append(payloads, channeltypesv2.Payload{                SourcePort:      payload.SourcePort,                      DestinationPort: payload.DestinationPort,                ...            })        }        msg := &channeltypesv2.MsgSendPacket{            Signer: sender.String(),          }

The contract's payload.SourcePort is placed straight into the outgoing payload. Nothing ties it to the contract that is sending, so an attacker contract could claim another contract's IBC2 port and have the resulting callbacks attributed to the victim.

The patched logic (PRs #2478 / #2479): PR #2478 added a strict check inside IBC2Handler.OnSendPacket validating that the signer matches the contract derived from payload.SourcePort (signer == ContractFromPortID2(payload.SourcePort)).

#3551078: wrong port ID propagated

The vulnerable code in x/wasm/keeper/keeper.go L460:

Text
data, err := k.handleContractResponse(sdkCtx, contractAddress, contractInfo.IBCPortID, ...)

And the copy-paste bug in OnSendIBC2Packet (x/wasm/keeper/ibc2.go L304):

Text
return k.handleIBCBasicContractResponse(ctx, contractAddr, contractInfo.IBCPortID, res.Ok)

Both pass the V1 IBCPortID into the IBC2 handler chain. For a pure IBC2 contract that value is empty, so the handler's non-empty check rejects WriteAcknowledgement submessages. The patched logic (PRs #2478 / #2479): PR #2478 switched OnSendIBC2Packet to use contractInfo.IBC2PortID and fixed port propagation across all IBC2 callback dispatch paths.

Impact

  • #3547293 (Critical): the handler never verified whether the caller was the intended destination of the packet being acknowledged.
  • #3547382 (High): an attacker contract could set SourcePort to another contract's IBC2 port and execute send, ack and timeout callbacks under the victim's identity.
  • #3551078 (High): pure IBC2 contracts (no V1 entry points) had all WriteAcknowledgement submessages rejected with "ibc2 not supported", breaking the async ack path for those contracts.

On the program side, the Spam designation applied a -17 point signal penalty per report to the researcher's profile. The program locked all three reports immediately after the disclosure request.

Fix

  • #3547293: commit 56ca5e5 on main, then PRs #2480 / #2481. GetAsyncPacket looks up the pending async packet and checks pending.Payloads[].DestinationPort == contractIBC2PortID before WriteAcknowledgement.
  • #3547382: PRs #2478 / #2479. IBC2Handler.OnSendPacket checks signer == ContractFromPortID2(payload.SourcePort).
  • #3551078: PRs #2478 / #2479. OnSendIBC2Packet uses contractInfo.IBC2PortID, and port propagation is fixed across all IBC2 callback dispatch paths.

Upgrade path:

  • 0.61.x line: upgrade to v0.61.11 or higher.
  • 0.70.x line: upgrade to v0.70.0 or higher.

Variants to test

  1. Other submessage types that carry a port. Send WriteAcknowledgement (and any other IBC2 submessage that takes a port) from a contract whose IBC2 port differs from the packet's destination. A positive result is the call succeeding where it should be rejected.
  2. SourcePort spoofing on other encoders. Look for any encoder that copies a contract-supplied port into an outgoing message without comparing it to the signer's derived port. A positive result is a callback arriving at the victim contract for a send it did not initiate.
  3. V1/V2 port mix-ups on other entry points. Exercise instantiate, execute, migrate, Sudo and reply on a pure IBC2 contract and check whether the handler chain receives IBC2PortID. A positive result is an "ibc2 not supported" rejection on a contract that does have an IBC2 port.
  4. Async packet lookup bypass. Where a pending-packet store lookup was added, try acknowledging a sequence that exists but belongs to another destination port. A positive result is the acknowledgement being written.

Selective enforcement

The program cited account signal constraints to justify keeping the Spam status. Public platform data showed inconsistent enforcement: accounts created months after the February reports had submissions accepted and bounties paid, and accounts with negative signal ratings and low percentiles also received accepted reports and payouts.

Evidence of selective enforcement: Public HackerOne profiles (wataha and 0xtruthlov3r) showing accepted reports and bounties despite negative signals or young accounts. From the original on medium.com

Evidence of selective enforcement: Public HackerOne profiles (wataha and 0xtruthlov3r) showing accepted reports and bounties despite negative signals or young accounts.

Neither account age nor low signal metrics consistently blocked payouts across the broader program. The policy was applied selectively to reports that had already been successfully triaged.

References

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 18 min read.

What happened, in plain words

A security researcher found three bugs in a piece of software called CosmWasm wasmd, which is part of the Cosmos blockchain world. One bug was rated Critical (the most serious kind) and two were rated High. The researcher wrote each one up carefully, with a small program that reproduces the problem, and sent them to the Cosmos bug bounty program on HackerOne, a website where companies pay people for finding flaws in their software.

A reviewer on the program looked at all three, agreed the bugs were real, and marked them Triaged. Triaged means the company has accepted that the report describes a genuine problem and has put it in the queue to be fixed.

Two weeks later the program published new rules about what counts as a valid report, and on the same day it closed all three reports as Spam. On HackerOne, Spam is not a technical judgement about whether a bug is real. It is an administrative label that says the report should not have been submitted at all, and it takes reputation points away from the researcher's public profile.

Seven weeks after the Spam closures, the actual code fixes for the reported bugs appeared in official releases, v0.70.0 and v0.61.11. In other words, the bugs were real enough to patch, but the reports describing them had been thrown out.

This article walks through what the software does, what each bug was, how the researcher proved it, and what happened on the program side. It assumes you have never read a security report before.

The pieces you need to know

Before the bugs make sense, here are the building blocks, explained from scratch.

A blockchain is a shared record book that many computers keep copies of. Nobody can quietly change an entry, because everyone else would notice. Cosmos is a family of blockchains built with a common toolkit, the Cosmos SDK.

A smart contract is a small program that lives on a blockchain. People send it instructions, it runs, and it can move funds or send messages. Think of it as a vending machine on the chain: you press a button, it does a fixed thing.

CosmWasm is the system that runs smart contracts on Cosmos chains. wasmd is the specific program (the module) inside a Cosmos chain that hosts those contracts. When this article says "the software", it means wasmd.

IBC stands for Inter-Blockchain Communication. It is the postal service between blockchains. A contract can ask IBC to send a packet (a message) to a contract on another chain, and later it gets an acknowledgement (a receipt) saying the packet arrived or failed. IBC v2 is the newer version of this postal service, built on a library called ibc-go v10.

A port is the address label a contract uses on the IBC postal service. Each contract has its own port, a bit like a flat number in a building. If two contracts could use the same flat number, mail would go to the wrong door. There are two generations of ports here: a V1 port (IBCPortID) from the older IBC, and an IBC2 port (IBC2PortID) from IBC v2.

A submessage is an instruction a contract returns to wasmd saying "now do this on my behalf", for example "send this packet" or "write this acknowledgement". wasmd takes the submessage and turns it into a real IBC operation.

An encoder is the piece of code that translates. Here, EncodeIBCv2Msg takes the contract's request (an IBC2Msg) and turns it into a message the chain can process (MsgSendPacket).

A handler is the piece of code that receives an incoming request and decides what to do with it. IBC2RawPacketHandler is the handler for raw IBC v2 packets.

Authorisation means checking that the person or program asking for something is actually allowed to ask for it. Most of the bugs below are authorisation bugs: the software did the thing without checking who was asking.

A commit is a saved change to a code repository, with a short message describing it. A pull request (PR) is a proposed change that other developers review before it is merged into the main code. Backporting means taking a fix written for the newest version and copying it into an older, still-supported version.

A release is a numbered, published version of the software that people can download and run. v0.61.11 and v0.70.0 are two such releases.

Severity is how bad a bug is if exploited. Critical is the top of the scale, High is just below it.

A reproduction script is a small program that triggers the bug on demand, so the company can see it happen rather than take the researcher's word for it. Here the scripts used ibctesting, a testing toolkit that simulates IBC traffic.

Signal on HackerOne is a score attached to a researcher's profile, based on how useful their past reports were. A Spam closure subtracts points from it.

The three reports at a glance

Report Severity What kind of bug Where the fix lives
#3547293 Critical A contract could acknowledge a packet that was not addressed to it Commit 56ca5e5, PR #2480 / #2481
#3547382 High A contract could send packets pretending to be another contract PR #2478 / #2479
#3551078 High The wrong kind of port was passed along, so acknowledgements were rejected PR #2478 / #2479

The common thread: in the code that connects contracts to IBC v2, wasmd trusted values supplied by the contract (a port name, a source port, a V1 port ID) where it should have checked them against the contract's own identity.

The setup

  • Target: CosmWasm wasmd / IBC v2 (ibc-go v10).
  • Tested versions: wasmd v0.61.7 and v0.61.8.
  • Patched releases: v0.61.11 and v0.70.0.
  • Tooling: each report included a fully functional ibctesting reproduction script.
  • People involved: triagers povim_serdar and cozartshmoopler; commits and merges by pinosu; approvals by DariuszDepta.

Finding the bugs

All three bugs live in the same neighbourhood: the code that takes instructions from a contract and turns them into IBC v2 actions. In each case, a value that the contract controls was used without being checked against the contract's own identity or its own IBC2 port.

Bug 1 (#3547293): acknowledging someone else's packet (Critical)

When a contract wants to write an acknowledgement, it sends a submessage to wasmd. In wasmd v0.61.7, the handler IBC2RawPacketHandler received a port string from the chain of handlers and checked only one thing: that the string was not empty. It never checked whether the contract asking was the intended destination of the packet being acknowledged.

In everyday terms: a post office accepts a receipt for a parcel as long as the receipt has some address written on it, without checking that the address is the one the parcel was actually sent to. The handler never checked whether the contract asking was the intended destination of the packet being acknowledged.

Bug 2 (#3547382): sending under someone else's name (High)

When a contract asks to send a packet, the encoder EncodeIBCv2Msg copies the SourcePort value supplied by the contract straight into the outgoing message, MsgSendPacket, without checking it. SourcePort is the "from" address on the envelope.

Because nothing tied that value to the contract actually sending, an attacker contract could set SourcePort to another contract's IBC2 port. The result: an attacker contract could have send, acknowledgement and timeout callbacks attributed to the victim contract, as if the victim had sent the packet.

Bug 3 (#3551078): the wrong port label (High)

Contracts can be triggered in several ways: instantiate (create the contract), execute (run it), migrate (upgrade its code), Sudo (a privileged call from the chain) and reply (continue after a submessage). These entry points in wasmd passed contractInfo.IBCPortID, the V1 port, into the handler chain instead of IBC2PortID.

For a contract that only uses IBC v2 and has no V1 entry points, IBCPortID is the empty string "". The handler's non-empty check then rejected all WriteAcknowledgement submessages with the error "ibc2 not supported". In plain terms: the contract's flat number was left blank on the envelope, so the post office refused to deliver the receipt.

What the researcher did, step by step

Step 1: submit the three reports

Between 10 and 12 February 2026, three separate reports were submitted against wasmd v0.61.7 and v0.61.8. Each one included an ibctesting reproduction script, so the program could run the bug themselves instead of trusting a description.

Step 2: triage

On 16 and 19 February 2026, reviewer povim_serdar evaluated the reports, confirmed the underlying bugs, and updated all three statuses to Triaged.

Initial triage: povim_serdar validated and officially triaged Reports #3551078, #3547382, and #3547293 between February 16 and 19, 2026. From the original on medium.com

Initial triage: povim_serdar validated and officially triaged Reports #3551078, #3547382, and #3547293 between February 16 and 19, 2026.

This is the point where the program has accepted the reports as real. Everything that follows is about what happened after that acceptance.

Step 3: new rules, and a mass closure

On 2 March 2026 the Cosmos program published revised eligibility rules. The same day, cozartshmoopler closed all three previously Triaged reports as Spam.

Cosmos program policy update added on March 2, 2026, citing new criteria to mark triaged vulnerabilities as Spam. From the original on medium.com

Cosmos program policy update added on March 2, 2026, citing new criteria to mark triaged vulnerabilities as Spam.

Mass closure: On March 2, 2026, Cozartshmoopler re-closed all three valid reports as "Spam" using newly introduced retroactive rules. From the original on medium.com

Mass closure: On March 2, 2026, Cozartshmoopler re-closed all three valid reports as "Spam" using newly introduced retroactive rules.

On HackerOne, a Spam status is an administrative eligibility designation. It applies a severe signal penalty, -17 points per report, to the researcher's profile. It is an administrative action, not a technical refutation of the finding: nobody claimed the bugs were not real.

Status transition history: Initial “+7 Triaged” reputation awards changed retroactively to “-17 Spam” on March 2, 2026 From the original on medium.com

Status transition history: Initial "+7 Triaged" reputation awards changed retroactively to "-17 Spam" on March 2, 2026

The image shows the same reports moving from a positive reputation award at triage to a negative one at the Spam closure.

Step 4: the first fix lands

On 18 March 2026, commit 56ca5e5 by pinosu landed on the main branch with the commit message fix, altering the async-ack logic.

Commit 56ca5e5 ("fix") on March 18, modifying handler_plugin.go to patch the reported async ack authorization flaw. From the original on medium.com

Commit 56ca5e5 ("fix") on March 18, modifying handler_plugin.go to patch the reported async ack authorization flaw.

The commit altered the async-ack logic, the area of the Critical report. It arrived about two weeks after the reports were marked Spam.

Step 5: backports merged

On 23 and 24 April 2026, four pull requests (#2478, #2479, #2480, #2481) were opened and merged without descriptive text. Approved by DariuszDepta with LGTM, they were tagged g:fix and merged as a single release batch for main and v0.61.x.

Pull Requests #2478–#2481 merged on April 24, shipping backported fixes for IBC2 send and async ack handling. From the original on medium.com

Pull Requests #2478, #2481 merged on April 24, shipping backported fixes for IBC2 send and async ack handling.

A backport is a fix copied from the newest code into an older, still-supported line. Here the older line is v0.61.x, which is why the same fix appears in more than one pull request.

Step 6: asking to disclose

On 4 May 2026 a formal Request to Disclose was submitted. Disclosure means making the report public, so other people can learn from it. The program locked all three reports immediately.

The justification split in two. For the Critical report, the triager claimed the changes related to audit fixes rather than the submissions. For the High reports, the disclosure request was labelled as "threatening in direct violation of our policies".

Disclosure request response: Following the formal disclosure request on May 4, 2026, Cozartshmoopler cancelled the requests and locked all comment threads. From the original on medium.com

Disclosure request response: Following the formal disclosure request on May 4, 2026, Cozartshmoopler cancelled the requests and locked all comment threads.

Step 7: escalation

In September 2026 a final escalation through HackerOne Support confirmed the program refused to alter its stance, citing "signal criteria", after which Support closed the ticket.

The bugs in the code

This section shows the actual code from the reports. You do not need to be able to write code to follow it: each block is followed by a plain-language walkthrough.

Bug 1: no destination check on WriteAcknowledgement

The vulnerable code in x/wasm/keeper/handler_plugin.go:

Text
case msg.IBC2.WriteAcknowledgement != nil:    if contractIBC2PortID == "" {               return nil, nil, nil, errorsmod.Wrapf(types.ErrUnsupportedForContract, "ibc2 not supported")    }    err := h.channelKeeperV2.WriteAcknowledgement(        ctx,        packet.SourceClient,                       packet.PacketSequence,                      channeltypesv2.Acknowledgement{...},    )

Line by line:

  1. case msg.IBC2.WriteAcknowledgement != nil: means "if the contract is asking to write an acknowledgement".
  2. if contractIBC2PortID == "" checks whether the contract's IBC2 port is empty.
  3. return nil, nil, nil, errorsmod.Wrapf(types.ErrUnsupportedForContract, "ibc2 not supported") is the only rejection: if the port is empty, stop with the error "ibc2 not supported".
  4. err := h.channelKeeperV2.WriteAcknowledgement( then calls the IBC v2 keeper to actually write the acknowledgement.
  5. ctx is the context, the bundle of state the call runs in.
  6. packet.SourceClient and packet.PacketSequence identify the packet: which connection it came from and its sequence number.
  7. channeltypesv2.Acknowledgement{...} is the acknowledgement content.

The only guard is the non-empty check. The call proceeds with the packet's source client and sequence without confirming that the pending packet's destination port belongs to the calling contract. That missing comparison is the bug.

The patched logic (commit 56ca5e5, PRs #2480 / #2481) integrates GetAsyncPacket to look up the pending async packet from the store and verify that pending.Payloads[].DestinationPort == contractIBC2PortID before allowing WriteAcknowledgement. In plain words: before writing the receipt, the code now fetches the parcel's record and checks that the destination address on it matches the contract asking.

Bug 2: SourcePort copied without validation

The vulnerable code in x/wasm/keeper/handler_plugin_encoders.go:

Text
func EncodeIBCv2Msg(sender sdk.AccAddress, msg *wasmvmtypes.IBC2Msg) ([]sdk.Msg, error) {    switch {    case msg.SendPacket != nil:        var payloads []channeltypesv2.Payload        for _, payload := range msg.SendPacket.Payloads {            payloads = append(payloads, channeltypesv2.Payload{                SourcePort:      payload.SourcePort,                      DestinationPort: payload.DestinationPort,                ...            })        }        msg := &channeltypesv2.MsgSendPacket{            Signer: sender.String(),          }

Line by line:

  1. func EncodeIBCv2Msg(sender sdk.AccAddress, msg *wasmvmtypes.IBC2Msg) ([]sdk.Msg, error) { declares the encoder. It takes the sender's address and the contract's IBC2 message, and returns chain messages or an error.
  2. switch { starts a set of cases.
  3. case msg.SendPacket != nil: handles the case where the contract wants to send a packet.
  4. var payloads []channeltypesv2.Payload prepares an empty list of payloads.
  5. for _, payload := range msg.SendPacket.Payloads { loops over each payload the contract supplied.
  6. payloads = append(payloads, channeltypesv2.Payload{ adds a new payload to the list.
  7. SourcePort: payload.SourcePort, copies the contract's source port straight across. This is the line that matters: no check happens here.
  8. DestinationPort: payload.DestinationPort, copies the destination port the same way.
  9. ... stands for the remaining fields, omitted in the report.
  10. msg := &channeltypesv2.MsgSendPacket{ builds the outgoing message.
  11. Signer: sender.String(), records who signed it.

Nothing ties payload.SourcePort to the contract that is sending, so a contract can claim another contract's IBC2 port and have the resulting callbacks attributed to the victim.

The patched logic (PRs #2478 / #2479): PR #2478 added a strict check inside IBC2Handler.OnSendPacket validating that the signer matches the contract derived from payload.SourcePort (signer == ContractFromPortID2(payload.SourcePort)). In plain words: the post office now checks that the "from" address on the envelope really belongs to the person handing it over.

Bug 3: the wrong port ID propagated

The vulnerable code in x/wasm/keeper/keeper.go L460:

Text
data, err := k.handleContractResponse(sdkCtx, contractAddress, contractInfo.IBCPortID, ...)

Line by line:

  1. data, err := receives the result and any error.
  2. k.handleContractResponse( calls the function that processes what the contract returned.
  3. sdkCtx is the context.
  4. contractAddress is the contract being handled.
  5. contractInfo.IBCPortID is the V1 port. This is the wrong value to pass into IBC v2 handling.
  6. ... stands for further arguments, omitted in the report.

And the copy-paste bug in OnSendIBC2Packet (x/wasm/keeper/ibc2.go L304):

Text
return k.handleIBCBasicContractResponse(ctx, contractAddr, contractInfo.IBCPortID, res.Ok)

Line by line:

  1. return sends the result back to the caller.
  2. k.handleIBCBasicContractResponse( processes the contract's response to an IBC2 send.
  3. ctx is the context.
  4. contractAddr is the contract's address.
  5. contractInfo.IBCPortID is again the V1 port, where the IBC2 port was needed.
  6. res.Ok is the outcome of the contract's execution.

Both lines pass the V1 IBCPortID into the IBC2 handler chain. For a pure IBC2 contract that value is empty, so the handler's non-empty check rejects the submessage. The patched logic (PRs #2478 / #2479): PR #2478 switched OnSendIBC2Packet to use contractInfo.IBC2PortID and fixed port propagation across all IBC2 callback dispatch paths.

What each bug could do

  • #3547293 (Critical): a contract could write an acknowledgement for a packet it was not the destination of, because the handler never checked the pending packet's destination port against the caller.
  • #3547382 (High): an attacker contract could set SourcePort to another contract's IBC2 port and execute send, ack and timeout callbacks under the victim's identity.
  • #3551078 (High): pure IBC2 contracts, which have no V1 entry points, had all WriteAcknowledgement submessages rejected with "ibc2 not supported", breaking the async ack path for those contracts.

On the program side, the Spam designation applied a -17 point signal penalty per report to the researcher's profile. The program locked all three reports immediately after the disclosure request.

The fixes

  • #3547293: commit 56ca5e5 on main, then PRs #2480 / #2481. GetAsyncPacket looks up the pending async packet and checks pending.Payloads[].DestinationPort == contractIBC2PortID before WriteAcknowledgement.
  • #3547382: PRs #2478 / #2479. IBC2Handler.OnSendPacket checks signer == ContractFromPortID2(payload.SourcePort).
  • #3551078: PRs #2478 / #2479. OnSendIBC2Packet uses contractInfo.IBC2PortID, and port propagation is fixed across all IBC2 callback dispatch paths.

If you run one of these chains, the upgrade path is:

  • 0.61.x line: upgrade to v0.61.11 or higher.
  • 0.70.x line: upgrade to v0.70.0 or higher.

Other places to look

  1. Other submessage types that carry a port. Send WriteAcknowledgement (and any other IBC2 submessage that takes a port) from a contract whose IBC2 port differs from the packet's destination. A positive result is the call succeeding where it should be rejected.
  2. SourcePort spoofing on other encoders. Look for any encoder that copies a contract-supplied port into an outgoing message without comparing it to the signer's derived port. A positive result is a callback arriving at the victim contract for a send it did not initiate.
  3. V1/V2 port mix-ups on other entry points. Exercise instantiate, execute, migrate, Sudo and reply on a pure IBC2 contract and check whether the handler chain receives IBC2PortID. A positive result is an "ibc2 not supported" rejection on a contract that does have an IBC2 port.
  4. Async packet lookup bypass. Where a pending-packet store lookup was added, try acknowledging a sequence that exists but belongs to another destination port. A positive result is the acknowledgement being written.

Was the rule applied evenly?

The program cited account signal constraints to justify keeping the Spam status. Public platform data showed inconsistent enforcement: accounts created months after the February reports had submissions accepted and bounties paid, and accounts with negative signal ratings and low percentiles also received accepted reports and payouts.

Evidence of selective enforcement: Public HackerOne profiles (wataha and 0xtruthlov3r) showing accepted reports and bounties despite negative signals or young accounts. From the original on medium.com

Evidence of selective enforcement: Public HackerOne profiles (wataha and 0xtruthlov3r) showing accepted reports and bounties despite negative signals or young accounts.

Neither account age nor low signal metrics consistently blocked payouts across the broader program. The policy was applied selectively to reports that had already been successfully triaged.

Where to read more

Glossary

  • Acknowledgement: a receipt sent back to the sender of an IBC packet, saying it arrived or failed.
  • Async ack: an acknowledgement written later, asynchronously, rather than immediately when the packet is received.
  • Authorisation: checking that whoever asks for an action is allowed to perform it.
  • Backport: copying a fix from the newest code into an older, still-supported version.
  • Blockchain: a shared record book kept in copies by many computers, where entries cannot be quietly changed.
  • Bug bounty program: a scheme where an organisation pays people for reporting flaws in its software.
  • Callback: code that runs automatically when an earlier action completes, such as a send, ack or timeout.
  • Commit: a saved change to a code repository, with a short message.
  • Cosmos SDK: the toolkit used to build Cosmos blockchains.
  • CosmWasm: the system that runs smart contracts on Cosmos chains.
  • Critical / High: severity ratings, Critical being the most serious and High just below it.
  • Disclosure: making a security report public so others can learn from it.
  • Encoder: code that translates one message format into another.
  • Handler: code that receives an incoming request and decides what to do with it.
  • HackerOne: a platform where researchers submit security reports to organisations.
  • IBC: Inter-Blockchain Communication, the messaging system between blockchains.
  • IBC v2: the newer version of IBC, built on ibc-go v10.
  • ibc-go: the library that implements IBC.
  • ibctesting: a testing toolkit that simulates IBC traffic.
  • IBC2PortID: the IBC v2 port label belonging to a contract.
  • IBCPortID: the older V1 port label belonging to a contract.
  • instantiate / execute / migrate / Sudo / reply: the ways a contract can be triggered: create it, run it, upgrade its code, a privileged chain call, and continuing after a submessage.
  • Keeper: the part of a Cosmos module that reads and writes the chain's stored state.
  • Packet: a message sent over IBC from one chain to another.
  • Payload: the content carried inside a packet, including its source and destination ports.
  • Port: the address label a contract uses on the IBC messaging system.
  • Pull request (PR): a proposed code change that others review before it is merged.
  • Release: a numbered, published version of software.
  • Reproduction script: a small program that triggers a bug on demand.
  • Severity: how bad a bug is if exploited.
  • Signal: a score on a researcher's HackerOne profile based on the usefulness of their past reports.
  • Smart contract: a small program that lives on a blockchain and runs when instructed.
  • SourcePort / DestinationPort: the "from" and "to" port labels on an IBC packet.
  • Spam (HackerOne status): an administrative label saying a report should not have been submitted, which subtracts signal points; it is not a technical judgement about the bug.
  • Submessage: an instruction a contract returns to wasmd asking it to perform an IBC action on the contract's behalf.
  • Triaged: a status meaning the program has accepted that a report describes a real problem and queued it for fixing.
  • wasmd: the Cosmos module that hosts CosmWasm smart contracts.
  • WriteAcknowledgement: the operation that writes an acknowledgement for a packet.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.