How Vulnerabilities Propagate Through Code Reuse

22 concepts18 papers1 proposal

Modern software development is rarely built from scratch. To maximize efficiency, developers rely heavily on code reuse—copying snippets from Stack Overflow, inheriting from base frameworks, or forking entire repositories. While this dramatically accelerates development, it creates a hidden, systemic security vector: vulnerability propagation. When a single piece of code containing a security flaw is duplicated, that flaw is silently multiplied across every downstream application, creating a massive, synchronized attack surface.

The Crowdsourced Seed: Tutorials and Q&A Platforms

The most granular form of propagation occurs when developers copy-paste code snippets from online resources. Platforms like Stack Overflow and online programming tutorials frequently serve as "patient zero" for widespread vulnerabilities.

Intuitively, one might expect the community to filter out bad code over time. However, Mengsu Chen et al. demonstrated in How Reliable is the Crowdsourced Knowledge of Security Implementation? that crowdsourced ecosystems suffer from a perverse incentive loop. Insecure snippets are often easier to implement and lack the verbose boilerplate required for robust security. As a result, they receive more upvotes and higher visibility, driving further duplication.

This dynamic has severe real-world consequences. For instance, Felix Fischer et al. found in Stack Overflow Considered Harmful? The Impact of Copy&Paste on Android Application Security that over 15% of Android apps contained security-related code from Stack Overflow, and an alarming 97.9% of those apps inherited at least one insecure snippet.

Similarly, Tommi Unruh et al. showed in Leveraging Flawed Tutorials for Seeding Large-Scale Web Vulnerability Discovery how flawed web tutorials act as predictable "seeds" that propagate identical vulnerabilities across thousands of independent GitHub repositories. Even official documentation can act as a vector; Song Liao et al. discovered in SkillScanner: Detecting Policy-Violating Voice Applications Through Static Analysis at the Development Phase that many policy violations in voice applications stem directly from developers copying official reference templates.

Ecosystem Homogeneity: Forking and Template Inheritance

When code reuse scales from individual snippets to entire codebases or templates, the propagation effect becomes catastrophic. This is especially visible in highly homogeneous ecosystems like smart contracts, mini-apps, and cryptocurrencies.

In the Ethereum ecosystem, code duplication is exceptionally high. Vinoj Jayasundara 0001 et al. noted in SmartEmbed: A Tool for Clone and Bug Detection in Smart Contracts through Structural Code Embedding that roughly 90% of deployed smart contracts consist of clones. Ningyu He et al. confirmed this homogeneity in Characterizing Code Clones in the Ethereum Smart Contract Ecosystem, showing that over 96% of contracts have duplicates. This means a single flaw in a popular token template instantly exposes millions of dollars to risk across hundreds of independent contracts.

A similar pattern emerges when developers fork entire repositories to launch new projects. In the cryptocurrency space, Qingze Hum et al. demonstrated in CoinWatch: A Clone-Based Approach For Detecting Vulnerabilities in Cryptocurrencies that descendant projects silently inherit the security flaws of their parent codebases. This systemic risk extends to core consensus mechanisms; as Qin Wang et al. observed in Exploring Unfairness on Proof of Authority: Order Manipulation Attacks and Remedies, a subtle consensus flaw in a core engine can propagate across an entire ecosystem of derivative blockchains.

In the mobile "mini-app" paradigm, the reliance on third-party templates creates a massive, centralized point of failure. Yizhe Shi et al. revealed in The Skeleton Keys: A Large Scale Analysis of Credential Leakage in Mini-apps that when a base template contains insecure credential handling, tens of thousands of derivative applications inherit the exact same credential leakage risk, making manual remediation practically impossible.

Structural and Architectural Inheritance

Vulnerability propagation does not just happen horizontally across different developers; it also happens vertically through software architecture and object-oriented design.

At the language level, object-oriented mechanisms like method overriding can replicate bugs. Deqing Wang 0001 et al. explained in Detect Related Bugs from Source Code Using Bug Information that if a developer introduces a logical error in a base implementation, there is a high probability that the same flaw will manifest across "sibling" methods that extend or implement that interface.

This structural inheritance also plagues the very tools used to detect vulnerabilities. Static analysis tools often build upon foundational frameworks or share core design assumptions. Richard Bonett et al. showed in Discovering Flaws in Security-Focused Static Analysis Tools for Android using Systematic Mutation that flaws in foundational analysis frameworks are directly inherited by derivative tools. This insight was expanded by Amit Seal Ami et al. in Systematic Mutation-based Evaluation of the Soundness of Security-focused Android Static Analysis Techniques, demonstrating that independent security tools often share identical, undocumented blind spots due to shared code inheritance.

Finally, in hardware and firmware, code reuse causes vulnerabilities to persist across time. Eun-Soo Kim et al. found in BaseSpec: Comparative Analysis of Baseband Software and Cellular Specifications for L3 Protocols that cellular baseband firmware vulnerabilities frequently persist across multiple device generations and product lines because the underlying protocol stacks are continuously reused.

Breaking the Propagation Chain

Because propagated vulnerabilities share structural or textual lineage with their source, researchers can leverage this homogeneity to detect them at scale. Instead of treating every software project as an isolated entity, security tools can treat them as nodes in a lineage tree.

To manage these risks, Jian Shi et al. proposed CVMan: A Framework for Clone-Incurred Vulnerability Management, which tracks both the spatial relationships of code clones across different programs and their temporal evolution across versions. Furthermore, because training data for specific vulnerabilities can be sparse, Yuan He et al. introduced Vul-Mirror: A Few-Shot Learning Method for Discovering Vulnerable Code Clone, applying few-shot learning to recognize vulnerable code clones across projects even when only a few examples of the original bug are available.

Key Foundational Work

Leveraging Flawed Tutorials for Seeding Large-Scale Web Vulnerability Discovery (2017) — contributed 2 concept elements to this direction.
Stack Overflow Considered Harmful? The Impact of Copy&Paste on Android Application Security (2017) — contributed 1 concept elements to this direction.
Detect Related Bugs from Source Code Using Bug Information (2011) — contributed 1 concept elements to this direction.
History & citationVersion 1 · 2026-10-04

Current · Permanent link

View frozen version 1

Cite this direction

Latest version (a living page):

@misc{lacuna_vulnerability_propagation_via_code_reuse_6aebef8b,
  title = {vulnerability propagation via code reuse},
  author = {{Lacuna}},
  howpublished = {Lacuna research direction},
  year = {2026},
  url = {https://lacuna.tiptreesystems.com/direction/vulnerability-propagation-via-code-reuse/rdr_6aebef8b5fc1476193b7d43e92324ce9},
  note = {Latest version of a living research direction; cite a version for a fixed text. Accessed 2026-11-20},
}

This exact version (version 1, frozen text):

@misc{lacuna_vulnerability_propagation_via_code_reuse_6aebef8b_v1,
  title = {vulnerability propagation via code reuse},
  author = {{Lacuna}},
  howpublished = {Lacuna research direction},
  year = {2026},
  url = {https://lacuna.tiptreesystems.com/direction/vulnerability-propagation-via-code-reuse/rdr_6aebef8b5fc1476193b7d43e92324ce9/v/1},
  note = {Version 1, frozen 2026-10-04. Accessed 2026-11-20},
}
About

These directions overlap with this one through shared papers.

See something wrong? Report a mistake