Crypto infrastructure is fundamentally API-driven. Every withdrawal a user initiates on an exchange passes through a withdrawal API. Every price update that triggers a liquidation on a DeFi lending protocol arrives via an oracle API. Every application that reads blockchain state queries an RPC endpoint. Every trading bot that executes a strategy calls an exchange API multiple times per second. APIs are not a peripheral concern in crypto security; they are the connective tissue of the entire ecosystem, and they move real money.
API security failures in crypto have a pattern that differs meaningfully from API security failures in other industries. When an API is misconfigured in a traditional web application, the attacker typically steals data or manipulates a user account. When an API is misconfigured in a crypto platform, the attacker drains funds. Transactions are irreversible. There are no chargebacks, no fraud investigations that recover assets, and no central authority to reverse the damage. The financial consequences of API security failures in crypto are therefore immediate, permanent, and potentially catastrophic.
This guide treats API security as an operational discipline, not a development checklist. Authentication, authorisation, rate limiting, monitoring, and incident response for API abuse each require ongoing operational attention across the lifetime of a platform, not just at the point of initial deployment.
The API Attack Surface in Crypto
Understanding the scope of the API attack surface is the starting point for effective API security. In a crypto organisation, the API surface extends across multiple distinct categories, each with different risk profiles and security requirements.
Exchange Trading and Withdrawal APIs
Centralised exchanges expose APIs for trading, account management, and withdrawals. Trading APIs are typically the highest-volume interface, processing thousands of requests per second from algorithmic traders and institutional clients. Withdrawal APIs are the highest-risk interface, as they enable the movement of funds off the platform. The risk profile differs markedly between these two: a compromised trading API key can cause trading losses and market manipulation; a compromised withdrawal API key with withdrawal permissions can result in direct asset theft. This distinction should drive the design of permission scoping and access controls for exchange API key issuance.
Oracle APIs: Price Feeds and Off-Chain Data
DeFi protocols depend on oracle APIs to bring real-world data on-chain: asset prices, interest rates, volatility indices, and other off-chain information that smart contracts use to determine protocol state. The oracle API is a critical dependency. If the price feed delivered by an oracle is manipulated, delayed, or spoofed, the protocol's collateralisation calculations, liquidation triggers, and fee mechanisms may all behave incorrectly. Oracle security is distinct from exchange API security: the threat is not credential theft but data integrity manipulation, and the attack surface includes both the oracle's own API and the on-chain data delivery mechanism.
RPC Endpoints: Node Access
Applications interact with blockchain nodes through remote procedure call (RPC) endpoints. A public Ethereum node, for example, exposes an RPC interface through which applications can read blockchain state, submit transactions, and query historical data. RPC endpoints range from fully public (accessible to anyone without authentication) to fully private (accessible only to authenticated, authorised callers). The security requirements differ accordingly. Public RPC endpoints face abuse from automated queries, bot traffic, and denial-of-service attempts. Private RPC endpoints must protect against credential theft and unauthorised access that could expose sensitive transaction data or enable manipulation of submitted transactions.
Wallet APIs and Developer SDKs
Wallet APIs expose functionality for creating and managing wallets, signing transactions, and querying balances. These APIs are used in both consumer-facing applications and institutional custody platforms. Developer SDK APIs enable third-party applications to integrate with a platform's functionality. Both categories carry authentication and authorisation risks: a compromised wallet API can expose user funds, while a poorly secured SDK API can create supply chain risk if the SDK is used in third-party applications. Internal microservice APIs, which connect the components of a platform's backend infrastructure, carry the additional risk of lateral movement: a compromised internal service can use internal API access to reach more privileged components of the system.
Common API Security Failures in Crypto
The same categories of API security failure appear repeatedly across crypto security incidents. These are not novel or sophisticated vulnerabilities; they are well-understood weaknesses that persist because of development speed pressures, lack of security review, and insufficient operational controls around API key management.
Leaked Exchange API Keys in Source Control
One of the most consistent and preventable API security failures in the crypto industry is the exposure of exchange API keys through GitHub and other public source code repositories. Developers frequently store API credentials in configuration files, environment variable files, or directly in source code during development, then accidentally commit and push these to public repositories. Automated scanning tools search public GitHub repositories continuously for patterns matching API key formats from major exchanges and crypto services. The window between a key being pushed and it being discovered and abused can be minutes.
This failure is entirely preventable. Pre-commit hooks and CI/CD pipeline checks using tools such as GitLeaks, TruffleHog, or GitHub's built-in secret scanning can detect API key patterns before they reach the repository. Development workflows should treat API credentials as secrets from their first use and require that they be stored only in dedicated secrets management systems, never in source files. Data loss prevention controls should include monitoring for credential patterns in code repositories.
Overpermissioned API Keys
Overpermissioned API keys are a structural risk that many crypto platforms inadvertently encourage. When an exchange offers API keys with configurable scopes (read, trade, withdraw), the path of least resistance for a developer is to create a key with all permissions enabled rather than invest the time to determine the minimum permissions actually required. The result is that keys created for read-only monitoring applications carry withdrawal permissions; keys created for a trading bot that should never need to withdraw funds are configured with full access. When any of these keys is compromised, the attacker has access to capabilities far beyond what the application required. The minimum permissions principle, creating keys with the narrowest scope sufficient for their intended function, is the structural control that limits the blast radius of key compromise.
Missing Rate Limiting
APIs without rate limiting are vulnerable to automated abuse at a scale that human-driven usage cannot reach. In the crypto context, missing rate limiting on exchange APIs enables high-frequency bot attacks that extract information about order books or user behaviour. Missing rate limiting on RPC endpoints makes them viable targets for denial-of-service attacks and free exploitation as data services. Missing rate limiting on authentication endpoints enables credential stuffing attacks. Rate limiting is not a complex control to implement, but it requires deliberate design: per-key limits, per-IP limits, and global limits must be calibrated to permit legitimate use while constraining abuse.
Predictable API Key Formats and Insecure Generation
API keys with predictable formats or insufficient entropy can be guessed or brute-forced. Keys should be generated using cryptographically secure random number generators, should have sufficient length and character space to make brute force computationally infeasible, and should not embed predictable elements such as user IDs, timestamps, or sequential numbers. Keys should also not be stored in plain text on the server side: the server should store only a hashed representation of the key, similar to the way passwords are stored, so that a database compromise does not expose all active keys simultaneously.
No IP Allowlisting on High-Risk Endpoints
IP allowlisting restricts API key usage to requests originating from specified IP addresses. For withdrawal APIs and other high-privilege endpoints, IP allowlisting is one of the most effective compensating controls against key compromise. Even if an attacker obtains a valid API key, they cannot use it unless they are connecting from an allowlisted IP. Many exchanges offer IP allowlisting as an optional feature; for institutional API users and any use case involving withdrawal access, it should be treated as mandatory rather than optional. The operational overhead is minimal: the permitted IP ranges for a trading bot or institutional integration are typically static and predictable.
API Authentication Best Practices
Authentication is the foundation of API security. Without reliable authentication, all other controls are secondary. For crypto platforms, the authentication requirements vary across API types, but several principles apply universally.
API Key Management: Generation, Storage, Rotation, and Revocation
The full lifecycle of an API key must be managed deliberately. At generation, keys should be created with explicit scope definitions and associated with a named owner and documented purpose. Organisations should maintain an inventory of all active API keys: which system uses each key, what permissions it has, when it was created, and when it is scheduled for rotation. This inventory is the operational foundation for key management.
Key storage should use dedicated secrets management platforms such as HashiCorp Vault, AWS Secrets Manager, or Azure Key Vault. These platforms provide encryption at rest, access logging, and programmatic rotation capability. Environment variables in deployment infrastructure are a reasonable mechanism for injecting secrets into applications at runtime, provided those variables are sourced from a secrets manager rather than stored in plain text in configuration files. Keys should never appear in application logs, error messages, or diagnostic output.
Rotation schedules should be defined based on the risk profile of the key. High-privilege keys, particularly those with withdrawal or write access, should be rotated on a shorter cycle than read-only keys, and all keys should be rotated immediately upon any personnel change affecting the key owner, any suspected compromise, or any security incident involving the systems that use the key.
HMAC Request Signing
HMAC (Hash-based Message Authentication Code) request signing is a widely used authentication mechanism for exchange and institutional crypto APIs. Rather than simply sending an API key with each request, the caller constructs an HMAC signature of the request parameters using a shared secret key, and includes both the API key identifier and the signature in the request. The server recalculates the expected signature and rejects any request where the signatures do not match. HMAC signing provides two security properties beyond basic API key authentication: it binds each request to a specific set of parameters (preventing replay attacks and parameter manipulation), and it protects the secret key itself from exposure, since the secret never travels in the request.
OAuth 2.0 and JWT for User-Facing APIs
User-facing APIs, where users authorise third-party applications to access their accounts, should implement OAuth 2.0 with appropriate grant types. OAuth enables users to grant specific, scoped permissions to third-party applications without sharing their primary credentials. JSON Web Tokens (JWTs) are commonly used to represent authorisation claims in API requests; they must be correctly validated on the server side, including signature verification and expiry checking. JWT implementation errors, such as accepting unsigned tokens, trusting the algorithm field specified in the token header, or failing to validate the audience claim, are a persistent source of authentication bypass vulnerabilities.
Mutual TLS for Machine-to-Machine Authentication
For machine-to-machine API communication, particularly between internal services and for institutional integrations, mutual TLS (mTLS) provides strong cryptographic authentication of both the client and the server. Unlike standard TLS where only the server presents a certificate, mTLS requires both parties to present valid certificates. This ensures that only authorised clients can connect to the API, regardless of whether a valid API key is presented. mTLS is particularly appropriate for internal microservice communication where zero-trust network architecture principles apply.
Rate Limiting and Abuse Prevention
Rate limiting controls the volume of requests a client can make to an API within a defined time window. It is the primary defence against automated abuse, denial-of-service attacks, and the extraction of information through enumeration. For crypto platforms, rate limiting must be designed with the specific abuse patterns of the ecosystem in mind.
Rate Limiting Strategies
Effective rate limiting applies multiple layers of constraints:
- Per-key rate limits cap the request volume associated with a specific API key. This is the most granular form of rate limiting and is the most effective for preventing abuse by authenticated callers. Limits should be calibrated by key type and permission level: a read-only market data key can reasonably support high request volumes, while a withdrawal key should have low limits that reflect genuine human-initiated usage patterns.
- Per-IP rate limits cap the total request volume from a given IP address, regardless of which key is used. This provides protection against attacks that cycle through multiple keys from a single IP, and against unauthenticated endpoints that cannot be constrained by key-level limits.
- Per-user limits aggregate requests across all keys associated with a user account. This prevents circumvention of per-key limits through key proliferation.
- Global rate limits cap the total request volume the platform will accept, protecting against volumetric denial-of-service attacks that overwhelm infrastructure even when individual key and IP limits have not been breached.
DDoS Protection for Public RPC Endpoints
Public RPC endpoints, by their nature, cannot restrict access to known clients. They must accept connections from anyone, which makes them inherently vulnerable to volumetric DDoS attacks. Protection requires a combination of rate limiting at the application level and upstream DDoS mitigation at the network or CDN layer. Services such as Cloudflare, AWS Shield, and Akamai provide volumetric DDoS mitigation that can absorb large-scale attacks before they reach application infrastructure. For high-traffic public RPC services, architecture decisions such as geographic distribution, caching of read-heavy endpoints, and load-shedding logic are important resilience measures alongside security controls.
WebSocket Connection Limits
WebSocket connections, used for real-time data streams such as order book updates and price feeds, present rate limiting challenges because they are persistent rather than per-request. Rate limiting for WebSocket APIs should address: the number of concurrent connections per key or IP; the message rate within an established connection; and the reconnection rate, to prevent connection cycling as a mechanism for evading per-connection limits. Idle connection cleanup, where connections that have not sent or received data for a defined period are terminated, reduces the server resource burden of abusive connection patterns.
RPC Endpoint Security
RPC endpoints are the interface through which applications interact with blockchain nodes. Their security requirements depend heavily on whether they are intended to be public or private, and what operations they expose.
Public vs Private RPC Endpoints
Public RPC endpoints provide open access to blockchain data without authentication. They are essential for decentralised application accessibility, as users should not need to run their own nodes to interact with a blockchain. However, the public availability of RPC endpoints creates an attack surface for abuse, data harvesting, and denial of service. Private RPC endpoints require authentication and restrict access to known clients. For applications that process sensitive transactions, access private wallet data, or require guaranteed performance, private RPC endpoints with strong authentication are appropriate. The design decision between public and private should be driven by the sensitivity of the operations performed and the performance guarantees required.
Restricting Exposed Methods
Not all RPC methods need to be exposed on all endpoints. The eth_sendRawTransaction method, which submits signed transactions to the network, enables asset movement and should not be exposed on read-only RPC endpoints intended for data queries. Restricting the methods available on each endpoint reduces the attack surface and limits what an attacker can do even with access to an endpoint. Method allowlisting, where only explicitly approved methods are accessible, is the appropriate configuration approach for production RPC endpoints.
Monitoring for Unusual Query Patterns
RPC endpoint monitoring should look for patterns that indicate automated abuse or reconnaissance. These include: rapid sequential requests for data about a large number of addresses (suggesting address enumeration); disproportionate use of computationally expensive methods such as eth_call with complex contract interactions; unusual spikes in transaction submission volume from a single IP or key; and requests for historical data patterns that suggest specific intelligence gathering. Anomaly detection based on baseline query patterns enables identification of abuse that stays within absolute rate limits but nonetheless represents non-genuine usage.
Archive Node Access Controls
Archive nodes maintain the full historical state of the blockchain, including all historical account balances and contract states. Access to archive node data is significantly more expensive to provide than access to current state, because archive queries require traversal of historical state trees. Archive RPC endpoints should require authentication and should be rate-limited more aggressively than standard full-node endpoints. Unlimited public archive access is operationally unsustainable and creates a resource exhaustion risk.
Oracle Security and API Manipulation
Oracle APIs occupy a uniquely important position in DeFi security. The integrity of on-chain protocol behaviour depends entirely on the integrity of the price data and off-chain information delivered by oracles. Oracle manipulation has been the root cause of some of the largest DeFi exploits.
"An oracle is only as trustworthy as the process that updates it. A protocol that relies on a single price feed has placed the security of all user funds in the hands of a single data source that can be manipulated, delayed, or compromised."
Price Oracle Manipulation Attacks
Price oracle manipulation attacks exploit the gap between the price reported by an oracle and the true market price. The classic mechanism is a flash loan attack: an attacker borrows a large amount of capital within a single transaction, uses it to manipulate the price on a DEX that the protocol uses as its price source, triggers a favourable protocol action (such as a low-collateral loan or an artificially inflated liquidation), then repays the flash loan and exits with the profit. The attack works because on-chain DEX prices can be moved by a single large trade, and because the protocol's oracle reads the spot price at the point of transaction execution without time-smoothing.
Mitigating Oracle Manipulation
Multiple complementary approaches reduce oracle manipulation risk:
- Time-weighted average pricing (TWAP). Rather than reading spot prices, protocols can read the time-weighted average price over a recent window (for example, the average price over the preceding 30 minutes). TWAP makes single-transaction price manipulation far more expensive, as the attacker would need to sustain the manipulated price across the entire averaging window.
- Multiple oracle sources. Aggregating price data from multiple independent sources, decentralised oracles such as Chainlink alongside on-chain DEX TWAPs, reduces reliance on any single data feed. Medianising across sources prevents a single compromised or manipulated feed from determining the reported price.
- Circuit breakers and sanity checks. Smart contracts can implement checks that reject price updates that deviate beyond a defined percentage from the previous price in a single update. This prevents extreme price spikes from being acted upon even if they pass through oracle validation.
- On-chain vs off-chain oracle trust models. Push-based oracles that deliver price data on-chain in separate transactions from the protocol interactions they inform are less susceptible to within-transaction manipulation than pull-based oracles that protocols call directly during transaction execution. Understanding the trust model of the oracle architecture in use is essential for assessing manipulation risk.
Monitoring for Anomalous Price Feed Data
Operational monitoring of oracle price feeds should include alerts for prices that deviate materially from external reference sources. If an on-chain oracle is reporting a price that differs substantially from the price on major centralised exchanges, this warrants investigation before the protocol acts on it. Incident response for oracle manipulation should include the ability to pause protocol operations while the anomaly is investigated, to prevent automated protocol mechanics from acting on manipulated data.
API Security Testing
API security testing is the process of systematically identifying vulnerabilities in API endpoints before attackers do. For crypto platforms, this is not a one-time pre-launch activity but an ongoing operational requirement, repeated after every significant change to API functionality.
OWASP API Security Top 10
The OWASP API Security Top 10 provides the most widely used framework for categorising API vulnerabilities. The current list covers: broken object-level authorisation (BOLA), which is the most common API vulnerability class and occurs when APIs fail to verify that the requesting user has permission to access the specific object being requested; broken authentication; broken object property level authorisation; unrestricted resource consumption (missing rate limiting); broken function-level authorisation; unrestricted access to sensitive business flows; server-side request forgery; security misconfiguration; improper inventory management; and unsafe consumption of APIs. Each of these categories has direct relevance to crypto platform APIs, and API penetration testing engagements should be structured to test explicitly for each class of vulnerability.
API Penetration Testing Methodology
API penetration testing for crypto platforms should follow a structured methodology. The engagement begins with API discovery and documentation review: mapping all available endpoints, supported methods, authentication mechanisms, and input parameters. Testing then proceeds through authentication and authorisation testing (including attempts to access resources belonging to other users, to bypass authentication controls, and to escalate privileges), input validation testing (fuzzing endpoints with malformed, unexpected, or malicious input to identify injection vulnerabilities and error handling failures), business logic testing (attempting to abuse the API's intended functionality, for example by manipulating transaction parameters or bypassing withdrawal limits), and rate limiting validation (confirming that limits are enforced and cannot be easily circumvented).
Business Logic Testing for Crypto APIs
Business logic vulnerabilities are among the most impactful and hardest to detect through automated scanning. In crypto APIs, business logic flaws might include: withdrawal logic that can be manipulated to send funds to an attacker-controlled address by intercepting and modifying signed withdrawal requests; order placement logic that can be abused to extract information about other users' orders; fee calculation logic that can be manipulated to reduce fees to zero; and referral or reward logic that can be exploited to generate artificial rewards. These vulnerabilities require a tester who understands the intended business logic of the platform, not just a generic API testing toolkit. Vulnerability management programmes should include a recurring business logic review component in addition to technical vulnerability scanning.
Automated API Security Scanning
Automated API security scanning tools can identify common vulnerability classes at scale and integrate into CI/CD pipelines to catch issues before deployment. Tools such as 42Crunch, APIsec, and Burp Suite's automated scanner can parse API specifications (OpenAPI/Swagger) and generate test cases for known vulnerability patterns. Automated scanning should be treated as a complement to manual testing, not a replacement for it: automated tools reliably find common, well-defined vulnerabilities but miss business logic flaws, authorisation context errors, and novel attack patterns. A layered approach combining automated scanning in the pipeline with periodic manual penetration testing engagements provides the most comprehensive coverage.
API Monitoring and Incident Response
API security does not end at deployment. Continuous monitoring of API activity is essential for detecting attacks in progress, identifying patterns that suggest reconnaissance or abuse, and providing the audit trail required for incident investigation and regulatory notification.
Logging All API Requests
Comprehensive API logging is the foundation of both monitoring and incident response. Every API request should generate a log record containing: the timestamp; the API key or authentication identifier; the source IP address; the requested endpoint and method; the response status code; the response time; and, where appropriate to the sensitivity of the operation, a record of the key parameters. For high-value operations such as withdrawals, transfers, and account configuration changes, a complete audit log including all parameters should be retained. Log retention periods should reflect both operational needs and regulatory requirements: under DORA, financial entities must retain ICT-related logs for periods sufficient to support incident investigation and regulatory examination.
API logs should be forwarded to a centralised security operations centre for correlation with other event data. An anomalous withdrawal request detected in API logs, correlated with a new IP address for the associated account and a concurrent identity provider authentication from an unusual location, provides a far richer picture of a potential account takeover than the API log alone.
Anomaly Detection for Unusual Trading Patterns
Exchange trading APIs should be monitored for patterns that may indicate market manipulation, algorithmic abuse, or compromised account activity. Indicators include: a sudden spike in order placement and cancellation frequency from a single account; orders placed at prices significantly away from the market that appear designed to move the order book rather than to trade; trading patterns consistent with wash trading or self-dealing; and withdrawal requests of unusual size or to new, unverified addresses. Anomaly detection for trading APIs requires establishing a behavioural baseline for each account and alerting when observed behaviour deviates materially from that baseline.
Alert Thresholds for Large Withdrawals
Withdrawal monitoring should include threshold-based alerts that trigger human review for any withdrawal above a defined value, regardless of whether other anomaly indicators are present. These thresholds should be calibrated to the platform's typical withdrawal volumes; the goal is to identify withdrawals that are large enough to warrant confirmation, not to alert on every transaction. Multi-layered withdrawal controls, combining threshold alerts with velocity checks (large volumes of withdrawals from a single account in a short period), new address detection (withdrawals to addresses not previously used by the account), and geographic anomaly detection (withdrawals requested from an IP address inconsistent with the account's historical location), provide the most effective early warning for withdrawal abuse.
Incident Response Playbook for Compromised API Keys
Every crypto platform should maintain a documented incident response playbook for compromised API key scenarios. The playbook should specify: the immediate containment step (revoke the compromised key without waiting for investigation to complete); the scope assessment steps (identify all operations performed using the key since its creation, with particular attention to the period following estimated compromise); notification procedures (which internal teams must be notified, in what order, and within what timeframes); and regulatory notification obligations (if user funds were accessed or exfiltrated, applicable regulations including DORA and MiCA may require notification to competent authorities within defined timeframes). The playbook should be tested through tabletop exercises at least annually, using realistic compromise scenarios relevant to the platform's API architecture.
Following any API key compromise incident, a root cause analysis should identify how the key was exposed. Common root causes include: accidental source code commit; third-party service compromise; phishing of the key owner; and insecure secrets management practices. Man-in-the-middle attacks targeting API communications are less common with modern TLS but remain a concern for applications running in compromised network environments or for API integrations that fail to validate TLS certificates correctly.
Regulatory Requirements
API security is addressed, explicitly or implicitly, in the regulatory frameworks that govern crypto and financial services firms. Compliance requirements provide both a baseline for API security controls and a driver for the operational investment required to maintain them.
DORA API Security Requirements
DORA Article 9 requires financial entities to implement protection and prevention measures for ICT systems, which encompasses API security controls including authentication, authorisation, and monitoring. Article 10 requires continuous monitoring for anomalous or suspicious ICT activities, which in the API context means the kind of real-time API monitoring and alerting described in this guide. Article 17 and the related technical standards on ICT incident management require that API security incidents are classified, reported internally, and, where they meet the materiality thresholds, notified to competent authorities. For crypto firms seeking DORA compliance, documented API security controls and evidence of their operational management will be subject to regulatory examination.
MiCA Operational Controls for API-Driven Services
MiCA Article 96 requires crypto asset service providers to implement security measures that ensure the integrity and confidentiality of data, including data transmitted via APIs. CASPs that provide services through APIs (which encompasses most exchange, custody, and DeFi integration services) must be able to demonstrate that their API infrastructure is secured against known attack patterns, that API security incidents are detected and responded to promptly, and that measures are in place to prevent unauthorised access to user funds through API compromise. MiCA's requirements for operational resilience also imply that API availability is managed and protected, not just API security.
PSD2 Strong Customer Authentication Considerations
For crypto exchanges that provide payment services or that are seeking licences in EU jurisdictions, the Payment Services Directive 2 (PSD2) strong customer authentication (SCA) requirements have relevance for user-facing API authentication. PSD2 SCA requires that authentication for payment initiation and account access relies on at least two of three factors: something the user knows (a password), something the user has (a device or token), and something the user is (biometric). For crypto exchanges offering euro-denominated payment services, ensuring that API-authenticated operations that initiate payments comply with PSD2 SCA requirements avoids regulatory exposure. The practical implication is that user-facing withdrawal APIs should require multi-factor authentication rather than API key authentication alone for transactions above PSD2 thresholds.
Frequently Asked Questions
What are the most common API security failures in crypto firms?
The most frequently observed API security failures in crypto firms are: exchange API keys leaked into public GitHub repositories; overpermissioned API keys that allow withdrawals when the application only needs read access; missing rate limiting that allows automated bot abuse; absent IP allowlisting on high-risk withdrawal endpoints; and insecure storage of API secrets in client-side code or environment files checked into source control. Many of these failures are preventable through a combination of developer education, API key scoping policies, and automated secret scanning in CI/CD pipelines.
How should a crypto exchange manage API key security?
Exchange API key management should follow these principles: keys should be generated with the minimum permissions required for their intended use, never with blanket withdrawal access unless the application explicitly requires it; keys should be bound to IP allowlists where technically feasible; keys should be rotated on a defined schedule, at minimum annually, and immediately upon any suspected compromise; key material should be stored in secrets management systems (such as HashiCorp Vault or AWS Secrets Manager) rather than in plain-text configuration files or environment variables in source code; and every key should have a named owner and a documented purpose so that unused keys can be identified and revoked.
What is OWASP API Security Top 10 and why does it matter for Web3?
The OWASP API Security Top 10 is a reference list of the most critical API security risks, published by the Open Web Application Security Project. It covers vulnerabilities including broken object-level authorisation, broken authentication, excessive data exposure, lack of rate limiting, and security misconfiguration. For Web3 platforms, the OWASP API Security Top 10 is directly applicable: DeFi protocol APIs, exchange APIs, and RPC endpoints frequently exhibit multiple vulnerabilities from this list. Using the OWASP API Security Top 10 as a testing framework during API penetration testing engagements ensures that assessments are systematic and cover the most impactful risk categories.
How do you secure a public RPC endpoint?
Securing a public RPC endpoint requires a layered approach. Rate limiting is the most critical control: without it, a public endpoint can be overwhelmed by automated queries or abused for free blockchain data access at scale. Rate limits should be applied per IP address and, where API keys are used, per key. Restricting the methods available through public endpoints reduces abuse surface: for example, excluding eth_sendRawTransaction from public endpoints unless transaction submission is the intended function. Monitoring for unusual query patterns, such as mass requests for specific addresses or unusual method combinations, enables detection of automated abuse before it becomes operationally significant. For high-traffic use cases, consider requiring API key registration for access, moving from a fully public to a semi-public model.
What should a crypto firm do if an API key is compromised?
The immediate response to a compromised API key should follow a defined playbook: revoke the compromised key immediately through the issuing platform's API key management interface; rotate any associated secrets (such as webhook secrets or signing keys used alongside the API key); audit API logs for the period since the key's last known-good use to identify any unauthorised operations performed using the key; if the key had withdrawal permissions and evidence of misuse is found, halt withdrawals and initiate an incident response process; notify affected parties if user data or funds were accessed; and conduct a root cause analysis to determine how the key was exposed, whether through source code exposure, secrets mismanagement, or third-party compromise.