Solutions

Company

Resources

Blog

Contact

Login

    • Assurance

      Smart Contract Assessment

      Securing code integrity, protecting digital assets

      Blockchain Layer 1 Assessment

      Assessing protocols, securing blockchain foundations

      Code Security Audit

      Uncovering flaws, strengthening software integrity

      Web Application Penetration Testing

      Exposing weaknesses, fortifying digital defenses

      Cloud Infrastructure Penetration Testing

      Securing configurations, protecting critical environments

      Red Team Exercise

      Simulating real-world attacks, strengthening defenses

      AI Red Teaming

      Testing AI systems against real threats

      AI Security Assessment

      Securing AI models, data, and pipelines

    • Advisory

      AI Advisory

      Guiding secure, strategic AI adoption forward

      Risk Assessment

      From unknown threats to actionable insights

      Blockchain Architecture Assessment

      Optimizing architecture for tomorrow’s networks

      Compliance Readiness

      Stay ready as regulations evolve

      Custody and Key Management Assessment

      Securing the heart of digital custody

      Technical Due Diligence

      See the risks before you invest

      Technical Training

      Empower your teams to secure what matters

    • Who We Are

      The best security engineers in the world

      Careers

      Work with the elite

      Who Trusts Us

      The trusted security advisor for blockchain and financial services industries

      Brand

      Access official logos, fonts, and guidelines

      Service Commitments

      Committed to Protecting Your Data

    • Audits

      In-depth evaluations of smart contracts and blockchain infrastructures

      BVSS

      Blockchain Vulnerability Scoring System

      Disclosures

      All the latest vulnerabilities discovered by Halborn

      Case Studies

      How Halborn’s solutions have empowered clients to overcome security issues

      Reports

      Comprehensive reports and data

  • Blog

  • Contact

  • Login

STAY CURRENT WITH HALBORN

Subscribe to the monthly Halborn Digest for our top blogs and videos, major company announcements, new whitepapers, webinar and event invites, and one exclusive interview.

ADVISORY SERVICES

AI AdvisoryRisk AssessmentBlockchain Architecture AssessmentCompliance ReadinessCustody and Key Management AssessmentTechnical Due DiligenceTechnical Training

ASSURANCE SERVICES

AI Security AssessmentAI Red TeamingSmart Contract AssessmentBlockchain Layer 1 AssessmentCode Security AuditWeb Application Penetration TestingCloud Infrastructure Penetration TestingRed Team Exercise

COMPANY

Who We AreWho Trusts UsService CommitmentsCareersBrandBlogContact

RESOURCES

AuditsDisclosuresReportsBVSSCase Studies
Halborn Logo
Privacy PolicyTerms of UseVulnerability Disclosure Policy

© Halborn 2026. All rights reserved.

Smart Contract Assessment

Securing code integrity, protecting digital assets

Blockchain Layer 1 Assessment

Assessing protocols, securing blockchain foundations

Code Security Audit

Uncovering flaws, strengthening software integrity

Web Application Penetration Testing

Exposing weaknesses, fortifying digital defenses

Cloud Infrastructure Penetration Testing

Securing configurations, protecting critical environments

Red Team Exercise

Simulating real-world attacks, strengthening defenses

AI Red Teaming

Testing AI systems against real threats

AI Security Assessment

Securing AI models, data, and pipelines

AI Advisory

Guiding secure, strategic AI adoption forward

Risk Assessment

From unknown threats to actionable insights

Blockchain Architecture Assessment

Optimizing architecture for tomorrow’s networks

Compliance Readiness

Stay ready as regulations evolve

Custody and Key Management Assessment

Securing the heart of digital custody

Technical Due Diligence

See the risks before you invest

Technical Training

Empower your teams to secure what matters

Who We Are

The best security engineers in the world

Careers

Work with the elite

Who Trusts Us

The trusted security advisor for blockchain and financial services industries

Brand

Access official logos, fonts, and guidelines

Service Commitments

Committed to Protecting Your Data

Audits

In-depth evaluations of smart contracts and blockchain infrastructures

BVSS

Blockchain Vulnerability Scoring System

Disclosures

All the latest vulnerabilities discovered by Halborn

Case Studies

How Halborn’s solutions have empowered clients to overcome security issues

Reports

Comprehensive reports and data

THIS WEBSITE USES COOKIES

We use cookies to personalise content and ads, to provide social media features and to analyse our traffic. We also share information about your use of our site with our social media, advertising and analytics partners who may combine it with other information that you've provided to them or that they've collected from your use of their services. You consent to our cookies if you continue to use our website. Learn More.

blog

What Is a CPIMP Attack in DeFi Smart Contracts?

Category: Blockchain Security

What Is a CPIMP Attack in DeFi Smart Contracts?

POSTED BY: Rob Behnke

12.15.2025

  • The role of the proxy in defi projects
  • How cpimp attacks work
  • Cpimp attack flow
  • Concealing their presence
  • Case study: the uspd hack
  • Protecting against cpimp attacks

Often, security efforts in the DeFi space focus on smart contract vulnerabilities or off-chain threats. However, while smart contract audits and private key security are important components of a DeFi security program, they’re not enough for security.

Clandestine Proxy-in-the-Middle of Proxy (CPIMP) attacks exploit vulnerabilities in the smart contract deployment process. They exploit the use of upgradeable proxies in smart contracts to allow an attacker to silently gain control over a project.

The Role of the Proxy in DeFi Projects

Proxies are a common feature within DeFi projects. Blockchains’ digital ledgers are famously immutable, and smart contracts are recorded on this ledger. This means that, once a smart contract has been deployed on-chain, it can’t be changed, which is a major problem for feature and security updates. By default, updates would require deploying an entirely new smart contract and pointing all users, frontends, etc., to the new address.

This is where a proxy contract comes into the picture. A proxy contract acts as a static point of contact for the project. It stores the address of another smart contract, which encodes all of the project’s logic, and forwards all requests to it using delegatecall. This way, logic can be updated by deploying a new smart contract and updating the address stored by the proxy contract. Since the proxy’s address doesn’t change, this means that no one needs to update their code to follow the change.

When deploying a project with an upgradeable proxy, a project needs to deploy both contracts on-chain, set the implementation address for the proxy, and define any required admin roles within the proxy. If not done correctly, this can introduce a vulnerability for an attacker to exploit.

How CPIMP Attacks Work

A CPIMP attack is a front-running attack targeting a project with a new upgradeable proxy contract. Attackers look for proxy contracts that are deployed without the target address or admins specified.

If this is the case, then an attacker may have a window to front-run the transaction used to configure these parameters in the proxy. To do so, they would deploy a second proxy pointing to the intended target contract and configure the legitimate proxy to point to their proxy and have them as the administrator.

When the project sends in its implementation transaction, it completes without reverting, making it appear that the implementation is successful. However, the attacker ensures that each transaction completes by putting itself in the implementation slot within the legitimate proxy’s storage space, preventing any upgrades that would remove their control.

CPIMP Attack Flow

The goal of a CPIMP contract is to perform a subtle on-path attack on an upgradeable proxy and its implementation. This includes allowing normal transactions to go through without raising the alarm.

CPIMP contracts accomplish this by inserting themselves between the legitimate proxy and the implementation. The transaction flow is as follows:

  • Transaction is submitted to legitimate proxy

  • Legitimate proxy delegatecalls the contract specified by its implementation address (CPIMP contract)

  • CPIMP contract receives call and executes tailored malicious logic (can edit transaction, block certain actions, etc.)

  • CPIMP contract delegatecalls implementation contract

  • Implementation contract executes the desired functionality


The deployment of the CPIMP contract between the legitimate proxy and implementation contract gives it a great deal of control while minimizing the risk of exposure. The malicious proxy could choose to forward transactions without any edits or take action to prevent undesirable actions, such as attempts to rescue stored funds or upgrades designed to remove the malicious proxy.

Concealing Their Presence

When CPIMP contracts were first discovered in the wild, they were found to be part of a broad, sophisticated attack campaign. Some of the ways that the attacker tailored these contracts to conceal their presence while maintaining control include:

  • Implementing backdoors that overrode admins on the legitimate proxy

  • Ending each transaction by setting the implementation to the attacker's address

  • Implementing logic tailored to a particular project or use case

  • Creating anti-recovery mechanisms that block transfers of over 90% of deposited funds

  • Support for bulk draining of tokens and ETH

  • Hiding from block explorers by placing deceptive implementation addresses at locations specified by an old OpenZeppelin proxy contract standard.


These and other techniques helped conceal the CPIMP proxy while providing it with full control over the target contract. Until the attacker made a big move, such as draining value from a target project, the primary sign of the attack was the fact that two delegatecalls are performed when executing transactions. However, few users perform this type of deep analysis, especially when transactions complete successfully.

Case Study: The USPD Hack

In December 2025, the US Permissionless Dollar (USPD), a USD stablecoin, was the victim of a CPIMP attack. Several months earlier, the attacker front-ran the implementation transaction, inserting a malicious proxy and taking control over the contract. In December 2025, the attacker performed an unauthorized mint of the stablecoin, allowing them to drain approximately $1 million from the protocol.

Protecting Against CPIMP Attacks

CPIMP attacks are subtle attacks that target the deployment phase of the smart contract lifecycle rather than exploiting vulnerabilities in the code. This means that a smart contract audit of the implementation contract won’t identify the issue. Instead, attackers take advantage of the deployment of uninitialized proxy contracts to insert their own, malicious contracts between the proxy and intended implementation.

To avoid this threat, proxy contracts should never be deployed in an uninitialized state. Instead, projects should perform atomic transactions that both deploy and initialize the contract within the space of a single transaction. This eliminates the opportunity for an attacker to front-run the transaction by ensuring that the deployment and initialization of the proxy contract are completed within the same transaction, succeeding or failing together.

Halborn offers a range of advisory services designed to help DeFi projects protect themselves against CPIMP and other sophisticated attacks. In addition to auditing smart contracts for vulnerabilities and business logic errors, Halborn advisors can also support a project from the early design stages through deployment on-chain. To learn more about how you can protect your project with Halborn, get in touch.

Related Blog Posts

blog

What Is a Digital Asset Treasury (DAT) Company?

08.12.2025

blog

What Is ERC-4337?

03.16.2023

Disclaimer

The information in this blog is for general educational and informational purposes only and does not constitute legal, financial, or professional advice. Halborn makes no representations as to the accuracy or completeness of the content, which may be updated or changed without notice.

blog

What Is Rollup-as-a-Service (RaaS) And What Are Its Advantages?

10.25.2023

blog

What Is Rollup-as-a-Service (RaaS) And What Are Its Advantages?

10.25.2023