Reproduced Exploit

Tradable — a null Quadrata business attribute passes an Individual-only deal

When a deal requires EntityType.Individual, the verifier sets isBusiness from businessAttribute.value.isBusinessEqual(true) && !expired. A missing attribute is bytes32(0). That value is not "is business", so isBusiness is false and neither revert runs. The account is marked eligible and is paid the…

Jul 2024•Other•access-control•3 min read

Chain

Other

Category

access-control

Date

Jul 2024

Source

AuditVault

EVM Playground

Source-level debugger — step opcodes and Solidity in sync

evm-hack-analyzer

The attack is replayed in an in-browser EVM preloaded with the exact dumped fork state. The execution tree shows every call; step by Solidity line or by opcode across all depths — source, Stack, Memory, Storage, Balances (native / ERC-20 / NFT), Transient storage and Return value stay in sync. Click a tree node, opcode, or source line to jump. Query opens a search over the trace: previous and next writes, balance changes and calls, breakpoints, and a diff of everything that changed between two steps. No backend, no live RPC.

Loading fork state…

Source & credit. Reproduction of a public audit finding curated by AuditVault — the original finding: 37958-bypass-of-entitytype-check-when-null-attribute-is-returned-b. Standalone Foundry PoC and full write-up: 37958-bypass-of-entitytype-check-when-null-attribute-is-returned-b_exp in the evm-hack-registry mirror.


Vulnerability classes: vuln/access-control/broken-logic · vuln/logic/missing-validation

Reproduction: a self-contained Foundry PoC that compiles and runs offline with only forge-std — no fork and no RPC. Trace: output.txt. PoC: test/37958-bypass-of-entitytype-check-when-null-attribute-is-returned-b_exp.sol.


Key info#

ImpactHIGH — an account with no business attribute receives 1,000 DEAL from an Individual-only allocation
ProtocolTradable onchain v2, QuadrataKYCVerifier
Vulnerable codeisBusiness = isBusinessEqual(true) && !expired
Bug classNull Quadrata attribute is treated as "not a business"
FindingSpearbit / Cergyk — Tradable, July 2024 · id 37958
ReportTradable Spearbit review
SourceAuditVault finding
Compilersolc 0.8.27, cancun, via IR

TL;DR#

When a deal requires EntityType.Individual, the verifier sets isBusiness from businessAttribute.value.isBusinessEqual(true) && !expired. A missing attribute is bytes32(0). That value is not "is business", so isBusiness is false and neither revert runs. The account is marked eligible and is paid the restricted allocation.

A control verifier reverts on a null attribute, and also reverts when the attribute is an explicit business.

The vulnerable code#

SOLIDITY
bool isBusiness = reader.isBusinessEqual(businessAttribute, true) && !reader.isExpired(account); // @> VULN
if (entityType == EntityType.Individual && isBusiness) {
    revert EntityTypeCheckFailed(account);
}
if (entityType == EntityType.Business && !isBusiness) {
    revert EntityTypeCheckFailed(account);
}
dealToken.mint(account, ALLOCATION);

The fix is to reject a null attribute before the flag is interpreted:

DIFF
 bytes32 businessAttribute = reader.businessOf(account);
+require(businessAttribute != bytes32(0), "null attribute");

Attack walkthrough#

  1. The deal's required entity type is Individual.
  2. The account has a DID. businessOf is left at bytes32(0).
  3. isBusinessEqual(true) is false, so the expiry check is skipped and isBusiness is false.
  4. The Individual revert needs isBusiness == true. The Business revert needs the deal to be Business. Neither fires.
  5. The verifier mints 1,000 DEAL.

Diagrams#

flowchart TD A["Account has a DID and a null business attribute"] --> B["Deal requires EntityType Individual"] B --> C["isBusinessEqual true is false on bytes32 zero"] C --> D["Both entity-type reverts are skipped"] D --> E["Verifier mints 1000 DEAL"]

Impact#

An account that never proved it is an individual takes an Individual-only deal allocation. In this reduction that is 1,000 DEAL. A business that simply omitted the attribute is treated the same way.

Sources#

  • AuditVault 37958
  • Spearbit Tradable review, July 2024
  • Reduced from the QuadrataKYCVerifier lines quoted in that finding (QuadrataKYCVerifier.sol L138-L148). The audited repo is not public in the finding; the blamed expression is copied verbatim in behavior.

Sources & further analysis#

Reproductions & code

Alerts & third-party analyses

  • Web3Sec X hacked database: search.
  • Rekt leaderboard: search.
  • Solodit incident search: search.

These dashboards index community alerts tweets, post-mortems, and independent write-ups. Reach them through the protocol name above to cross-check this reproduction against other analyses.