SBOM and SCA: malicious typosquatting package
Before release, a software supply-chain audit was conducted. The CycloneDX SBOM exported using Syft, the project's package-lock.json file, the SCA security advisories database, and cached copies of packages with hasInstallScript: true were collected into the supply_audit.zip archive:
sbom.cdx.json— CycloneDX 1.5 SBOM (SHA-512hash of each component in hex format);package-lock.json— npm lockfile (resolvedURL,integrity: sha512-<base64>,hasInstallScript,dev);advisories.json— SCA vulnerability and typosquatting advisories;cached_packages/<nom>-<versiya>/— 5 packages with an install script (1 genuinely malicious, 4 decoy).
Task: identify the single production (not dev: true) malicious typosquatting package that simultaneously meets all three of the following supply-chain criteria:
- the
resolvedaddress inpackage-lock.jsonis not from the officialhttps://registry.npmjs.org/; - the
integrityhash inpackage-lock.json(when converting the base64 aftersha512-to hex) does not match theSHA-512hash insbom.cdx.json(integrity compromised); - there is an active
supply-chain-typosquatadvisory inadvisories.jsonfor the exact installed version.
Identify the postinstall script from the package.json file of the found package, statically analyze the script without running it (base64 + XOR), and recover the hidden flag. Flag format: BAYROQ{...} (the last 16 characters are lowercase hexadecimal digits).