Security conversations in DeFi often center on smart contracts. That work matters, but it does not cover the systems that deliver your interface, route requests, store secrets, and run ops.
Attackers know this. They use Web2 weaknesses to reach Web3 outcomes: transaction manipulation, key theft, hot wallet drains, and prolonged downtime. If you operate serious TVL, treat your off chain stack as part of the protocol security boundary.
This piece covers five Web2 vulnerability classes that repeatedly show up in DeFi incidents, what the attack path looks like in practice, and what to fix first.
The Top 5 Web2 Vulnerabilities Threatening Your DeFi Organization
1) Server Side Request Forgery (SSRF): Turning your server into a network pivot
SSRF happens when your backend fetches a URL supplied by a user, and the application fails to constrain where that request can go. The server becomes a proxy the attacker controls.
In DeFi stacks, SSRF often targets internal services that were never meant to be reachable from the public internet: cloud metadata endpoints, internal admin APIs, dashboards, object storage, and node or indexing infrastructure.
How it hits DeFi:
A common pattern is SSRF into a cloud metadata service to steal temporary credentials, then using those credentials to enumerate infrastructure, access secrets, and move laterally toward signing systems and privileged services. Even if keys are not stored on the same host, SSRF can still expose deployment tokens, database credentials, RPC credentials, and internal endpoints that should have been private.
What to do first:
- Enforce an allowlist for outbound fetches. If users can supply a URL, only allow known domains and known paths.
- Block link local and internal address space by default. This includes metadata IP ranges and RFC1918 ranges.
- Add egress controls at the network layer. Do not rely on application logic alone.
- Assume your cloud identity is the target. Lock down IAM roles and scope credentials to the minimum required permissions.
- Treat webhook testers, image proxies, and metadata fetchers as high risk components and isolate them.
2) Insecure Direct Object Reference (IDOR): Broken object level authorization
IDOR is a symptom of broken access control. The app uses an identifier from the client to access an object, but fails to verify the caller is authorized for that specific object.
In DeFi products, the risky objects are not limited to user profiles. They include withdrawal requests, address book entries, KYC artifacts, API keys, session records, recovery flows, notification settings, and any endpoint that touches a wallet action or security setting.
How it hits DeFi:
If an attacker can swap identifiers in an API request and the server does not enforce object level checks, they can:
- View or modify another user’s account state.
- Trigger actions on behalf of another user.
- Exfiltrate sensitive data that enables follow on compromise.
- In the worst cases, redirect withdrawals or drain balances when the API becomes the control plane for value movement.
What to do first:
- Derive identity from server side session context, not from client supplied IDs.
- Implement object level authorization in a single shared layer so it cannot be skipped per endpoint.
- Use deny by default. Require explicit authorization rules for every object access path.
- Log authorization failures with enough context to detect probing.
- Add automated tests that attempt ID swapping across every sensitive endpoint.
3) Remote Code Execution (RCE): Full compromise of the environment that runs your protocol
RCE means an attacker can execute arbitrary code on a server or service. In DeFi, that is rarely “just” a server issue. It is often the start of an operational breach: secrets access, CI compromise, transaction manipulation, signer targeting, and persistent backdoors.
Common causes:
- Unpatched dependencies and frameworks.
- Unsafe file uploads.
- Deserialization bugs.
- Template injection.
- Command injection paths that begin as “small” input handling bugs.
How it hits DeFi:
Once an attacker lands code execution, they go hunting for:
- Environment variables and config files.
- CI tokens, deploy keys, and build secrets.
- Cloud credentials and access keys.
- Admin panels and internal APIs.
- Anything adjacent to signing, transaction construction, or release pipelines.
RCE is also a supply chain problem. If your build pipeline is compromised, the “artifact” you ship can be malicious even when the source repository looks clean.
What to do first:
- Patch aggressively, especially internet facing services and build tooling.
- Isolate workloads. Keep public services separated from admin services, CI, and secrets.
- Move secrets into a dedicated vault and scope access with strict IAM and audit logging.
- Reduce blast radius with least privilege at every layer: OS, container, cloud, application.
- Monitor for process anomalies, unexpected outbound traffic, and new binaries.
4) Cross Site Scripting (XSS): Compromising the interface users trust
XSS is injected script that executes in a user’s browser under your origin. In DeFi, the browser is not a passive viewer. It is where users connect wallets and approve transactions.
A successful XSS can:
- Alter what users see before they sign.
- Swap recipient addresses.
- Prompt approvals that look routine but grant unlimited allowances.
- Inject malicious wallet interactions or redirect flows.
A well known DeFi example is BadgerDAO in 2021, where a malicious script in the frontend led users to unknowingly approve attacker controlled transfers at scale.
What to do first:
- Deploy a strict Content Security Policy and remove unsafe inline scripts where possible.
- Sanitize and encode all untrusted content, including token metadata and user generated fields.
- Pin and integrity check third party scripts. Avoid loading critical dependencies dynamically.
- Lock down your release pipeline. Frontend integrity is a build and deployment problem as much as it is an input validation problem.
- Add detection for DOM tampering and unexpected script injections.
5) Injection attacks and misconfigurations: The quiet root cause of catastrophic failures
Injection vulnerabilities (SQL, NoSQL, command injection) and security misconfigurations routinely become the enabling step for larger compromises.
Misconfigurations that repeatedly burn DeFi teams:
- Publicly reachable databases and admin consoles.
- Default credentials.
- Over permissive cloud storage buckets.
- Exposed RPC interfaces.
- Over privileged IAM roles.
- Missing network segmentation between tiers.
A notable infrastructure example is Mixin Network in 2023, where attackers compromised a cloud database environment and stole roughly $200M, illustrating how off chain control planes can directly translate to on chain losses.
What to do first:
- Use parameterized queries everywhere. Never build queries with string concatenation.
- Treat infrastructure as code and scan it. Misconfigurations should fail CI.
- Enforce network boundaries. Databases and internal admin services should not be public.
- Lock down RPC endpoints and require auth and allowlists where applicable.
- Continuously inventory assets and permissions. You cannot secure what you cannot enumerate.
Closing: Off chain security is protocol security
If you are protecting serious TVL, your frontend, APIs, CI, and cloud controls are part of the same threat model as your contracts. You need assurance across the whole stack, and you need it continuously.
Cantina is built to make that end to end coverage easier to run and easier to operationalize: managed security reviews, competitions, bug bounties, and guild expertise, all in one platform.
Request an off chain assessment that covers frontend, APIs, cloud, CI, and incident readiness. Contact us today to scope your next successful security engagement.
