Identifying the precise versions of third-party open-source software (OSS) components is fundamental to modern software engineering, impacting everything from long-term maintenance to software supply chain security. However, real-world OSS reuse often...
Identifying the precise versions of third-party open-source software (OSS) components is fundamental to modern software engineering, impacting everything from long-term maintenance to software supply chain security. However, real-world OSS reuse often involves modified or partially reused code, where hash-based and graph isomorphism approaches break down due to erroneous metadata, scalability constraints, and incomplete function call graphs. We present Mosaic, a framework for robust and scalable version identification in real-world source code. At its core, MOSAIC employs hierarchical divide-and-conquer graph homomorphism (HDC-GH) with progressive matching via leaf-node matching, subgraph isomorphism on local subgraphs, and modified-reuse detection. This structural analysis is further strengthened by identifying version-unique functions and inferring API boundaries, improving precision and recall. Evaluated on 20 large-scale OSS projects, MOSAIC attains an accuracy of 85.1% in TPL version identification, and 76.5% overall accuracy for detecting modified libraries, outperforming a state-of-the-art tool. It processes codebases of up to 15 million lines in under a minute and scales efficiently to much larger projects, producing interpretable, ranked results that establish a practical foundation for automated SBOM generation and resilient supply chain security.