Aurora Withdrawal Logic Error Bugfix Review
A withdrawal logic error in Aurora's bridge allowed an attacker to forge a burn result without actually burning tokens on the NEAR side, enabling theft of ETH from the EthCustodian contract. At the time, 50,550.9 ETH (worth about $62.9 million) was at risk.
medium.com
Published on medium.com
Aurora
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.
Context
Aurora is an EVM implementation that runs as a smart contract on the NEAR blockchain. From NEAR's point of view Aurora is just another contract; from a user's point of view it is an L2-style environment where Solidity contracts can be deployed and assets used as though they were on Ethereum, while benefiting from NEAR's throughput and low fees. Because Aurora is not Ethereum and lives on a separate network, moving assets between the two requires a bridge: the Rainbow Bridge, which moves tokens between Ethereum, NEAR and Aurora in a trustless manner and is implemented as smart contracts.
The bridge works by running two light clients. One is written in Solidity and deployed to Ethereum; the other is written in Rust and lives on NEAR. Each stores the other chain's block headers and verifies that the relevant transactions actually occurred on the other chain. Token movement is handled by dedicated contracts, and on the Ethereum side the relevant one is the EthCustodian contract. EthCustodian holds the ETH deposited when a user transfers it to NEAR/Aurora, and it pays ETH out to a user's Ethereum address when they bridge from NEAR/Aurora back to Ethereum.
The vulnerable component in this submission is the NEAR/Aurora to Ethereum direction, specifically the payout path. The function responsible for payouts is withdraw:

withdraw takes a proofData argument, which is information about the transaction on the NEAR side encoded using Borsh. It parses the proof, checking that it is not too old and that it is valid, and then decodes it. The function responsible for that is proveOutcome:

proveOutcome ensures that the block hash and Merkle proof are valid. The important part is the fourth require statement: it verifies that a so-called executor_id is equal to nearProofProducerAccount_. That account is the Aurora contract on the NEAR blockchain, so the check makes sure the Aurora contract executed the transaction. This ties into the Aurora engine, which calls executor_params.make_executor(self) to set itself as the executor in this context.
After the initial verification, withdraw decodes the result into a BurnResult struct:
struct BurnResult { uint128 amount; address recipient; address ethCustodian;}
That struct carries the amount of ETH to send, the recipient of the ETH, and the address of the ethCustodian that should do it. withdraw verifies that this ethCustodian address equals its own address, and if so executes the transfer.
On the NEAR side, the Aurora contract defines its own struct mirroring Solidity's BurnResult, called WithdrawResult:
/// withdraw result for eth-connector#[derive(BorshSerialize)]#[cfg_attr(not(target_arch = “wasm32”), derive(BorshDeserialize))]pub struct WithdrawResult { pub amount: NEP141Wei, pub recipient_id: Address, pub eth_custodian_address: Address,}
WithdrawResult is the return type of the withdraw_eth_from_near function, which is used directly in withdraw. Although it is called withdraw_eth_from_near, it is a burn function: ETH is not transferred anywhere, and an internal function used by it actually manipulates the balance. In short, the normal flow is that Aurora executes a burn on the NEAR blockchain, the light client on the Ethereum side receives information about it, and only then can withdraw be called.
Setup
On June 16 an anonymous whitehat submitted the vulnerability to Aurora via Immunefi. At the time of the submission, on block 14970303, 50550.9 ETH was on the vulnerable contract. With the average ETH price that day of roughly $1,245, the funds at risk amounted to $62,935,870.
Finding it
The reasoning starts from the observation that the attacker does not actually need Aurora to execute the burn: it is enough to make the transaction look like it did. The Ethereum side processes the proof and expects executor_id to match the Aurora contract, and that cannot be bypassed. But the Aurora contract also sets itself as an executor in other functions. One example is the view function, which executes the view functions of contracts deployed to Aurora:
#[no_mangle]pub extern “C” fn view() { let mut io = Runtime; let env = ViewEnv; let args: ViewCallArgs = io.read_input_borsh().sdk_unwrap(); let current_account_id = io.current_account_id(); let engine = Engine::new(args.sender, current_account_id, io, &env).sdk_unwrap(); let result = Engine::view_with_args(&engine, args).sdk_unwrap(); io.return_output(&result.try_to_vec().sdk_expect(“ERR_SERIALIZE”));}
It internally calls Engine::view_with_args, which in turn calls Engine::view. Aurora therefore also sets itself as an executor for view. So a view call also carries the Aurora contract as executor_id. The remaining question is whether its output can be shaped into a valid BurnResult. The remaining question is whether the output of such a call can be shaped into something that deserialises as a valid BurnResult.
Exploitation
Step 1: deploy a contract that echoes attacker-controlled bytes
The attacker deploys the following contract to Aurora:
// SPDX-License-Identifier: GPL-3.0pragma solidity >=0.7.0 <0.9.0;contract Echo { function echo(bytes memory payload) public pure { assembly { let pos := mload(0x40) mstore(pos, mload(add(payload, 0x20))) mstore(add(pos, 0x20), mload(add(payload, 0x40))) return(pos, 51) } }}
All it does is output the 51 bytes of whatever payload was sent to it, skipping the first 5 bytes of input, prepended with 4 bytes of length.
Step 2: craft a payload that deserialises to BurnResult
The attacker creates a malicious payload that will be correctly deserialised to the BurnResult struct. Because the expected structure is Borsh serialised, the payload consists of:
- An amount to withdraw written in little-endian notation, for example
[redacted] - The address of the receiver on the Ethereum blockchain, for example
[redacted] - The
EthCustodianaddress, the one that will processwithdrawon the Ethereum side, for example[redacted]
All those values are provided as one lump of bytes, so for the examples above the payload is:
[redacted]
Step 3: call view so NEAR records the payload
The attacker calls the view function in Aurora, which calls the Echo contract with the payload above. The NEAR blockchain then records a valid and successful transaction containing a payload decodable by EthCustodian. It is not byte-for-byte the payload submitted to Echo, because the attacker does not control the first 5 bytes: those are populated by Borsh-serialised information about the transaction status. For the payload above, the whole result is:
[redacted]
Step 4: wait for the light client and extract the proof
The attacker then follows the usual procedure for bridging tokens to Ethereum: wait until the block containing the malicious transaction is propagated to the light client on Ethereum, then extract the proof. This is done almost automatically, since NEAR has an API endpoint that produces it.
Step 5: call withdraw on EthCustodian
All that remains is to send a transaction to the withdraw function in the EthCustodian contract. The transaction succeeds because every requirement is satisfied:
- The proof data is associated with a transaction that did happen on the NEAR blockchain.
- The
executor_idis the Aurora contract. - The data from the proof deserialises correctly to the
BurnResultstruct. - The deserialised data contains the
EthCustodiancontract's address.
No tokens were burned on the Aurora side, yet the custodian pays out.
Root cause
The Ethereum-side withdraw path trusts an execution proof whose only binding to Aurora is the executor_id field. Aurora sets itself as executor for view calls as well as for burns, so a view call that returns attacker-chosen bytes is indistinguishable, at the level of that check, from a genuine burn. The BurnResult decoding then accepts those bytes because the attacker shaped them to match the Borsh layout, and the final check that ethCustodian equals the custodian's own address is satisfied by simply putting that address in the payload. The transaction succeeds because all requirements are satisfied: the proof matches a real NEAR transaction, the executor is Aurora, the data decodes to BurnResult, and it names the custodian.
Impact
An attacker could drain the ETH held by the EthCustodian contract without burning any tokens on the Aurora side. At the time of submission, on block 14970303, 50550.9 ETH was on the vulnerable contract, which at the day's average ETH price of roughly $1,245 amounted to $62,935,870 at risk.
Fix
The function responsible for returning data in the Aurora contract was modified to check specifically for this exploitation process. It now verifies, for every output longer than 55 bytes, whether the bytes corresponding to the EthCustodian address in the malicious result are actually equal to EthCustodian's address; if so, Aurora throws an error with the ERR_ILLEGAL_RETURN message. The Aurora team is also working on a longer-term fix that changes the custodian to look at state proofs instead of execution proofs. The Aurora team fixed the issue quickly and no user funds were lost. Aurora paid out a bounty of $1,000,000 in Aurora tokens, streamed linearly over a year.
Variants to test
- Look for other entry points on a bridge's source chain that set the same executor identity as the burn or lock path (view calls, read-only methods, simulation endpoints). A positive result is a transaction on the source chain that the destination light client accepts as proof of a value-moving operation even though no value moved.
- Check whether the destination contract validates only the executor and the decoded struct, without checking an event, a state change or a nonce that only a real burn would produce. A positive result is a crafted return payload that passes every
requireand triggers a payout. - Test whether return data from arbitrary deployed contracts can reach the proof output unfiltered, for example by echoing attacker bytes through assembly
return. A positive result is attacker-chosen bytes appearing verbatim in the recorded transaction result. - Probe length-based guards on return data: submit outputs just below and just above any threshold the fix introduces (here 55 bytes) and see whether the custodian address check can be avoided while still decoding to a valid struct. A positive result is a payout with a payload that bypasses the length condition.
- Review whether the destination side can be moved to state proofs rather than execution proofs, and whether any remaining execution-proof path still accepts view transactions. A positive result is an accepted proof for a transaction that did not change the relevant state.
What happened, in plain words
Aurora is a system that lets programs written for Ethereum run on top of a different blockchain called NEAR. Think of it as a translation booth: the programs are written in Ethereum's language, but they actually execute on NEAR's machinery. Because Aurora is not Ethereum and lives on a separate network, moving money between the two needs a bridge. The bridge used here is called the Rainbow Bridge, and it moves tokens between Ethereum, NEAR and Aurora.
On 16 June, an anonymous security researcher (a "whitehat", someone who finds bugs and reports them instead of abusing them) sent Aurora a report through the bug bounty platform Immunefi. The bug was a logic error in the withdrawal path: the code that pays ETH out on the Ethereum side could be tricked into paying without any matching funds being burned on the Aurora side. At the moment of the report, on block 14970303, the vulnerable contract held 50550.9 ETH. With the average ETH price that day of about $1,245, that was $62,935,870 at risk.
Aurora fixed the issue quickly and no user funds were lost. Aurora paid a bounty of $1,000,000 in Aurora tokens, streamed linearly over a year. This review was written by Michal of Halborn, a DeFi security auditing firm.

Background: what Ethereum, NEAR and Aurora are
Ethereum was the first blockchain to introduce smart contracts. A blockchain is a shared ledger that many computers keep copies of, so nobody can quietly rewrite history. A smart contract is a small program stored on that ledger: it runs automatically when someone sends it a transaction, and its rules cannot be changed after the fact by whoever calls it.
Ethereum smart contracts are written in a language called Solidity and compiled for the Ethereum Virtual Machine (EVM). A virtual machine is a simulated computer: the same program runs identically on every machine in the network, so everyone agrees on the result. Solidity has fairly simple syntax, which is one reason so many projects use it.
The drawback is performance. Ethereum is slow and expensive to use. Developers can move to faster blockchains such as NEAR, but NEAR smart contracts are written in Rust or AssemblyScript, not Solidity. Porting a whole codebase to another language is a hassle, and some functionality might not port directly at all.
Aurora solves this. Aurora is a fully operational EVM living on the NEAR blockchain. Because NEAR contracts are written in Turing-complete languages (languages powerful enough to express any computation), writing an emulator for the EVM is not a problem. From NEAR's point of view, Aurora is just another smart contract. From a user's point of view, Aurora is an L2-style network: an "L2" is a secondary layer built on top of a main chain, here letting you use assets and contracts as though you were on Ethereum, while taking advantage of NEAR's high throughput and low fees.
Bridges, and why they matter here
Aurora looks like an Ethereum-like blockchain, but it is not Ethereum: it exists on NEAR, a completely separate network. To move assets from one blockchain to another you need a bridge. For NEAR and Aurora that bridge is the Rainbow Bridge, which moves tokens between Ethereum, NEAR and Aurora in a trustless manner (meaning you do not have to trust a company or a person in the middle; the smart contracts enforce the rules). It is implemented as smart contracts.
Understanding how the Rainbow Bridge works is essential to understanding the bug, in particular how a transfer to Ethereum works.
How the bridge checks things: light clients
The core idea is two light clients. A light client is a lightweight copy of another blockchain's view: instead of storing every transaction, it stores block headers (short summaries of each block) and uses them to check that something really happened on the other chain. One light client is written in Solidity and deployed to Ethereum; the other is written in Rust and lives on NEAR. The NEAR-side contract holds Ethereum's header data and vice versa. Together they verify whether the appropriate transactions occurred on the other blockchain.
On top of that you need contracts that handle token transfers. On the Ethereum side the relevant one is the EthCustodian contract. It holds the ETH you deposit when you transfer it to NEAR/Aurora, and it pays ETH to your Ethereum address when you bridge back from NEAR/Aurora to Ethereum. Think of it as a safe with a clerk: the safe holds everyone's deposits, and the clerk hands money back when shown proof that the owner gave up the matching amount on the other side.
The vulnerable path: the withdraw function
The vulnerable component in this submission is the NEAR/Aurora to Ethereum direction, specifically the payout path. The function responsible for payouts is withdraw:

withdraw takes an argument called proofData. A proof here is evidence, in data form, that a particular transaction happened on the NEAR side; proofData is that evidence encoded using Borsh. Borsh is a serialisation format: a fixed set of rules for turning structured data (numbers, addresses, lists) into a flat sequence of bytes and back again, so two different programs written in two different languages can agree on the layout. The function parses the proof, meaning it checks that the proof is not too old and that it is valid, and then decodes it. The function responsible for that is proveOutcome:

proveOutcome ensures that the block hash and the Merkle proof are valid. A block hash is a short fingerprint of a block's contents; if anything in the block changed, the fingerprint would change. A Merkle proof is a compact way of proving that one item is inside a large collection without sending the whole collection: like proving a single receipt is in a filing cabinet by showing the labels along the path to it, rather than photocopying every folder.
The important part is the fourth require statement. In Solidity, require is an assertion: if the condition is false, the whole transaction is cancelled. This one verifies that a value called executor_id equals nearProofProducerAccount_. That account is the Aurora contract on the NEAR blockchain, so the check makes sure the Aurora contract executed the transaction. In everyday terms: the clerk at the safe only accepts a receipt if it carries the stamp of the official office, not just any stamp.
This ties into the Aurora engine, which calls executor_params.make_executor(self) to set itself as the executor in this context. In other words, Aurora writes its own name into the receipt as the party that ran the transaction.
After the initial verification, withdraw decodes the result into a BurnResult struct. A struct is a bundle of related fields grouped under one name, like a form with a few boxes to fill in:
struct BurnResult { uint128 amount; address recipient; address ethCustodian;}
Line by line:
struct BurnResult {opens the definition of a bundle calledBurnResult.uint128 amount;is the amount of ETH to send, stored as an unsigned 128-bit integer (a whole number that cannot be negative).address recipient;is the Ethereum address that will receive the ETH.address ethCustodian;is the address of the custodian contract that should do the paying.}closes the bundle.
withdraw verifies that this ethCustodian address equals its own address, and if so executes the transfer. That is a sensible-looking guard: the contract is saying "only pay out if the receipt names me as the payer".
The NEAR side of the story
On the NEAR side, the Aurora contract defines its own struct mirroring Solidity's BurnResult, called WithdrawResult:
/// withdraw result for eth-connector#[derive(BorshSerialize)]#[cfg_attr(not(target_arch = “wasm32”), derive(BorshDeserialize))]pub struct WithdrawResult { pub amount: NEP141Wei, pub recipient_id: Address, pub eth_custodian_address: Address,}
Line by line:
/// withdraw result for eth-connectoris a documentation comment, ignored by the compiler.#[derive(BorshSerialize)]tells the Rust compiler to generate code that turns this struct into Borsh bytes automatically.#[cfg_attr(not(target_arch = “wasm32”), derive(BorshDeserialize))]says: when this code is not being compiled for the WebAssembly target (the format NEAR contracts run in), also generate the code that turns Borsh bytes back into the struct. This is a convenience for testing on a normal computer.pub struct WithdrawResult {opens a public bundle namedWithdrawResult.pub amount: NEP141Wei,is the amount, in a NEAR-specific unit called NEP141Wei.pub recipient_id: Address,is the recipient's address.pub eth_custodian_address: Address,is the custodian's address.}closes the bundle.
The field order and types mirror BurnResult, which is exactly why bytes produced on one side can be read on the other.
WithdrawResult is the return type of the withdraw_eth_from_near function, which is used directly in withdraw. Although it is called withdraw_eth_from_near, it is a burn function: ETH is not transferred anywhere. Burning means destroying tokens on the source chain so that an equal amount can be released on the destination chain; otherwise the same coin would exist twice. An internal function used by it actually manipulates the balance.
To summarise the normal flow: Aurora executes a burn on the NEAR blockchain, the light client on the Ethereum side receives information about it, and only then can withdraw be called. The clerk pays only after seeing proof that the coins were destroyed on the other side.
Setup: the report and the money at stake
On 16 June an anonymous whitehat submitted the vulnerability to Aurora via Immunefi. At the time of the submission, on block 14970303, 50550.9 ETH was on the vulnerable contract. With the average ETH price that day of roughly $1,245, the funds at risk amounted to $62,935,870.
Finding it: the key observation
The reasoning starts from a simple observation: the attacker does not actually need Aurora to execute the burn. It is enough to make the transaction look like it did. The Ethereum side processes the proof and expects executor_id to match the Aurora contract, and that cannot be bypassed. But the Aurora contract also sets itself as an executor in other functions. One example is the view function, which executes the view functions of contracts deployed to Aurora. A view function is a read-only call: it computes and returns a result without changing any stored state, like asking a shop assistant to check a price rather than buying the item.
#[no_mangle]pub extern “C” fn view() { let mut io = Runtime; let env = ViewEnv; let args: ViewCallArgs = io.read_input_borsh().sdk_unwrap(); let current_account_id = io.current_account_id(); let engine = Engine::new(args.sender, current_account_id, io, &env).sdk_unwrap(); let result = Engine::view_with_args(&engine, args).sdk_unwrap(); io.return_output(&result.try_to_vec().sdk_expect(“ERR_SERIALIZE”));}
Line by line:
#[no_mangle]stops the compiler from renaming the function, so NEAR can find it by the nameview.pub extern “C” fn view() {declares a public function callable from outside, using the C calling convention (a standard way for programs to call each other).let mut io = Runtime;creates the object used to talk to the NEAR runtime (reading input, returning output).let env = ViewEnv;creates the environment for a view call.let args: ViewCallArgs = io.read_input_borsh().sdk_unwrap();reads the caller's arguments from the input and decodes them from Borsh into aViewCallArgsstruct;sdk_unwrap()aborts with an error if decoding fails.let current_account_id = io.current_account_id();gets the account this contract is running under.let engine = Engine::new(args.sender, current_account_id, io, &env).sdk_unwrap();builds the Aurora engine, passing the sender, the account id, the runtime and the environment.let result = Engine::view_with_args(&engine, args).sdk_unwrap();runs the requested view call and captures its result.io.return_output(&result.try_to_vec().sdk_expect(“ERR_SERIALIZE”));serialises the result to bytes and returns it to the caller, failing withERR_SERIALIZEif that is impossible.}closes the function.
It internally calls Engine::view_with_args, which in turn calls Engine::view. Aurora therefore also sets itself as an executor for view. So a view call also carries the Aurora contract as executor_id. The remaining question is whether its output can be shaped into a valid BurnResult. The remaining question is whether the output of such a call can be shaped into something that deserialises as a valid BurnResult. In everyday terms: the clerk checks the stamp, not whether the coins were actually destroyed, so any official-looking receipt will do.
Exploitation
Step 1: deploy a contract that echoes attacker-controlled bytes
The attacker deploys the following contract to Aurora:
// SPDX-License-Identifier: GPL-3.0pragma solidity >=0.7.0 <0.9.0;contract Echo { function echo(bytes memory payload) public pure { assembly { let pos := mload(0x40) mstore(pos, mload(add(payload, 0x20))) mstore(add(pos, 0x20), mload(add(payload, 0x40))) return(pos, 51) } }}
Line by line:
// SPDX-License-Identifier: GPL-3.0is a machine-readable licence tag.pragma solidity >=0.7.0 <0.9.0;says any compiler version from 0.7.0 up to (but not including) 0.9.0 is acceptable.contract Echo {opens a contract namedEcho.function echo(bytes memory payload) public pure {declares a public function that takes a byte array in memory and promises not to read or write blockchain state (pure).assembly {starts a block of inline assembly, low-level instructions that bypass Solidity's usual safety checks.let pos := mload(0x40)reads the "free memory pointer" at address 0x40, which tells you where unused memory begins.mstore(pos, mload(add(payload, 0x20)))copies the first 32 bytes of the payload's contents to that free memory position. Theadd(payload, 0x20)skips the 32-byte length prefix that Solidity puts in front of a byte array.mstore(add(pos, 0x20), mload(add(payload, 0x40)))copies the next 32 bytes right after it.return(pos, 51)returns 51 bytes starting atposto the caller.}closes the assembly block, the function and the contract.
All it does is output the 51 bytes of whatever payload was sent to it, skipping the first 5 bytes of input, prepended with 4 bytes of length. Why this shape? Because the attacker needs the transaction's recorded output to look like a BurnResult, and this contract lets them place chosen bytes there.
Step 2: craft a payload that deserialises to BurnResult
The attacker creates a malicious payload that will be correctly deserialised to the BurnResult struct. Because the expected structure is Borsh serialised, the payload consists of:
- An amount to withdraw written in little-endian notation, for example
[redacted]. Little-endian means the least significant byte comes first, like writing the number 123 as "3, 2, 1" instead of "1, 2, 3". - The address of the receiver on the Ethereum blockchain, for example
[redacted]. - The
EthCustodianaddress, the one that will processwithdrawon the Ethereum side, for example[redacted].
All those values are provided as one lump of bytes, so for the examples above the payload is:
[redacted]
Reading it left to right: the first 16 bytes are the amount, the next 20 bytes are the recipient address, and the final 20 bytes are the custodian address. The attacker is literally filling in the form that BurnResult describes, with their own address as the recipient.
Step 3: call view so NEAR records the payload
The attacker calls the view function in Aurora, which calls the Echo contract with the payload above. The NEAR blockchain then records a valid and successful transaction containing a payload decodable by EthCustodian. It is not byte-for-byte the payload submitted to Echo, because the attacker does not control the first 5 bytes: those are populated by Borsh-serialised information about the transaction status. For the payload above, the whole result is:
[redacted]
Notice the leading 0033000000: that is the status information the system adds. The rest is the attacker's payload, shifted along. The attacker does not need to control those bytes; they only need the remainder to line up with the BurnResult layout, which the Echo contract's 51-byte output achieves.
Step 4: wait for the light client and extract the proof
The attacker then follows the usual procedure for bridging tokens to Ethereum: wait until the block containing the malicious transaction is propagated to the light client on Ethereum, then extract the proof. This is done almost automatically, since NEAR has an API endpoint that produces it. An API endpoint is a URL on a server that answers a specific kind of request with data; here, it hands back the proof for a given transaction.
Step 5: call withdraw on EthCustodian
All that remains is to send a transaction to the withdraw function in the EthCustodian contract. The transaction succeeds because every requirement is satisfied:
- The proof data is associated with a transaction that did happen on the NEAR blockchain.
- The
executor_idis the Aurora contract. - The data from the proof deserialises correctly to the
BurnResultstruct. - The deserialised data contains the
EthCustodiancontract's address.
No tokens were burned on the Aurora side, yet the custodian pays out. The clerk checked the stamp, the form was filled in correctly, and the safe opened.
Root cause
The Ethereum-side withdraw path trusts an execution proof whose only binding to Aurora is the executor_id field. Aurora sets itself as executor for view calls as well as for burns, so a view call that returns attacker-chosen bytes is indistinguishable, at the level of that check, from a genuine burn. The BurnResult decoding then accepts those bytes because the attacker shaped them to match the Borsh layout, and the final check that ethCustodian equals the custodian's own address is satisfied by simply putting that address in the payload. The transaction succeeds because all requirements are satisfied: the proof matches a real NEAR transaction, the executor is Aurora, the data decodes to BurnResult, and it names the custodian.
Impact
An attacker could drain the ETH held by the EthCustodian contract without burning any tokens on the Aurora side. At the time of submission, on block 14970303, 50550.9 ETH was on the vulnerable contract, which at the day's average ETH price of roughly $1,245 amounted to $62,935,870 at risk.
Fix
The function responsible for returning data in the Aurora contract was modified to check specifically for this exploitation process. It now verifies, for every output longer than 55 bytes, whether the bytes corresponding to the EthCustodian address in the malicious result are actually equal to EthCustodian's address; if so, Aurora throws an error with the ERR_ILLEGAL_RETURN message. The Aurora team is also working on a longer-term fix that changes the custodian to look at state proofs instead of execution proofs. A state proof shows that the stored state of the chain changed in a particular way, which is a stronger claim than showing that some code ran. The Aurora team fixed the issue quickly and no user funds were lost. Aurora paid out a bounty of $1,000,000 in Aurora tokens, streamed linearly over a year.
Variants to test
- Look for other entry points on a bridge's source chain that set the same executor identity as the burn or lock path (view calls, read-only methods, simulation endpoints). A positive result is a transaction on the source chain that the destination light client accepts as proof of a value-moving operation even though no value moved.
- Check whether the destination contract validates only the executor and the decoded struct, without checking an event, a state change or a nonce that only a real burn would produce. A nonce is a one-time number used to make each transaction unique. A positive result is a crafted return payload that passes every
requireand triggers a payout. - Test whether return data from arbitrary deployed contracts can reach the proof output unfiltered, for example by echoing attacker bytes through assembly
return. A positive result is attacker-chosen bytes appearing verbatim in the recorded transaction result. - Probe length-based guards on return data: submit outputs just below and just above any threshold the fix introduces (here 55 bytes) and see whether the custodian address check can be avoided while still decoding to a valid struct. A positive result is a payout with a payload that bypasses the length condition.
- Review whether the destination side can be moved to state proofs rather than execution proofs, and whether any remaining execution-proof path still accepts view transactions. A positive result is an accepted proof for a transaction that did not change the relevant state.
Glossary
- Blockchain: a shared ledger kept by many computers, where entries are grouped into blocks linked by fingerprints so history cannot be quietly rewritten.
- Smart contract: a program stored on a blockchain that runs automatically when called and whose rules cannot be changed afterwards.
- Solidity: the programming language used to write Ethereum smart contracts.
- EVM (Ethereum Virtual Machine): a simulated computer that runs Ethereum smart contracts identically on every machine in the network.
- Virtual machine: software that imitates a computer so programs behave the same everywhere.
- Rust: a programming language used for NEAR smart contracts.
- AssemblyScript: another language used for NEAR smart contracts.
- Turing-complete: describes a language powerful enough to express any computation.
- NEAR: a blockchain separate from Ethereum, with high throughput and low fees.
- Aurora: an EVM environment running as a smart contract on NEAR, letting Solidity contracts and assets be used as though on Ethereum.
- L2: a secondary layer built on top of a main blockchain, offering extra capacity or lower costs.
- Bridge: a set of smart contracts that moves assets between blockchains.
- Rainbow Bridge: the bridge that moves tokens between Ethereum, NEAR and Aurora.
- Trustless: a design where you do not have to trust a company or person in the middle, because the contracts enforce the rules.
- Light client: a lightweight copy of another blockchain's view, storing block headers to verify that transactions happened there.
- Block header: a short summary of a block's contents.
- Block hash: a short fingerprint of a block; any change to the block changes the fingerprint.
- Merkle proof: a compact proof that one item belongs to a larger collection, without sending the whole collection.
EthCustodian: the Ethereum-side contract that holds deposited ETH and pays it out on withdrawals.withdraw: theEthCustodianfunction that pays ETH out after checking a proof.proofData: the encoded evidence, in Borsh, that a transaction happened on the NEAR side.- Borsh: a serialisation format with fixed rules for turning structured data into bytes and back.
- Serialisation: converting structured data into a flat sequence of bytes; deserialisation is the reverse.
proveOutcome: the function that checks a proof's block hash and Merkle proof and decodes it.require: a Solidity assertion that cancels the transaction if its condition is false.executor_id: the field naming which account executed a transaction; here it must be the Aurora contract.nearProofProducerAccount_: the account theexecutor_idis compared against, i.e. the Aurora contract on NEAR.- Struct: a bundle of related fields grouped under one name.
BurnResult: the Solidity struct holding the amount, recipient and custodian address for a payout.WithdrawResult: the NEAR-side Rust struct mirroringBurnResult.withdraw_eth_from_near: the NEAR-side function whose return type isWithdrawResult; despite its name it burns rather than transfers.- Burn: destroying tokens on the source chain so an equal amount can be released on the destination chain.
- NEP141Wei: a NEAR-specific unit for token amounts.
- View function: a read-only call that returns a result without changing stored state.
view: the Aurora function that executes view calls of contracts deployed to Aurora.Engine::view_with_args/Engine::view: internal functions theviewentry point calls.- Inline assembly: low-level instructions inside Solidity that bypass its usual safety checks.
- Free memory pointer: the value at memory address 0x40 telling you where unused memory begins.
- Little-endian: a byte order where the least significant byte comes first.
- API endpoint: a URL on a server that answers a specific kind of request with data.
- Whitehat: a security researcher who finds bugs and reports them instead of abusing them.
- Immunefi: the bug bounty platform through which the report was submitted.
- Bug bounty: a reward paid for responsibly reporting a security bug.
- Halborn: the DeFi security auditing firm whose reviewer wrote this bugfix review.
- Root cause: the underlying design or coding mistake that makes an exploit possible.
- State proof: evidence that the stored state of a chain changed in a particular way, stronger than evidence that some code ran.
- Execution proof: evidence that a particular transaction was executed by a particular account.
- Nonce: a one-time number used to make each transaction unique.
ERR_ILLEGAL_RETURN: the error Aurora now throws when a return value matches the exploitation pattern.ERR_SERIALIZE: the error returned when a result cannot be serialised.