Skip to main content
Xcapit
Blog
·10 min read·Fernando BoieroFernando Boiero·CTO & Co-Founder

Threat Modeling for Web3: Adapting OWASP to dApps

cybersecurityweb3owasp

Threat modeling is one of the most effective security practices in software engineering -- and one of the most underused in Web3. Traditional applications benefit from decades of mature threat modeling frameworks, with OWASP's STRIDE model being the most widely adopted. But decentralized applications introduce attack surfaces that these frameworks were never designed to address. Smart contracts are immutable. Transactions are public before confirmation. Value flows through composable protocols where a vulnerability in one component can cascade across the entire ecosystem. The question is not whether you need threat modeling for your dApp -- it is how to do it properly.

Web3 threat modeling framework based on OWASP
Adapting OWASP threat modeling methodology for decentralized applications

At Xcapit, we have been building blockchain applications since 2018 and conducting security assessments for DeFi protocols, wallets, and enterprise blockchain solutions. Over the years, we developed an adapted threat modeling framework that bridges the gap between established security methodologies and the realities of decentralized architecture. This article shares the approach we use with our clients and internal projects.

Why Traditional Threat Modeling Falls Short in Web3

Threat modeling in traditional software assumes a set of conditions that do not hold in decentralized systems. The application owner controls the server. Patches can be deployed immediately when vulnerabilities are found. Network traffic is private until it reaches its destination. Access control is enforced by infrastructure layers -- firewalls, network segmentation, authentication servers -- that sit outside the application itself.

Web3 inverts these assumptions. Smart contracts are self-executing and, once deployed, cannot be modified unless an upgrade mechanism was designed in advance. Every transaction sits in a public mempool before confirmation, visible to anyone monitoring the network. There is no server-side access control -- the smart contract must enforce its own permissions entirely through code. And the composability that makes DeFi powerful also means that your protocol's security depends on every other protocol it interacts with.

This does not mean traditional frameworks are useless. OWASP's STRIDE model -- which categorizes threats into Spoofing, Tampering, Repudiation, Information Disclosure, Denial of Service, and Elevation of Privilege -- provides a solid foundation. But it needs to be extended with Web3-specific threat categories that address the unique properties of blockchain systems.

STRIDE in the Decentralized World: What Translates and What Does Not

Some STRIDE categories map directly to Web3 concerns. Spoofing applies to wallet impersonation, phishing attacks that trick users into signing malicious transactions, and frontend hijacking where a compromised interface directs users to interact with attacker-controlled contracts. Denial of Service manifests as gas griefing, unbounded loop attacks, and block stuffing that prevents time-sensitive transactions from being confirmed. Elevation of Privilege maps to access control flaws in smart contracts -- unprotected admin functions, missing role checks, and proxy initialization vulnerabilities.

Other categories require reinterpretation. Information Disclosure in traditional systems means unauthorized data access, but in Web3, all on-chain data is public by design -- the threat shifts to metadata leakage and transaction pattern analysis. Repudiation is fundamentally different because blockchain provides an immutable audit trail, but the threat reappears through governance attacks where on-chain votes are influenced by off-chain coercion.

And then there are entire threat categories that STRIDE simply does not cover: oracle manipulation, MEV extraction, flash loan economic attacks, cross-chain bridge exploits, and governance token manipulation. These require new categories in our adapted framework.

Web3-Specific Threat Categories

Based on our experience auditing and building decentralized applications, we identified six Web3-specific threat categories that must be added to any threat model for a dApp:

  • Smart contract logic vulnerabilities: Reentrancy, integer overflow, uninitialized storage, and business logic flaws that cannot be patched after deployment. The immutability of smart contracts means these vulnerabilities persist until the contract is abandoned or migrated -- and migration itself introduces new attack surface.
  • Oracle manipulation: Attacks that corrupt the external data feeds smart contracts rely on for pricing, randomness, or real-world events. Flash loan-funded price manipulation on DEX-based oracles remains the single most financially devastating attack vector in DeFi, responsible for billions in cumulative losses.
  • MEV and frontrunning: Maximal Extractable Value attacks where miners, validators, or searchers reorder, insert, or censor transactions for profit. Sandwich attacks on DEX trades, liquidation sniping, and backrunning of large oracle updates are all forms of MEV that affect protocol economics and user experience.
  • Cross-chain bridge attacks: Bridges are the highest-value targets in Web3, holding locked assets that back wrapped tokens on destination chains. Validator compromise, message spoofing, and replay attacks across chains have led to the largest individual exploits in blockchain history -- the Ronin Bridge ($625M), Wormhole ($320M), and Nomad ($190M) hacks.
  • Governance attacks: Manipulation of on-chain voting through flash-loaned governance tokens, vote buying on secondary markets, proposal injection through exploited delegation, and time-lock bypass. Governance attacks are particularly insidious because they can grant the attacker legitimate protocol authority.
  • Flash loan economic exploits: Attacks that use uncollateralized flash loans to temporarily command massive capital, distort market conditions, and extract value from protocols whose logic assumes that no single actor can control that much capital in a single transaction. These attacks are risk-free for the attacker -- if any step fails, the entire transaction reverts.

The Attack Surface of a Typical dApp

Before applying threat categories, you need a clear map of the attack surface. A typical dApp has seven distinct layers, each with its own threat profile:

  • Frontend: The web interface users interact with. Vulnerable to DNS hijacking, CDN compromise, supply chain attacks through compromised npm packages, and phishing through cloned interfaces. A compromised frontend can replace contract addresses, modify transaction parameters, or inject approval transactions for attacker-controlled tokens.
  • Wallet connection: The interface between the user's wallet and the dApp. Vulnerable to blind signing attacks where users approve transactions they do not understand, permission escalation through unlimited token approvals, and session hijacking in wallet-connect protocols.
  • RPC and node infrastructure: The connection between the frontend and the blockchain. Centralized RPC providers create a single point of failure and can censor or reorder transactions. Man-in-the-middle attacks on RPC connections can modify transaction data before it reaches the mempool.
  • Smart contracts: The on-chain logic that holds and moves value. The most scrutinized layer but also the most consequential when vulnerabilities are found. Covers all standard smart contract vulnerability classes plus protocol-specific business logic.
  • Oracles and external data: Any external data source the smart contracts depend on. Includes price feeds, randomness providers, cross-chain message relayers, and off-chain computation results. Each oracle introduces a trust assumption that must be explicitly modeled.
  • Cross-chain bridges: Infrastructure that moves assets and messages between blockchains. Bridges combine smart contract risk on multiple chains with validator set security, message verification, and often centralized components that create asymmetric risk.
  • Governance: On-chain and off-chain decision-making mechanisms. Includes token-weighted voting, multi-sig operations, time-locked proposals, and emergency response procedures. Governance controls the upgrade path and parameter settings for the entire protocol.

Applying STRIDE to Each dApp Layer

The power of our adapted framework comes from systematically applying both traditional STRIDE categories and Web3-specific categories to each layer of the dApp. This creates a matrix where each cell represents a specific threat scenario that must be evaluated.

For the frontend layer, Spoofing manifests as DNS hijacking and phishing sites, Tampering as compromised build pipelines, and Information Disclosure as wallet address leakage through analytics scripts. For the smart contract layer, Spoofing means contract impersonation, Tampering translates to proxy upgrade attacks, and Elevation of Privilege maps to unprotected admin functions.

For the oracle layer, the Web3-specific categories dominate. Oracle Manipulation includes flash loan price distortion and stale data exploitation. MEV applies through oracle update frontrunning -- searchers who see a price update transaction in the mempool and execute trades before the new price takes effect. For bridges, Cross-chain Attacks cover validator collusion, message replay across chains, and incomplete finality assumptions.

Working through this matrix for a real dApp typically produces 40 to 80 specific threat scenarios. Not all of them are equally likely or impactful, which is where risk scoring becomes critical.

How We Conduct Threat Modeling Sessions

A threat modeling session is only as good as the people in the room and the process they follow. We run structured sessions that typically last three to four hours for a single protocol and involve three groups of participants.

The first group is the development team -- engineers who understand the protocol's intended behavior and design decisions. The second is the security team -- specialists with knowledge of attack patterns and adversarial thinking. The third is domain experts -- people who understand the economic model and business logic at a level that pure technologists may miss.

The process follows four phases. First, architecture decomposition: mapping the system into layers and data flows, identifying trust boundaries. Second, threat identification: working through the STRIDE-plus-Web3 matrix systematically. Third, risk assessment: scoring each threat using our adapted formula. Fourth, mitigation planning: defining countermeasures for each high and critical risk, assigning ownership, and setting timelines.

The output is a structured threat model document that serves as both a security blueprint and a living reference. It includes the architecture diagram with trust boundaries, the complete threat inventory with risk scores, a prioritized list of mitigations, and a set of security requirements derived from the identified threats.

Risk Scoring Adapted for Web3

Traditional risk scoring uses the formula: Risk = Likelihood x Impact. This works well for patchable software where a discovered vulnerability can be remediated quickly. In Web3, we add a third factor that fundamentally changes the calculation: the immutability factor.

Our adapted formula is: Risk = Likelihood x Impact x Immutability Factor. The immutability factor ranges from 1.0 to 3.0 and reflects how difficult it is to remediate the vulnerability once discovered. A frontend vulnerability gets 1.0 (easily redeployed). An upgradeable smart contract behind a time-locked multi-sig gets 1.5. An immutable contract with no upgrade path gets 3.0 -- the only remediation is migration, which requires user action and may not reach all affected parties.

This scoring model correctly prioritizes threats in immutable components. A medium-likelihood, medium-impact vulnerability in an immutable contract scores higher than a high-likelihood, high-impact vulnerability in the frontend, because the frontend can be patched in minutes while the contract vulnerability will persist indefinitely. This aligns with the reality that the most catastrophic exploits in Web3 history have targeted immutable or quasi-immutable components.

From Threat Model to Security Requirements

A threat model that sits in a document and never influences development is a waste of effort. The critical step is translating identified threats into concrete, testable security requirements that become part of the development specification.

Each high and critical risk threat should produce one or more security requirements. The threat of oracle manipulation, for example, produces requirements like: use TWAP with a minimum 30-minute window for price-dependent operations; trigger a circuit breaker on price deviations beyond 10%; require at least two independent oracle sources to agree within 2%. These are specific, testable, and auditable.

For smart contract threats, requirements translate directly into code patterns and test cases. The threat of reentrancy produces requirements for checks-effects-interactions ordering, reentrancy guards on all state-changing functions, and attack simulation tests. Access control bypass threats produce requirements for role-based access control, two-step ownership transfers, and unauthorized access test cases for every restricted function.

We organize security requirements into a traceability matrix that links each requirement back to the threat it mitigates and forward to the code implementation and test case that validates it. This creates an auditable chain from threat to mitigation that satisfies both security auditors and compliance frameworks.

Integration with the Development Workflow

Threat modeling is not a one-time activity. The threat landscape evolves as new attack techniques emerge, and the protocol itself changes as features are added or integrations are updated. The question of when to threat model has a clear answer: early, often, and at every significant change.

The initial threat model should be created during the design phase, before code is written. This is when architectural decisions can still be influenced by security considerations -- choosing an upgradeable proxy pattern, selecting oracle providers, designing the governance mechanism. Threat modeling after the code is written is retroactive and expensive; changes at the architecture level require rewrites rather than adjustments.

After the initial model, incremental updates should occur at three triggers: when new features introduce new attack surface, when a significant exploit hits a protocol with similar architecture, and before every major release or audit engagement. Each trigger means the threat model may no longer accurately represent the system.

We recommend storing the threat model alongside the codebase in version control, making it a living document reviewed in pull requests alongside the code it relates to. Security requirements derived from the model should be tagged in the issue tracker so their status is visible to the entire team.

Putting It All Together

Web3 security is often reduced to smart contract audits -- important, but insufficient. An audit examines the code as it exists at a point in time. A threat model examines the system as a whole, considers how it might be attacked, and produces requirements that prevent vulnerabilities from being introduced in the first place. The most secure protocols we have worked with are the ones that invested in threat modeling before writing their first line of Solidity.

The framework we have outlined -- extending STRIDE with Web3-specific threat categories, mapping the full dApp attack surface, scoring risks with an immutability factor, and translating findings into testable requirements -- is the approach we use at Xcapit for every blockchain project we build or audit. It is not theoretical; it is battle-tested across DeFi protocols, enterprise blockchain solutions, and our own products that have served over four million users.

Threat Modeling Web3 Framework

At Xcapit, our cybersecurity practice combines ISO 27001 certification with deep Web3 expertise -- from threat modeling and smart contract audits to penetration testing and security architecture design. Whether you are building a DeFi protocol or an enterprise blockchain solution, we can help you identify and mitigate threats before they become exploits. Get in touch to discuss your project's security needs.

Share
Fernando Boiero

Fernando Boiero

CTO & Co-Founder

Over 20 years in the tech industry. Founder and director of Blockchain Lab, university professor, and certified PMP. Expert and thought leader in cybersecurity, blockchain, and artificial intelligence.

Let's build something great

AI, blockchain & custom software — tailored for your business.

Get in touch

Need a security partner you can trust?

Pentesting, ISO 27001, SOC 2 — we secure your systems.

Related Articles

·10 min

LLM Security: Defending Against Prompt Injection Attacks

A technical deep dive into prompt injection, indirect injection, jailbreaking, and data exfiltration attacks on large language models — with practical, layered defense strategies for teams building production AI systems.

·10 min

Zero Trust Architecture: A Practical Implementation Guide

A comprehensive implementation guide for Zero Trust Architecture — from understanding why perimeter security fails to deploying identity-centric security, micro-segmentation, and continuous verification across your organization, following the NIST 800-207 framework.