@quantakrypto/core 0.4.3 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +76 -27
- package/dist/cbom-merge.d.ts +9 -0
- package/dist/cbom-merge.d.ts.map +1 -0
- package/dist/cbom-merge.js +121 -0
- package/dist/cbom-merge.js.map +1 -0
- package/dist/cbom.d.ts +5 -0
- package/dist/cbom.d.ts.map +1 -1
- package/dist/cbom.js +132 -37
- package/dist/cbom.js.map +1 -1
- package/dist/comments.d.ts +6 -26
- package/dist/comments.d.ts.map +1 -1
- package/dist/comments.js +77 -38
- package/dist/comments.js.map +1 -1
- package/dist/dependencies.d.ts.map +1 -1
- package/dist/dependencies.js +1 -1
- package/dist/dependencies.js.map +1 -1
- package/dist/detect-utils.d.ts +59 -21
- package/dist/detect-utils.d.ts.map +1 -1
- package/dist/detect-utils.js +143 -8
- package/dist/detect-utils.js.map +1 -1
- package/dist/detectors/age.d.ts +16 -0
- package/dist/detectors/age.d.ts.map +1 -0
- package/dist/detectors/age.js +40 -0
- package/dist/detectors/age.js.map +1 -0
- package/dist/detectors/ansible.d.ts +13 -0
- package/dist/detectors/ansible.d.ts.map +1 -0
- package/dist/detectors/ansible.js +108 -0
- package/dist/detectors/ansible.js.map +1 -0
- package/dist/detectors/bicep.d.ts +20 -0
- package/dist/detectors/bicep.d.ts.map +1 -0
- package/dist/detectors/bicep.js +74 -0
- package/dist/detectors/bicep.js.map +1 -0
- package/dist/detectors/c.d.ts +4 -2
- package/dist/detectors/c.d.ts.map +1 -1
- package/dist/detectors/c.js +222 -4
- package/dist/detectors/c.js.map +1 -1
- package/dist/detectors/cicd.d.ts +27 -0
- package/dist/detectors/cicd.d.ts.map +1 -0
- package/dist/detectors/cicd.js +129 -0
- package/dist/detectors/cicd.js.map +1 -0
- package/dist/detectors/cloud-kms.d.ts +24 -0
- package/dist/detectors/cloud-kms.d.ts.map +1 -0
- package/dist/detectors/cloud-kms.js +99 -0
- package/dist/detectors/cloud-kms.js.map +1 -0
- package/dist/detectors/cloudformation.d.ts +38 -0
- package/dist/detectors/cloudformation.d.ts.map +1 -0
- package/dist/detectors/cloudformation.js +201 -0
- package/dist/detectors/cloudformation.js.map +1 -0
- package/dist/detectors/codesign.d.ts +50 -0
- package/dist/detectors/codesign.d.ts.map +1 -0
- package/dist/detectors/codesign.js +143 -0
- package/dist/detectors/codesign.js.map +1 -0
- package/dist/detectors/csharp.d.ts.map +1 -1
- package/dist/detectors/csharp.js +13 -3
- package/dist/detectors/csharp.js.map +1 -1
- package/dist/detectors/dart.d.ts +35 -0
- package/dist/detectors/dart.d.ts.map +1 -0
- package/dist/detectors/dart.js +177 -0
- package/dist/detectors/dart.js.map +1 -0
- package/dist/detectors/database.d.ts +19 -0
- package/dist/detectors/database.d.ts.map +1 -0
- package/dist/detectors/database.js +97 -0
- package/dist/detectors/database.js.map +1 -0
- package/dist/detectors/dkim.d.ts +54 -0
- package/dist/detectors/dkim.d.ts.map +1 -0
- package/dist/detectors/dkim.js +92 -0
- package/dist/detectors/dkim.js.map +1 -0
- package/dist/detectors/dnssec.d.ts +55 -0
- package/dist/detectors/dnssec.d.ts.map +1 -0
- package/dist/detectors/dnssec.js +116 -0
- package/dist/detectors/dnssec.js.map +1 -0
- package/dist/detectors/elixir.d.ts +20 -0
- package/dist/detectors/elixir.d.ts.map +1 -0
- package/dist/detectors/elixir.js +227 -0
- package/dist/detectors/elixir.js.map +1 -0
- package/dist/detectors/java.d.ts.map +1 -1
- package/dist/detectors/java.js +34 -4
- package/dist/detectors/java.js.map +1 -1
- package/dist/detectors/jose.d.ts +20 -0
- package/dist/detectors/jose.d.ts.map +1 -0
- package/dist/detectors/jose.js +72 -0
- package/dist/detectors/jose.js.map +1 -0
- package/dist/detectors/jwk.d.ts +25 -0
- package/dist/detectors/jwk.d.ts.map +1 -0
- package/dist/detectors/jwk.js +131 -0
- package/dist/detectors/jwk.js.map +1 -0
- package/dist/detectors/k8s.d.ts +17 -0
- package/dist/detectors/k8s.d.ts.map +1 -0
- package/dist/detectors/k8s.js +88 -0
- package/dist/detectors/k8s.js.map +1 -0
- package/dist/detectors/keystore.d.ts +19 -0
- package/dist/detectors/keystore.d.ts.map +1 -0
- package/dist/detectors/keystore.js +76 -0
- package/dist/detectors/keystore.js.map +1 -0
- package/dist/detectors/mesh.d.ts +34 -0
- package/dist/detectors/mesh.d.ts.map +1 -0
- package/dist/detectors/mesh.js +91 -0
- package/dist/detectors/mesh.js.map +1 -0
- package/dist/detectors/messaging.d.ts +16 -0
- package/dist/detectors/messaging.d.ts.map +1 -0
- package/dist/detectors/messaging.js +79 -0
- package/dist/detectors/messaging.js.map +1 -0
- package/dist/detectors/objc.d.ts +41 -0
- package/dist/detectors/objc.d.ts.map +1 -0
- package/dist/detectors/objc.js +146 -0
- package/dist/detectors/objc.js.map +1 -0
- package/dist/detectors/openpgp.d.ts +20 -0
- package/dist/detectors/openpgp.d.ts.map +1 -0
- package/dist/detectors/openpgp.js +151 -0
- package/dist/detectors/openpgp.js.map +1 -0
- package/dist/detectors/pem.d.ts.map +1 -1
- package/dist/detectors/pem.js +33 -1
- package/dist/detectors/pem.js.map +1 -1
- package/dist/detectors/php.d.ts +25 -0
- package/dist/detectors/php.d.ts.map +1 -0
- package/dist/detectors/php.js +171 -0
- package/dist/detectors/php.js.map +1 -0
- package/dist/detectors/pkcs11.d.ts +17 -0
- package/dist/detectors/pkcs11.d.ts.map +1 -0
- package/dist/detectors/pkcs11.js +87 -0
- package/dist/detectors/pkcs11.js.map +1 -0
- package/dist/detectors/proxy.d.ts +52 -0
- package/dist/detectors/proxy.d.ts.map +1 -0
- package/dist/detectors/proxy.js +157 -0
- package/dist/detectors/proxy.js.map +1 -0
- package/dist/detectors/pulumi.d.ts +19 -0
- package/dist/detectors/pulumi.d.ts.map +1 -0
- package/dist/detectors/pulumi.js +80 -0
- package/dist/detectors/pulumi.js.map +1 -0
- package/dist/detectors/python.d.ts.map +1 -1
- package/dist/detectors/python.js +70 -0
- package/dist/detectors/python.js.map +1 -1
- package/dist/detectors/rust.d.ts.map +1 -1
- package/dist/detectors/rust.js +73 -0
- package/dist/detectors/rust.js.map +1 -1
- package/dist/detectors/secrets.d.ts +24 -0
- package/dist/detectors/secrets.d.ts.map +1 -0
- package/dist/detectors/secrets.js +63 -0
- package/dist/detectors/secrets.js.map +1 -0
- package/dist/detectors/solidity.d.ts +50 -0
- package/dist/detectors/solidity.d.ts.map +1 -0
- package/dist/detectors/solidity.js +108 -0
- package/dist/detectors/solidity.js.map +1 -0
- package/dist/detectors/source.d.ts.map +1 -1
- package/dist/detectors/source.js +243 -53
- package/dist/detectors/source.js.map +1 -1
- package/dist/detectors/spire.d.ts +49 -0
- package/dist/detectors/spire.d.ts.map +1 -0
- package/dist/detectors/spire.js +77 -0
- package/dist/detectors/spire.js.map +1 -0
- package/dist/detectors/ssh-ca.d.ts +72 -0
- package/dist/detectors/ssh-ca.d.ts.map +1 -0
- package/dist/detectors/ssh-ca.js +119 -0
- package/dist/detectors/ssh-ca.js.map +1 -0
- package/dist/detectors/stateful-hbs.d.ts.map +1 -1
- package/dist/detectors/stateful-hbs.js +9 -6
- package/dist/detectors/stateful-hbs.js.map +1 -1
- package/dist/detectors/supply-chain.d.ts +17 -0
- package/dist/detectors/supply-chain.d.ts.map +1 -0
- package/dist/detectors/supply-chain.js +89 -0
- package/dist/detectors/supply-chain.js.map +1 -0
- package/dist/detectors/swift.d.ts +22 -0
- package/dist/detectors/swift.d.ts.map +1 -0
- package/dist/detectors/swift.js +120 -0
- package/dist/detectors/swift.js.map +1 -0
- package/dist/detectors/terraform.d.ts +21 -0
- package/dist/detectors/terraform.d.ts.map +1 -0
- package/dist/detectors/terraform.js +150 -0
- package/dist/detectors/terraform.js.map +1 -0
- package/dist/detectors/vault.d.ts +15 -0
- package/dist/detectors/vault.d.ts.map +1 -0
- package/dist/detectors/vault.js +97 -0
- package/dist/detectors/vault.js.map +1 -0
- package/dist/detectors/vpn.d.ts +22 -0
- package/dist/detectors/vpn.d.ts.map +1 -0
- package/dist/detectors/vpn.js +73 -0
- package/dist/detectors/vpn.js.map +1 -0
- package/dist/detectors/weak-hash.d.ts +71 -0
- package/dist/detectors/weak-hash.d.ts.map +1 -0
- package/dist/detectors/weak-hash.js +116 -0
- package/dist/detectors/weak-hash.js.map +1 -0
- package/dist/detectors/webauthn.d.ts +61 -0
- package/dist/detectors/webauthn.d.ts.map +1 -0
- package/dist/detectors/webauthn.js +109 -0
- package/dist/detectors/webauthn.js.map +1 -0
- package/dist/detectors/xmldsig.d.ts +23 -0
- package/dist/detectors/xmldsig.d.ts.map +1 -0
- package/dist/detectors/xmldsig.js +84 -0
- package/dist/detectors/xmldsig.js.map +1 -0
- package/dist/evidence.d.ts +79 -4
- package/dist/evidence.d.ts.map +1 -1
- package/dist/evidence.js +76 -0
- package/dist/evidence.js.map +1 -1
- package/dist/index.d.ts +17 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +21 -9
- package/dist/index.js.map +1 -1
- package/dist/inventory.d.ts +0 -2
- package/dist/inventory.d.ts.map +1 -1
- package/dist/inventory.js +15 -6
- package/dist/inventory.js.map +1 -1
- package/dist/policy.d.ts +67 -0
- package/dist/policy.d.ts.map +1 -0
- package/dist/policy.js +115 -0
- package/dist/policy.js.map +1 -0
- package/dist/registry.d.ts +9 -4
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +81 -4
- package/dist/registry.js.map +1 -1
- package/dist/remediate-pipeline.d.ts +0 -3
- package/dist/remediate-pipeline.d.ts.map +1 -1
- package/dist/remediate-pipeline.js +23 -2
- package/dist/remediate-pipeline.js.map +1 -1
- package/dist/remediation.d.ts +10 -0
- package/dist/remediation.d.ts.map +1 -1
- package/dist/remediation.js +32 -0
- package/dist/remediation.js.map +1 -1
- package/dist/report.d.ts +9 -0
- package/dist/report.d.ts.map +1 -1
- package/dist/report.js +38 -1
- package/dist/report.js.map +1 -1
- package/dist/scan-worker.js +5 -3
- package/dist/scan-worker.js.map +1 -1
- package/dist/scan.d.ts.map +1 -1
- package/dist/scan.js +35 -6
- package/dist/scan.js.map +1 -1
- package/dist/standards-profiles.d.ts +58 -0
- package/dist/standards-profiles.d.ts.map +1 -0
- package/dist/standards-profiles.js +100 -0
- package/dist/standards-profiles.js.map +1 -0
- package/dist/standards.d.ts +96 -0
- package/dist/standards.d.ts.map +1 -0
- package/dist/standards.js +107 -0
- package/dist/standards.js.map +1 -0
- package/dist/types.d.ts +6 -5
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/dist/vex.d.ts +39 -0
- package/dist/vex.d.ts.map +1 -0
- package/dist/vex.js +87 -0
- package/dist/vex.js.map +1 -0
- package/dist/walk.d.ts +8 -3
- package/dist/walk.d.ts.map +1 -1
- package/dist/walk.js +32 -1
- package/dist/walk.js.map +1 -1
- package/package.json +1 -1
- package/src/cbom-merge.ts +146 -0
- package/src/cbom.ts +153 -39
- package/src/comments.ts +84 -39
- package/src/dependencies.ts +2 -1
- package/src/detect-utils.ts +146 -12
- package/src/detectors/age.ts +60 -0
- package/src/detectors/ansible.ts +140 -0
- package/src/detectors/bicep.ts +107 -0
- package/src/detectors/c.ts +240 -6
- package/src/detectors/cicd.ts +171 -0
- package/src/detectors/cloud-kms.ts +141 -0
- package/src/detectors/cloudformation.ts +250 -0
- package/src/detectors/codesign.ts +214 -0
- package/src/detectors/csharp.ts +13 -3
- package/src/detectors/dart.ts +237 -0
- package/src/detectors/database.ts +141 -0
- package/src/detectors/dkim.ts +172 -0
- package/src/detectors/dnssec.ts +195 -0
- package/src/detectors/elixir.ts +268 -0
- package/src/detectors/java.ts +39 -4
- package/src/detectors/jose.ts +110 -0
- package/src/detectors/jwk.ts +170 -0
- package/src/detectors/k8s.ts +115 -0
- package/src/detectors/keystore.ts +109 -0
- package/src/detectors/mesh.ts +130 -0
- package/src/detectors/messaging.ts +106 -0
- package/src/detectors/objc.ts +209 -0
- package/src/detectors/openpgp.ts +194 -0
- package/src/detectors/pem.ts +31 -1
- package/src/detectors/php.ts +230 -0
- package/src/detectors/pkcs11.ts +113 -0
- package/src/detectors/proxy.ts +236 -0
- package/src/detectors/pulumi.ts +106 -0
- package/src/detectors/python.ts +71 -0
- package/src/detectors/rust.ts +76 -0
- package/src/detectors/secrets.ts +103 -0
- package/src/detectors/solidity.ts +176 -0
- package/src/detectors/source.ts +283 -73
- package/src/detectors/spire.ts +143 -0
- package/src/detectors/ssh-ca.ts +215 -0
- package/src/detectors/stateful-hbs.ts +9 -6
- package/src/detectors/supply-chain.ts +117 -0
- package/src/detectors/swift.ts +149 -0
- package/src/detectors/terraform.ts +188 -0
- package/src/detectors/vault.ts +120 -0
- package/src/detectors/vpn.ts +103 -0
- package/src/detectors/weak-hash.ts +217 -0
- package/src/detectors/webauthn.ts +205 -0
- package/src/detectors/xmldsig.ts +115 -0
- package/src/evidence.ts +138 -4
- package/src/index.ts +50 -12
- package/src/inventory.ts +15 -7
- package/src/policy.ts +180 -0
- package/src/registry.ts +81 -4
- package/src/remediate-pipeline.ts +26 -3
- package/src/remediation.ts +39 -0
- package/src/report.ts +43 -1
- package/src/scan-worker.ts +5 -3
- package/src/scan.ts +41 -6
- package/src/standards-profiles.ts +136 -0
- package/src/standards.ts +186 -0
- package/src/types.ts +11 -4
- package/src/version.ts +1 -1
- package/src/vex.ts +122 -0
- package/src/walk.ts +33 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pem.js","sourceRoot":"","sources":["../../src/detectors/pem.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AASjE,MAAM,SAAS,GAAc;IAC3B;QACE,EAAE,EAAE,kCAAkC;QACtC,IAAI,EAAE;YACJ,EAAE,EAAE,qBA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ACpB,IAAI,EAAE,KAAK;YACX,GAAG,EAAE,iBAAiB;YACtB,OAAO,EACL,gGAAgG;YAClG,WAAW,EAAE,sDAAsD;SACpE;KACF;CACF,CAAC;AAEF,+DAA+D;AAC/D,MAAM,CAAC,MAAM,WAAW,GAAa;IACnC,EAAE,EAAE,cAAc;IAClB,WAAW,EAAE,6DAA6D;IAC1E,KAAK,EAAE,QAAQ;IACf,QAAQ,EAAE,KAAK;IACf,KAAK,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IACnC,uEAAuE;IACvE,SAAS,EAAE,GAAG,EAAE,CAAC,IAAI;IACrB,MAAM,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE;QACtB,+DAA+D;QAC/D,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC;YAAE,OAAO,EAAE,CAAC;QAEhD,MAAM,QAAQ,GAAc,EAAE,CAAC;QAC/B,KAAK,MAAM,IAAI,IAAI,SAAS,EAAE,CAAC;YAC7B,SAAS,CAAC,IAAI,CAAC,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE;gBAChC,QAAQ,CAAC,IAAI,CACX,eAAe,CAAC,IAAI,CAAC,IAAI,EAAE;oBACzB,IAAI;oBACJ,OAAO;oBACP,KAAK,EAAE,CAAC,CAAC,KAAK;oBACd,WAAW,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM;iBACzB,CAAC,CACH,CAAC;YACJ,CAAC,CAAC,CAAC;QACL,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF,CAAC","sourcesContent":["/**\n * Config / certificate detector: finds PEM-encoded cryptographic material in\n * any text file (source, config, .pem, .key, .crt, .env, …). This catches\n * embedded private keys and X.509 certificates regardless of language.\n *\n * Every rule's metadata lives in the {@link RuleMeta} declaration below (the\n * catalog entry); `detect()` builds findings straight from it via\n * `findingFromRule`. All PEM findings are high-confidence exact-marker matches.\n */\nimport type { Detector, Finding, RuleMeta } from \"../types.js\";\nimport { eachMatch, findingFromRule } from \"../detect-utils.js\";\nimport { CWE_BROKEN_CRYPTO, CWE_HARDCODED_KEY } from \"../cwe.js\";\n\n/** A PEM rule: its catalog metadata plus the begin-marker regex that triggers it. */\ninterface PemRule {\n /** Regex matching the PEM begin marker. */\n re: RegExp;\n meta: RuleMeta;\n}\n\nconst PEM_RULES: PemRule[] = [\n {\n re: /-----BEGIN RSA PRIVATE KEY-----/g,\n meta: {\n id: \"pem-rsa-private-key\",\n title: \"RSA private key (PEM)\",\n description: \"PKCS#1 RSA private key block\",\n category: \"certificate\",\n severity: \"critical\",\n confidence: \"high\",\n algorithm: \"RSA\",\n hndl: true,\n cwe: CWE_HARDCODED_KEY,\n sensitive: true,\n message: \"Embedded RSA private key (PKCS#1 PEM); classical and not quantum-safe.\",\n remediation: \"Migrate to ML-DSA / ML-KEM keys and remove embedded private keys from source.\",\n },\n },\n {\n re: /-----BEGIN EC PRIVATE KEY-----/g,\n meta: {\n id: \"pem-ec-private-key\",\n title: \"EC private key (PEM)\",\n description: \"SEC1 EC private key block\",\n category: \"certificate\",\n severity: \"critical\",\n confidence: \"high\",\n algorithm: \"ECDSA\",\n hndl: true,\n cwe: CWE_HARDCODED_KEY,\n sensitive: true,\n message: \"Embedded EC private key (SEC1 PEM); classical ECDSA/ECDH key, not quantum-safe.\",\n remediation:\n \"Migrate to ML-DSA (FIPS 204) keys and remove embedded private keys from source.\",\n },\n },\n {\n re: /-----BEGIN DSA PRIVATE KEY-----/g,\n meta: {\n id: \"pem-dsa-private-key\",\n title: \"DSA private key (PEM)\",\n description: \"DSA private key block\",\n category: \"certificate\",\n severity: \"critical\",\n confidence: \"high\",\n algorithm: \"DSA\",\n hndl: false,\n cwe: CWE_HARDCODED_KEY,\n sensitive: true,\n message:\n \"Embedded DSA private key (PEM); classical, already deprecated, and not quantum-safe.\",\n remediation: \"Rotate immediately (DSA is deprecated) and migrate to ML-DSA-65 (FIPS 204).\",\n },\n },\n {\n re: /-----BEGIN OPENSSH PRIVATE KEY-----/g,\n meta: {\n id: \"pem-openssh-private-key\",\n title: \"OpenSSH private key\",\n description: \"OpenSSH private key block\",\n category: \"certificate\",\n severity: \"critical\",\n confidence: \"high\",\n algorithm: \"unknown\",\n hndl: true,\n cwe: CWE_HARDCODED_KEY,\n sensitive: true,\n message: \"Embedded OpenSSH private key (RSA/ECDSA/Ed25519); classical and not quantum-safe.\",\n remediation:\n \"Rotate the key; plan migration to PQC-capable SSH (prefer the mlkem768x25519-sha256 KEX, OpenSSH 10's default since Apr 2025).\",\n },\n },\n {\n re: /-----BEGIN PGP PRIVATE KEY BLOCK-----/g,\n meta: {\n id: \"pem-pgp-private-key\",\n title: \"PGP/GPG private key block\",\n description: \"OpenPGP private key block\",\n category: \"certificate\",\n severity: \"critical\",\n confidence: \"high\",\n algorithm: \"unknown\",\n hndl: true,\n cwe: CWE_HARDCODED_KEY,\n sensitive: true,\n message:\n \"Embedded PGP/GPG private key block (RSA/ECDSA/EdDSA/ElGamal); classical and not quantum-safe.\",\n remediation: \"Rotate the key; track OpenPGP PQC drafts for migration.\",\n },\n },\n {\n re: /-----BEGIN PGP MESSAGE-----/g,\n meta: {\n id: \"pem-pgp-message\",\n title: \"PGP/GPG encrypted message\",\n description: \"OpenPGP encrypted message block\",\n category: \"certificate\",\n severity: \"low\",\n confidence: \"high\",\n algorithm: \"unknown\",\n hndl: true,\n cwe: CWE_BROKEN_CRYPTO,\n message:\n \"Embedded PGP/GPG message; likely encrypted with classical RSA/ElGamal (harvest-now-decrypt-later).\",\n remediation: \"Re-encrypt with PQC-capable tooling as OpenPGP PQC profiles mature.\",\n },\n },\n {\n re: /-----BEGIN (?:ENCRYPTED )?PRIVATE KEY-----/g,\n meta: {\n id: \"pem-pkcs8-private-key\",\n title: \"Private key (PKCS#8 PEM)\",\n description: \"PKCS#8 private key block\",\n category: \"certificate\",\n severity: \"critical\",\n confidence: \"high\",\n algorithm: \"unknown\",\n hndl: true,\n cwe: CWE_HARDCODED_KEY,\n sensitive: true,\n message: \"Embedded PKCS#8 private key; likely classical RSA/EC, not quantum-safe.\",\n remediation: \"Migrate to PQC keys and remove embedded private keys from source.\",\n },\n },\n {\n re: /-----BEGIN CERTIFICATE-----/g,\n meta: {\n id: \"pem-certificate\",\n title: \"X.509 certificate (PEM)\",\n description: \"X.509 certificate block\",\n category: \"certificate\",\n severity: \"low\",\n confidence: \"high\",\n algorithm: \"unknown\",\n hndl: false,\n cwe: CWE_BROKEN_CRYPTO,\n message: \"Embedded X.509 certificate; almost certainly signed with classical RSA/ECDSA.\",\n remediation: \"Plan re-issuance with PQC-capable CAs as ML-DSA certificate profiles mature.\",\n },\n },\n {\n re: /-----BEGIN (?:RSA )?PUBLIC KEY-----/g,\n meta: {\n id: \"pem-public-key\",\n title: \"Classical public key (PEM)\",\n description: \"SubjectPublicKeyInfo / PKCS#1 RSA public key block\",\n category: \"certificate\",\n severity: \"low\",\n confidence: \"high\",\n algorithm: \"unknown\",\n hndl: false,\n cwe: CWE_BROKEN_CRYPTO,\n message:\n \"Embedded classical public key (RSA/EC/DSA); its key pair is not quantum-safe — forgeable signatures or classical key exchange.\",\n remediation: \"Re-issue with PQC keys (ML-DSA / ML-KEM) as the ecosystem adopts them.\",\n },\n },\n {\n re: /-----BEGIN DH PARAMETERS-----/g,\n meta: {\n id: \"pem-dh-parameters\",\n title: \"Diffie-Hellman parameters (PEM)\",\n description: \"Finite-field DH group parameters block\",\n category: \"key-exchange\",\n severity: \"medium\",\n confidence: \"high\",\n algorithm: \"DH\",\n hndl: true,\n cwe: CWE_BROKEN_CRYPTO,\n message:\n \"Embedded finite-field Diffie-Hellman parameters; classical DH key exchange is harvest-now-decrypt-later exposed.\",\n remediation: \"Migrate key exchange to hybrid X25519MLKEM768 (ML-KEM-768).\",\n },\n },\n {\n re: /-----BEGIN (?:NEW )?CERTIFICATE REQUEST-----/g,\n meta: {\n id: \"pem-cert-request\",\n title: \"Certificate signing request (PEM)\",\n description: \"PKCS#10 certificate request block\",\n category: \"certificate\",\n severity: \"low\",\n confidence: \"high\",\n algorithm: \"unknown\",\n hndl: false,\n cwe: CWE_BROKEN_CRYPTO,\n message:\n \"Embedded PKCS#10 CSR; carries a classical public key and will be signed with classical crypto.\",\n remediation: \"Re-generate with PQC keys as PQC-capable CAs mature.\",\n },\n },\n];\n\n/** Detects PEM key/certificate material in arbitrary files. */\nexport const pemDetector: Detector = {\n id: \"pem-material\",\n description: \"PEM-encoded private keys and X.509 certificates in any file\",\n scope: \"config\",\n language: \"any\",\n rules: PEM_RULES.map((r) => r.meta),\n // Applies to every text file; the walker already filters out binaries.\n appliesTo: () => true,\n detect({ file, content }): Finding[] {\n // Fast reject: only proceed if a PEM header is present at all.\n if (!content.includes(\"-----BEGIN \")) return [];\n\n const findings: Finding[] = [];\n for (const rule of PEM_RULES) {\n eachMatch(rule.re, content, (m) => {\n findings.push(\n findingFromRule(rule.meta, {\n file,\n content,\n index: m.index,\n matchLength: m[0].length,\n }),\n );\n });\n }\n return findings;\n },\n};\n"]}
|
|
1
|
+
{"version":3,"file":"pem.js","sourceRoot":"","sources":["../../src/detectors/pem.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AASjE,MAAM,SAAS,GAAc;IAC3B;QACE,EAAE,EAAE,kCAAkC;QACtC,IAAI,EAAE;YACJ,EAAE,EAAE,qBAAqB;YACzB,KAAK,EAAE,uBAAuB;YAC9B,WAAW,EAAE,8BAA8B;YAC3C,QAAQ,EAAE,aAAa;YACvB,QAAQ,EAAE,UAAU;YACpB,UAAU,EAAE,MAAM;YAClB,SAAS,EAAE,KAAK;YAChB,IAAI,EAAE,IAAI;YACV,GAAG,EAAE,iBAAiB;YACtB,SAAS,EAAE,IAAI;YACf,OAAO,EAAE,wEAAwE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,IAAI,CAAC,IAAI,EAAE;oBACzB,IAAI;oBACJ,OAAO;oBACP,KAAK,EAAE,CAAC,CAAC,KAAK;oBACd,WAAW,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM;iBACzB,CAAC,CACH,CAAC;YACJ,CAAC,CAAC,CAAC;QACL,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF,CAAC","sourcesContent":["/**\n * Config / certificate detector: finds PEM-encoded cryptographic material in\n * any text file (source, config, .pem, .key, .crt, .env, …). This catches\n * embedded private keys and X.509 certificates regardless of language.\n *\n * Every rule's metadata lives in the {@link RuleMeta} declaration below (the\n * catalog entry); `detect()` builds findings straight from it via\n * `findingFromRule`. All PEM findings are high-confidence exact-marker matches.\n */\nimport type { Detector, Finding, RuleMeta } from \"../types.js\";\nimport { eachMatch, findingFromRule } from \"../detect-utils.js\";\nimport { CWE_BROKEN_CRYPTO, CWE_HARDCODED_KEY } from \"../cwe.js\";\n\n/** A PEM rule: its catalog metadata plus the begin-marker regex that triggers it. */\ninterface PemRule {\n /** Regex matching the PEM begin marker. */\n re: RegExp;\n meta: RuleMeta;\n}\n\nconst PEM_RULES: PemRule[] = [\n {\n re: /-----BEGIN RSA PRIVATE KEY-----/g,\n meta: {\n id: \"pem-rsa-private-key\",\n title: \"RSA private key (PEM)\",\n description: \"PKCS#1 RSA private key block\",\n category: \"certificate\",\n severity: \"critical\",\n confidence: \"high\",\n algorithm: \"RSA\",\n hndl: true,\n cwe: CWE_HARDCODED_KEY,\n sensitive: true,\n message: \"Embedded RSA private key (PKCS#1 PEM); classical and not quantum-safe.\",\n remediation: \"Migrate to ML-DSA / ML-KEM keys and remove embedded private keys from source.\",\n },\n },\n {\n re: /-----BEGIN EC PRIVATE KEY-----/g,\n meta: {\n id: \"pem-ec-private-key\",\n title: \"EC private key (PEM)\",\n description: \"SEC1 EC private key block\",\n category: \"certificate\",\n severity: \"critical\",\n confidence: \"high\",\n algorithm: \"ECDSA\",\n hndl: true,\n cwe: CWE_HARDCODED_KEY,\n sensitive: true,\n message: \"Embedded EC private key (SEC1 PEM); classical ECDSA/ECDH key, not quantum-safe.\",\n remediation:\n \"Migrate to ML-DSA (FIPS 204) for signatures or hybrid X25519MLKEM768 for key agreement; remove embedded private keys from source.\",\n },\n },\n {\n re: /-----BEGIN DSA PRIVATE KEY-----/g,\n meta: {\n id: \"pem-dsa-private-key\",\n title: \"DSA private key (PEM)\",\n description: \"DSA private key block\",\n category: \"certificate\",\n severity: \"critical\",\n confidence: \"high\",\n algorithm: \"DSA\",\n hndl: false,\n cwe: CWE_HARDCODED_KEY,\n sensitive: true,\n message:\n \"Embedded DSA private key (PEM); classical, already deprecated, and not quantum-safe.\",\n remediation: \"Rotate immediately (DSA is deprecated) and migrate to ML-DSA-65 (FIPS 204).\",\n },\n },\n {\n re: /-----BEGIN OPENSSH PRIVATE KEY-----/g,\n meta: {\n id: \"pem-openssh-private-key\",\n title: \"OpenSSH private key\",\n description: \"OpenSSH private key block\",\n category: \"certificate\",\n severity: \"critical\",\n confidence: \"high\",\n algorithm: \"unknown\",\n hndl: true,\n cwe: CWE_HARDCODED_KEY,\n sensitive: true,\n message: \"Embedded OpenSSH private key (RSA/ECDSA/Ed25519); classical and not quantum-safe.\",\n remediation:\n \"Rotate the key; plan migration to PQC-capable SSH (prefer the mlkem768x25519-sha256 KEX, OpenSSH 10's default since Apr 2025).\",\n },\n },\n {\n re: /-----BEGIN PGP PRIVATE KEY BLOCK-----/g,\n meta: {\n id: \"pem-pgp-private-key\",\n title: \"PGP/GPG private key block\",\n description: \"OpenPGP private key block\",\n category: \"certificate\",\n severity: \"critical\",\n confidence: \"high\",\n algorithm: \"unknown\",\n hndl: true,\n cwe: CWE_HARDCODED_KEY,\n sensitive: true,\n message:\n \"Embedded PGP/GPG private key block (RSA/ECDSA/EdDSA/ElGamal); classical and not quantum-safe.\",\n remediation: \"Rotate the key; track OpenPGP PQC drafts for migration.\",\n },\n },\n {\n re: /-----BEGIN PGP MESSAGE-----/g,\n meta: {\n id: \"pem-pgp-message\",\n title: \"PGP/GPG encrypted message\",\n description: \"OpenPGP encrypted message block\",\n category: \"certificate\",\n severity: \"low\",\n confidence: \"high\",\n algorithm: \"unknown\",\n hndl: true,\n cwe: CWE_BROKEN_CRYPTO,\n message:\n \"Embedded PGP/GPG message; likely encrypted with classical RSA/ElGamal (harvest-now-decrypt-later).\",\n remediation: \"Re-encrypt with PQC-capable tooling as OpenPGP PQC profiles mature.\",\n },\n },\n {\n re: /-----BEGIN (?:ENCRYPTED )?PRIVATE KEY-----/g,\n meta: {\n id: \"pem-pkcs8-private-key\",\n title: \"Private key (PKCS#8 PEM)\",\n description: \"PKCS#8 private key block\",\n category: \"certificate\",\n severity: \"critical\",\n confidence: \"high\",\n algorithm: \"unknown\",\n hndl: true,\n cwe: CWE_HARDCODED_KEY,\n sensitive: true,\n message: \"Embedded PKCS#8 private key; likely classical RSA/EC, not quantum-safe.\",\n remediation: \"Migrate to PQC keys and remove embedded private keys from source.\",\n },\n },\n {\n re: /-----BEGIN CERTIFICATE-----/g,\n meta: {\n id: \"pem-certificate\",\n title: \"X.509 certificate (PEM)\",\n description: \"X.509 certificate block\",\n category: \"certificate\",\n severity: \"low\",\n confidence: \"high\",\n algorithm: \"unknown\",\n hndl: false,\n cwe: CWE_BROKEN_CRYPTO,\n message: \"Embedded X.509 certificate; almost certainly signed with classical RSA/ECDSA.\",\n remediation: \"Plan re-issuance with PQC-capable CAs as ML-DSA certificate profiles mature.\",\n },\n },\n {\n re: /-----BEGIN (?:RSA )?PUBLIC KEY-----/g,\n meta: {\n id: \"pem-public-key\",\n title: \"Classical public key (PEM)\",\n description: \"SubjectPublicKeyInfo / PKCS#1 RSA public key block\",\n category: \"certificate\",\n severity: \"low\",\n confidence: \"high\",\n algorithm: \"unknown\",\n hndl: false,\n cwe: CWE_BROKEN_CRYPTO,\n message:\n \"Embedded classical public key (RSA/EC/DSA); its key pair is not quantum-safe — forgeable signatures or classical key exchange.\",\n remediation: \"Re-issue with PQC keys (ML-DSA / ML-KEM) as the ecosystem adopts them.\",\n },\n },\n {\n re: /-----BEGIN DH PARAMETERS-----/g,\n meta: {\n id: \"pem-dh-parameters\",\n title: \"Diffie-Hellman parameters (PEM)\",\n description: \"Finite-field DH group parameters block\",\n category: \"key-exchange\",\n severity: \"medium\",\n confidence: \"high\",\n algorithm: \"DH\",\n hndl: true,\n cwe: CWE_BROKEN_CRYPTO,\n message:\n \"Embedded finite-field Diffie-Hellman parameters; classical DH key exchange is harvest-now-decrypt-later exposed.\",\n remediation: \"Migrate key exchange to hybrid X25519MLKEM768 (ML-KEM-768).\",\n },\n },\n {\n re: /-----BEGIN (?:NEW )?CERTIFICATE REQUEST-----/g,\n meta: {\n id: \"pem-cert-request\",\n title: \"Certificate signing request (PEM)\",\n description: \"PKCS#10 certificate request block\",\n category: \"certificate\",\n severity: \"low\",\n confidence: \"high\",\n algorithm: \"unknown\",\n hndl: false,\n cwe: CWE_BROKEN_CRYPTO,\n message:\n \"Embedded PKCS#10 CSR; carries a classical public key and will be signed with classical crypto.\",\n remediation: \"Re-generate with PQC keys as PQC-capable CAs mature.\",\n },\n },\n];\n\n/**\n * True when what follows the begin marker looks like a REAL PEM block rather than a\n * `-----BEGIN …-----` header STRING LITERAL (as appears in PEM parsers, tests, and\n * i18n messages). `from` points just past the begin marker. Three accepting signals:\n *\n * (a) a full LINE of base64 (≥24 chars, optional `=` padding) — real multi-line PEM\n * bodies are line-wrapped base64; requiring the whole line to be base64 stops a\n * long camelCase identifier on a code line from validating a bare header constant.\n * (b) an ESCAPED-newline base64 run (`\\n<base64>`, a LITERAL backslash-n) — a key\n * embedded in a single-line JSON/.env string (GCP service accounts, `PRIVATE_KEY=\n * \"…\\n…\"`), whose body can run past the window before its `-----END`. The literal\n * `\\n` escape distinguishes it from a source constant, which has a REAL newline.\n * (c) a matching `-----END …-----` marker with NO double-quote between it and the\n * begin marker. This admits short/placeholder bodies (`x`, `abc`, `MIIB` in tests)\n * while rejecting a parser's PAIRED header/footer constants, whose intervening\n * `\";` … `= \"` always contains a `\"` — a char a real PEM body never holds.\n */\nfunction hasBase64Body(content: string, from: number): boolean {\n const window = content.slice(from, from + 800);\n if (/^[ \\t]*[A-Za-z0-9+/]{24,}={0,2}[ \\t]*$/m.test(window)) return true;\n if (/\\\\n[A-Za-z0-9+/]{24,}/.test(window)) return true;\n const end = window.search(/-----END [A-Z0-9 ]+-----/);\n return end >= 0 && !window.slice(0, end).includes('\"');\n}\n\n/** Detects PEM key/certificate material in arbitrary files. */\nexport const pemDetector: Detector = {\n id: \"pem-material\",\n description: \"PEM-encoded private keys and X.509 certificates in any file\",\n scope: \"config\",\n language: \"any\",\n rules: PEM_RULES.map((r) => r.meta),\n // Applies to every text file; the walker already filters out binaries.\n appliesTo: () => true,\n detect({ file, content }): Finding[] {\n // Fast reject: only proceed if a PEM header is present at all.\n if (!content.includes(\"-----BEGIN \")) return [];\n\n const findings: Finding[] = [];\n for (const rule of PEM_RULES) {\n eachMatch(rule.re, content, (m) => {\n // Require an actual base64 body after the marker, so a bare\n // `-----BEGIN RSA PRIVATE KEY-----` string literal in a PEM parser / test /\n // i18n message does NOT get reported as an embedded key. A real PEM block has\n // a run of base64 within the next few hundred chars.\n if (!hasBase64Body(content, m.index + m[0].length)) return;\n findings.push(\n findingFromRule(rule.meta, {\n file,\n content,\n index: m.index,\n matchLength: m[0].length,\n }),\n );\n });\n }\n return findings;\n },\n};\n"]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Source-code detector for classical asymmetric cryptography in PHP — one of the
|
|
3
|
+
* most-deployed backend languages, previously uncovered. Handles the three
|
|
4
|
+
* dominant crypto surfaces:
|
|
5
|
+
*
|
|
6
|
+
* - **ext/openssl** — `openssl_pkey_new()` (classified by its
|
|
7
|
+
* `OPENSSL_KEYTYPE_*` config, defaulting to RSA), `openssl_public_encrypt` /
|
|
8
|
+
* `openssl_private_decrypt` / `openssl_seal` / `openssl_open` (RSA), and
|
|
9
|
+
* `openssl_sign` / `openssl_verify`.
|
|
10
|
+
* - **phpseclib3** — `RSA::createKey()` / `EC::createKey()` / `DSA::createKey()`.
|
|
11
|
+
* - **libsodium** — `sodium_crypto_box`/`kx` keypairs (X25519) and
|
|
12
|
+
* `sodium_crypto_sign` keypairs (Ed25519).
|
|
13
|
+
*
|
|
14
|
+
* Lexical, like the other packs; the `openssl_*` / `sodium_crypto_*` prefixes and
|
|
15
|
+
* `OPENSSL_KEYTYPE_*` constants are distinctive, so the false-positive rate is low.
|
|
16
|
+
*
|
|
17
|
+
* HNDL: RSA encryption and (EC/X)DH key agreement are harvest-now-decrypt-later
|
|
18
|
+
* exposed (hndl:true); ECDSA / DSA / Ed25519 signatures are hndl:false but
|
|
19
|
+
* forgeable. `openssl_pkey_new` EC and `EC::createKey` are ambiguous (feed BOTH
|
|
20
|
+
* ECDSA and ECDH), classified conservatively as key-exchange-capable (hndl:true).
|
|
21
|
+
*/
|
|
22
|
+
import type { Detector } from "../types.js";
|
|
23
|
+
/** Detects classical asymmetric crypto in PHP (openssl, phpseclib, libsodium). */
|
|
24
|
+
export declare const phpDetector: Detector;
|
|
25
|
+
//# sourceMappingURL=php.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"php.d.ts","sourceRoot":"","sources":["../../src/detectors/php.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAqB,MAAM,aAAa,CAAC;AAyI/D,kFAAkF;AAClF,eAAO,MAAM,WAAW,EAAE,QAsEzB,CAAC"}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { PHP_EXTENSIONS, eachMatch, findingFromRule, hasExtension } from "../detect-utils.js";
|
|
2
|
+
import { CWE_BROKEN_CRYPTO } from "../cwe.js";
|
|
3
|
+
const RE_PHP_PKEY_NEW = /\bopenssl_pkey_new\s*\(/g;
|
|
4
|
+
// public_encrypt/private_decrypt (direct RSA) plus seal/open (RSA-envelope: seal
|
|
5
|
+
// encrypts a random symmetric key under each recipient's RSA public key, open
|
|
6
|
+
// decrypts it with the private key) — all RSA key transport, harvest-now exposed.
|
|
7
|
+
const RE_PHP_RSA_CRYPT = /\bopenssl_(?:public_encrypt|private_decrypt|seal|open)\s*\(/g;
|
|
8
|
+
const RE_PHP_SIGN = /\bopenssl_(?:sign|verify)\s*\(/g;
|
|
9
|
+
// phpseclib3 factory methods. The class names are generic, so require `::createKey`.
|
|
10
|
+
const RE_PHP_SECLIB = /\b(RSA|EC|DSA|DH)::createKey\s*\(/g;
|
|
11
|
+
// libsodium X25519 (box / kx / scalarmult) and Ed25519 (sign) key pairs.
|
|
12
|
+
const RE_PHP_SODIUM_X25519 = /\bsodium_crypto_(?:box|kx)_(?:seed_)?keypair\s*\(|\bsodium_crypto_scalarmult(?:_base)?\s*\(/g;
|
|
13
|
+
// Also the explicit-algorithm variant sodium_crypto_sign_ed25519_keypair().
|
|
14
|
+
const RE_PHP_SODIUM_ED25519 = /\bsodium_crypto_sign_(?:ed25519_|seed_)?keypair\s*\(/g;
|
|
15
|
+
const HYBRID = "hybrid X25519MLKEM768 (ML-KEM-768) for key agreement; ML-DSA-65 (FIPS 204) to sign";
|
|
16
|
+
const RULE_PHP_KEYGEN = {
|
|
17
|
+
id: "php-openssl-keygen",
|
|
18
|
+
title: "PHP openssl key generation",
|
|
19
|
+
description: "openssl_pkey_new (RSA/EC/DSA/DH, by OPENSSL_KEYTYPE_*)",
|
|
20
|
+
category: "kem",
|
|
21
|
+
severity: "high",
|
|
22
|
+
confidence: "high",
|
|
23
|
+
algorithm: "RSA",
|
|
24
|
+
hndl: true,
|
|
25
|
+
cwe: CWE_BROKEN_CRYPTO,
|
|
26
|
+
message: "Generates a classical key pair via PHP openssl_pkey_new — not quantum-safe.",
|
|
27
|
+
};
|
|
28
|
+
const RULE_PHP_RSA_CRYPT = {
|
|
29
|
+
id: "php-openssl-rsa-crypt",
|
|
30
|
+
title: "PHP openssl RSA public-key encryption",
|
|
31
|
+
description: "openssl_public_encrypt / openssl_private_decrypt / openssl_seal / openssl_open",
|
|
32
|
+
category: "kem",
|
|
33
|
+
severity: "high",
|
|
34
|
+
confidence: "high",
|
|
35
|
+
algorithm: "RSA",
|
|
36
|
+
hndl: true,
|
|
37
|
+
cwe: CWE_BROKEN_CRYPTO,
|
|
38
|
+
message: "RSA public-key encryption/decryption (PHP openssl) is harvest-now-decrypt-later exposed.",
|
|
39
|
+
};
|
|
40
|
+
const RULE_PHP_SIGN = {
|
|
41
|
+
id: "php-openssl-sign",
|
|
42
|
+
title: "PHP openssl signature",
|
|
43
|
+
description: "openssl_sign / openssl_verify",
|
|
44
|
+
category: "signature",
|
|
45
|
+
severity: "high",
|
|
46
|
+
confidence: "high",
|
|
47
|
+
algorithm: "unknown",
|
|
48
|
+
hndl: false,
|
|
49
|
+
cwe: CWE_BROKEN_CRYPTO,
|
|
50
|
+
message: "Classical signature via PHP openssl (RSA/ECDSA/DSA) is forgeable by a quantum attacker.",
|
|
51
|
+
remediation: "ML-DSA-65 (FIPS 204) or SLH-DSA (FIPS 205)",
|
|
52
|
+
};
|
|
53
|
+
const RULE_PHP_SECLIB = {
|
|
54
|
+
id: "php-phpseclib-keygen",
|
|
55
|
+
title: "PHP phpseclib key generation",
|
|
56
|
+
description: "phpseclib3 RSA/EC/DSA/DH ::createKey",
|
|
57
|
+
category: "kem",
|
|
58
|
+
severity: "high",
|
|
59
|
+
confidence: "medium",
|
|
60
|
+
algorithm: "RSA",
|
|
61
|
+
hndl: true,
|
|
62
|
+
cwe: CWE_BROKEN_CRYPTO,
|
|
63
|
+
message: "Generates a classical key pair via phpseclib3 (createKey) — not quantum-safe.",
|
|
64
|
+
};
|
|
65
|
+
const RULE_PHP_SODIUM_X25519 = {
|
|
66
|
+
id: "php-sodium-x25519",
|
|
67
|
+
title: "PHP libsodium X25519 key agreement",
|
|
68
|
+
description: "sodium_crypto_box/kx keypair + scalarmult",
|
|
69
|
+
category: "key-exchange",
|
|
70
|
+
severity: "medium",
|
|
71
|
+
confidence: "high",
|
|
72
|
+
algorithm: "X25519",
|
|
73
|
+
hndl: true,
|
|
74
|
+
cwe: CWE_BROKEN_CRYPTO,
|
|
75
|
+
message: "libsodium crypto_box/kx (PHP) uses X25519 key agreement — modern but classical, harvest-now-decrypt-later exposed.",
|
|
76
|
+
};
|
|
77
|
+
const RULE_PHP_SODIUM_ED25519 = {
|
|
78
|
+
id: "php-sodium-ed25519",
|
|
79
|
+
title: "PHP libsodium Ed25519 signature",
|
|
80
|
+
description: "sodium_crypto_sign keypair",
|
|
81
|
+
category: "signature",
|
|
82
|
+
severity: "low",
|
|
83
|
+
confidence: "high",
|
|
84
|
+
algorithm: "EdDSA",
|
|
85
|
+
hndl: false,
|
|
86
|
+
cwe: CWE_BROKEN_CRYPTO,
|
|
87
|
+
message: "libsodium crypto_sign (PHP) uses Ed25519 — classical and forgeable by a quantum attacker.",
|
|
88
|
+
};
|
|
89
|
+
/** phpseclib class name → its classification. */
|
|
90
|
+
const SECLIB_INFO = {
|
|
91
|
+
RSA: { algo: "RSA", cat: "kem", sev: "high", hndl: true, label: "RSA" },
|
|
92
|
+
EC: {
|
|
93
|
+
algo: "ECDH",
|
|
94
|
+
cat: "key-exchange",
|
|
95
|
+
sev: "high",
|
|
96
|
+
hndl: true,
|
|
97
|
+
label: "EC (ECDSA/ECDH)",
|
|
98
|
+
remediation: HYBRID,
|
|
99
|
+
},
|
|
100
|
+
DSA: { algo: "DSA", cat: "signature", sev: "high", hndl: false, label: "DSA" },
|
|
101
|
+
DH: { algo: "DH", cat: "key-exchange", sev: "high", hndl: true, label: "Diffie-Hellman" },
|
|
102
|
+
};
|
|
103
|
+
/** Classify `openssl_pkey_new` by the `OPENSSL_KEYTYPE_*` constant in its config.
|
|
104
|
+
* The window is bounded to the current statement (up to the next `;`, capped at
|
|
105
|
+
* 300 chars) so it can't bleed into a following `openssl_pkey_new` call's key
|
|
106
|
+
* type. Defaults to RSA — openssl_pkey_new's own default private_key_type is RSA
|
|
107
|
+
* when none is given. */
|
|
108
|
+
function classifyPkeyNew(content, index) {
|
|
109
|
+
const semi = content.indexOf(";", index);
|
|
110
|
+
const end = Math.min(index + 300, semi === -1 ? content.length : semi);
|
|
111
|
+
const w = content.slice(index, end);
|
|
112
|
+
if (/\bOPENSSL_KEYTYPE_EC\b/.test(w))
|
|
113
|
+
return SECLIB_INFO.EC;
|
|
114
|
+
if (/\bOPENSSL_KEYTYPE_DSA\b/.test(w))
|
|
115
|
+
return SECLIB_INFO.DSA;
|
|
116
|
+
if (/\bOPENSSL_KEYTYPE_DH\b/.test(w))
|
|
117
|
+
return SECLIB_INFO.DH;
|
|
118
|
+
return SECLIB_INFO.RSA;
|
|
119
|
+
}
|
|
120
|
+
/** Detects classical asymmetric crypto in PHP (openssl, phpseclib, libsodium). */
|
|
121
|
+
export const phpDetector = {
|
|
122
|
+
id: "php-crypto",
|
|
123
|
+
description: "Classical asymmetric crypto in PHP (openssl, phpseclib3, libsodium)",
|
|
124
|
+
scope: "source",
|
|
125
|
+
language: "php",
|
|
126
|
+
rules: [
|
|
127
|
+
RULE_PHP_KEYGEN,
|
|
128
|
+
RULE_PHP_RSA_CRYPT,
|
|
129
|
+
RULE_PHP_SIGN,
|
|
130
|
+
RULE_PHP_SECLIB,
|
|
131
|
+
RULE_PHP_SODIUM_X25519,
|
|
132
|
+
RULE_PHP_SODIUM_ED25519,
|
|
133
|
+
],
|
|
134
|
+
appliesTo: (f) => hasExtension(f, PHP_EXTENSIONS),
|
|
135
|
+
detect({ file, content }) {
|
|
136
|
+
const findings = [];
|
|
137
|
+
const add = (re, rule) => eachMatch(re, content, (m) => findings.push(findingFromRule(rule, { file, content, index: m.index, matchLength: m[0].length })));
|
|
138
|
+
// openssl_pkey_new — one finding per call, classified by its key-type config.
|
|
139
|
+
eachMatch(RE_PHP_PKEY_NEW, content, (m) => {
|
|
140
|
+
const info = classifyPkeyNew(content, m.index);
|
|
141
|
+
findings.push(findingFromRule(RULE_PHP_KEYGEN, { file, content, index: m.index, matchLength: m[0].length }, {
|
|
142
|
+
title: `PHP openssl ${info.label} key generation`,
|
|
143
|
+
category: info.cat,
|
|
144
|
+
severity: info.sev,
|
|
145
|
+
algorithm: info.algo,
|
|
146
|
+
hndl: info.hndl,
|
|
147
|
+
message: `Generates a classical ${info.label} key pair via PHP openssl_pkey_new — not quantum-safe.`,
|
|
148
|
+
...(info.remediation ? { remediation: info.remediation } : {}),
|
|
149
|
+
}));
|
|
150
|
+
});
|
|
151
|
+
add(RE_PHP_RSA_CRYPT, RULE_PHP_RSA_CRYPT);
|
|
152
|
+
add(RE_PHP_SIGN, RULE_PHP_SIGN);
|
|
153
|
+
// phpseclib3 ::createKey — classify by the class (RSA/EC/DSA/DH).
|
|
154
|
+
eachMatch(RE_PHP_SECLIB, content, (m) => {
|
|
155
|
+
const info = SECLIB_INFO[m[1]];
|
|
156
|
+
findings.push(findingFromRule(RULE_PHP_SECLIB, { file, content, index: m.index, matchLength: m[0].length }, {
|
|
157
|
+
title: `PHP phpseclib ${info.label} key generation`,
|
|
158
|
+
category: info.cat,
|
|
159
|
+
severity: info.sev,
|
|
160
|
+
algorithm: info.algo,
|
|
161
|
+
hndl: info.hndl,
|
|
162
|
+
message: `Generates a classical ${info.label} key pair via phpseclib3 createKey — not quantum-safe.`,
|
|
163
|
+
...(info.remediation ? { remediation: info.remediation } : {}),
|
|
164
|
+
}));
|
|
165
|
+
});
|
|
166
|
+
add(RE_PHP_SODIUM_X25519, RULE_PHP_SODIUM_X25519);
|
|
167
|
+
add(RE_PHP_SODIUM_ED25519, RULE_PHP_SODIUM_ED25519);
|
|
168
|
+
return findings;
|
|
169
|
+
},
|
|
170
|
+
};
|
|
171
|
+
//# sourceMappingURL=php.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"php.js","sourceRoot":"","sources":["../../src/detectors/php.ts"],"names":[],"mappings":"AAsBA,OAAO,EAA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sourcesContent":["/**\n * Source-code detector for classical asymmetric cryptography in PHP — one of the\n * most-deployed backend languages, previously uncovered. Handles the three\n * dominant crypto surfaces:\n *\n * - **ext/openssl** — `openssl_pkey_new()` (classified by its\n * `OPENSSL_KEYTYPE_*` config, defaulting to RSA), `openssl_public_encrypt` /\n * `openssl_private_decrypt` / `openssl_seal` / `openssl_open` (RSA), and\n * `openssl_sign` / `openssl_verify`.\n * - **phpseclib3** — `RSA::createKey()` / `EC::createKey()` / `DSA::createKey()`.\n * - **libsodium** — `sodium_crypto_box`/`kx` keypairs (X25519) and\n * `sodium_crypto_sign` keypairs (Ed25519).\n *\n * Lexical, like the other packs; the `openssl_*` / `sodium_crypto_*` prefixes and\n * `OPENSSL_KEYTYPE_*` constants are distinctive, so the false-positive rate is low.\n *\n * HNDL: RSA encryption and (EC/X)DH key agreement are harvest-now-decrypt-later\n * exposed (hndl:true); ECDSA / DSA / Ed25519 signatures are hndl:false but\n * forgeable. `openssl_pkey_new` EC and `EC::createKey` are ambiguous (feed BOTH\n * ECDSA and ECDH), classified conservatively as key-exchange-capable (hndl:true).\n */\nimport type { Detector, Finding, RuleMeta } from \"../types.js\";\nimport { PHP_EXTENSIONS, eachMatch, findingFromRule, hasExtension } from \"../detect-utils.js\";\nimport { CWE_BROKEN_CRYPTO } from \"../cwe.js\";\n\nconst RE_PHP_PKEY_NEW = /\\bopenssl_pkey_new\\s*\\(/g;\n// public_encrypt/private_decrypt (direct RSA) plus seal/open (RSA-envelope: seal\n// encrypts a random symmetric key under each recipient's RSA public key, open\n// decrypts it with the private key) — all RSA key transport, harvest-now exposed.\nconst RE_PHP_RSA_CRYPT = /\\bopenssl_(?:public_encrypt|private_decrypt|seal|open)\\s*\\(/g;\nconst RE_PHP_SIGN = /\\bopenssl_(?:sign|verify)\\s*\\(/g;\n// phpseclib3 factory methods. The class names are generic, so require `::createKey`.\nconst RE_PHP_SECLIB = /\\b(RSA|EC|DSA|DH)::createKey\\s*\\(/g;\n// libsodium X25519 (box / kx / scalarmult) and Ed25519 (sign) key pairs.\nconst RE_PHP_SODIUM_X25519 =\n /\\bsodium_crypto_(?:box|kx)_(?:seed_)?keypair\\s*\\(|\\bsodium_crypto_scalarmult(?:_base)?\\s*\\(/g;\n// Also the explicit-algorithm variant sodium_crypto_sign_ed25519_keypair().\nconst RE_PHP_SODIUM_ED25519 = /\\bsodium_crypto_sign_(?:ed25519_|seed_)?keypair\\s*\\(/g;\n\n/** Key-type classification for `openssl_pkey_new`, keyed by its config constant. */\ninterface KeyInfo {\n algo: Finding[\"algorithm\"];\n cat: Finding[\"category\"];\n sev: Finding[\"severity\"];\n hndl: boolean;\n label: string;\n remediation?: string;\n}\nconst HYBRID = \"hybrid X25519MLKEM768 (ML-KEM-768) for key agreement; ML-DSA-65 (FIPS 204) to sign\";\n\nconst RULE_PHP_KEYGEN: RuleMeta = {\n id: \"php-openssl-keygen\",\n title: \"PHP openssl key generation\",\n description: \"openssl_pkey_new (RSA/EC/DSA/DH, by OPENSSL_KEYTYPE_*)\",\n category: \"kem\",\n severity: \"high\",\n confidence: \"high\",\n algorithm: \"RSA\",\n hndl: true,\n cwe: CWE_BROKEN_CRYPTO,\n message: \"Generates a classical key pair via PHP openssl_pkey_new — not quantum-safe.\",\n};\nconst RULE_PHP_RSA_CRYPT: RuleMeta = {\n id: \"php-openssl-rsa-crypt\",\n title: \"PHP openssl RSA public-key encryption\",\n description: \"openssl_public_encrypt / openssl_private_decrypt / openssl_seal / openssl_open\",\n category: \"kem\",\n severity: \"high\",\n confidence: \"high\",\n algorithm: \"RSA\",\n hndl: true,\n cwe: CWE_BROKEN_CRYPTO,\n message:\n \"RSA public-key encryption/decryption (PHP openssl) is harvest-now-decrypt-later exposed.\",\n};\nconst RULE_PHP_SIGN: RuleMeta = {\n id: \"php-openssl-sign\",\n title: \"PHP openssl signature\",\n description: \"openssl_sign / openssl_verify\",\n category: \"signature\",\n severity: \"high\",\n confidence: \"high\",\n algorithm: \"unknown\",\n hndl: false,\n cwe: CWE_BROKEN_CRYPTO,\n message:\n \"Classical signature via PHP openssl (RSA/ECDSA/DSA) is forgeable by a quantum attacker.\",\n remediation: \"ML-DSA-65 (FIPS 204) or SLH-DSA (FIPS 205)\",\n};\nconst RULE_PHP_SECLIB: RuleMeta = {\n id: \"php-phpseclib-keygen\",\n title: \"PHP phpseclib key generation\",\n description: \"phpseclib3 RSA/EC/DSA/DH ::createKey\",\n category: \"kem\",\n severity: \"high\",\n confidence: \"medium\",\n algorithm: \"RSA\",\n hndl: true,\n cwe: CWE_BROKEN_CRYPTO,\n message: \"Generates a classical key pair via phpseclib3 (createKey) — not quantum-safe.\",\n};\nconst RULE_PHP_SODIUM_X25519: RuleMeta = {\n id: \"php-sodium-x25519\",\n title: \"PHP libsodium X25519 key agreement\",\n description: \"sodium_crypto_box/kx keypair + scalarmult\",\n category: \"key-exchange\",\n severity: \"medium\",\n confidence: \"high\",\n algorithm: \"X25519\",\n hndl: true,\n cwe: CWE_BROKEN_CRYPTO,\n message:\n \"libsodium crypto_box/kx (PHP) uses X25519 key agreement — modern but classical, harvest-now-decrypt-later exposed.\",\n};\nconst RULE_PHP_SODIUM_ED25519: RuleMeta = {\n id: \"php-sodium-ed25519\",\n title: \"PHP libsodium Ed25519 signature\",\n description: \"sodium_crypto_sign keypair\",\n category: \"signature\",\n severity: \"low\",\n confidence: \"high\",\n algorithm: \"EdDSA\",\n hndl: false,\n cwe: CWE_BROKEN_CRYPTO,\n message:\n \"libsodium crypto_sign (PHP) uses Ed25519 — classical and forgeable by a quantum attacker.\",\n};\n\n/** phpseclib class name → its classification. */\nconst SECLIB_INFO: Record<string, KeyInfo> = {\n RSA: { algo: \"RSA\", cat: \"kem\", sev: \"high\", hndl: true, label: \"RSA\" },\n EC: {\n algo: \"ECDH\",\n cat: \"key-exchange\",\n sev: \"high\",\n hndl: true,\n label: \"EC (ECDSA/ECDH)\",\n remediation: HYBRID,\n },\n DSA: { algo: \"DSA\", cat: \"signature\", sev: \"high\", hndl: false, label: \"DSA\" },\n DH: { algo: \"DH\", cat: \"key-exchange\", sev: \"high\", hndl: true, label: \"Diffie-Hellman\" },\n};\n\n/** Classify `openssl_pkey_new` by the `OPENSSL_KEYTYPE_*` constant in its config.\n * The window is bounded to the current statement (up to the next `;`, capped at\n * 300 chars) so it can't bleed into a following `openssl_pkey_new` call's key\n * type. Defaults to RSA — openssl_pkey_new's own default private_key_type is RSA\n * when none is given. */\nfunction classifyPkeyNew(content: string, index: number): KeyInfo {\n const semi = content.indexOf(\";\", index);\n const end = Math.min(index + 300, semi === -1 ? content.length : semi);\n const w = content.slice(index, end);\n if (/\\bOPENSSL_KEYTYPE_EC\\b/.test(w)) return SECLIB_INFO.EC;\n if (/\\bOPENSSL_KEYTYPE_DSA\\b/.test(w)) return SECLIB_INFO.DSA;\n if (/\\bOPENSSL_KEYTYPE_DH\\b/.test(w)) return SECLIB_INFO.DH;\n return SECLIB_INFO.RSA;\n}\n\n/** Detects classical asymmetric crypto in PHP (openssl, phpseclib, libsodium). */\nexport const phpDetector: Detector = {\n id: \"php-crypto\",\n description: \"Classical asymmetric crypto in PHP (openssl, phpseclib3, libsodium)\",\n scope: \"source\",\n language: \"php\",\n rules: [\n RULE_PHP_KEYGEN,\n RULE_PHP_RSA_CRYPT,\n RULE_PHP_SIGN,\n RULE_PHP_SECLIB,\n RULE_PHP_SODIUM_X25519,\n RULE_PHP_SODIUM_ED25519,\n ],\n appliesTo: (f) => hasExtension(f, PHP_EXTENSIONS),\n detect({ file, content }): Finding[] {\n const findings: Finding[] = [];\n const add = (re: RegExp, rule: RuleMeta): void =>\n eachMatch(re, content, (m) =>\n findings.push(\n findingFromRule(rule, { file, content, index: m.index, matchLength: m[0].length }),\n ),\n );\n\n // openssl_pkey_new — one finding per call, classified by its key-type config.\n eachMatch(RE_PHP_PKEY_NEW, content, (m) => {\n const info = classifyPkeyNew(content, m.index);\n findings.push(\n findingFromRule(\n RULE_PHP_KEYGEN,\n { file, content, index: m.index, matchLength: m[0].length },\n {\n title: `PHP openssl ${info.label} key generation`,\n category: info.cat,\n severity: info.sev,\n algorithm: info.algo,\n hndl: info.hndl,\n message: `Generates a classical ${info.label} key pair via PHP openssl_pkey_new — not quantum-safe.`,\n ...(info.remediation ? { remediation: info.remediation } : {}),\n },\n ),\n );\n });\n\n add(RE_PHP_RSA_CRYPT, RULE_PHP_RSA_CRYPT);\n add(RE_PHP_SIGN, RULE_PHP_SIGN);\n\n // phpseclib3 ::createKey — classify by the class (RSA/EC/DSA/DH).\n eachMatch(RE_PHP_SECLIB, content, (m) => {\n const info = SECLIB_INFO[m[1]];\n findings.push(\n findingFromRule(\n RULE_PHP_SECLIB,\n { file, content, index: m.index, matchLength: m[0].length },\n {\n title: `PHP phpseclib ${info.label} key generation`,\n category: info.cat,\n severity: info.sev,\n algorithm: info.algo,\n hndl: info.hndl,\n message: `Generates a classical ${info.label} key pair via phpseclib3 createKey — not quantum-safe.`,\n ...(info.remediation ? { remediation: info.remediation } : {}),\n },\n ),\n );\n });\n\n add(RE_PHP_SODIUM_X25519, RULE_PHP_SODIUM_X25519);\n add(RE_PHP_SODIUM_ED25519, RULE_PHP_SODIUM_ED25519);\n return findings;\n },\n};\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Config detector: classical asymmetric keys held in / generated by a PKCS#11 HSM
|
|
3
|
+
* or token. HSMs hold an organization's longest-lived roots (CA keys, code-signing
|
|
4
|
+
* keys), so they are exactly the keys a PQC migration must find first — yet they
|
|
5
|
+
* live behind a PKCS#11 layer the source packs never see.
|
|
6
|
+
*
|
|
7
|
+
* Covered, distinctive lexical surfaces:
|
|
8
|
+
* - `pkcs11-tool --keypairgen --key-type rsa:2048 | EC:secp256r1` — the standard
|
|
9
|
+
* OpenSC keygen invocation recorded in ops scripts / runbooks.
|
|
10
|
+
* - `CKM_RSA_PKCS(_KEY_PAIR_GEN|_OAEP|_PSS)` / `CKM_EC(DSA|DH)` / `CKM_DSA` — the
|
|
11
|
+
* PKCS#11 mechanism constants (SoftHSM, SunPKCS11, pkcs11js, python-pkcs11), which
|
|
12
|
+
* name the exact algorithm.
|
|
13
|
+
*/
|
|
14
|
+
import type { Detector } from "../types.js";
|
|
15
|
+
/** Detects classical asymmetric keys behind a PKCS#11 HSM / token. */
|
|
16
|
+
export declare const pkcs11Detector: Detector;
|
|
17
|
+
//# sourceMappingURL=pkcs11.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pkcs11.d.ts","sourceRoot":"","sources":["../../src/detectors/pkcs11.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAqB,MAAM,aAAa,CAAC;AAuE/D,sEAAsE;AACtE,eAAO,MAAM,cAAc,EAAE,QA2B5B,CAAC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { DOC_EXTENSIONS, eachMatch, findingFromRule, hasExtension } from "../detect-utils.js";
|
|
2
|
+
import { CWE_BROKEN_CRYPTO } from "../cwe.js";
|
|
3
|
+
// `pkcs11-tool --keypairgen --key-type rsa:2048` / `EC:secp256r1` (OpenSC).
|
|
4
|
+
const RE_PKCS11_TOOL_RSA = /--key-type\s+rsa:\d+/gi;
|
|
5
|
+
const RE_PKCS11_TOOL_EC = /--key-type\s+EC:[A-Za-z0-9]+/gi;
|
|
6
|
+
// PKCS#11 mechanism constants (CKM_*), which name the algorithm exactly.
|
|
7
|
+
const RE_CKM_RSA = /\bCKM_RSA_(?:PKCS(?:_KEY_PAIR_GEN|_OAEP|_PSS)?|X_509|9796)\b/g;
|
|
8
|
+
const RE_CKM_EC = /\bCKM_EC(?:DSA(?:_SHA\d+)?|DH1?_DERIVE|_KEY_PAIR_GEN)\b/g;
|
|
9
|
+
const RE_CKM_DSA = /\bCKM_DSA(?:_SHA\d+|_KEY_PAIR_GEN)?\b/g;
|
|
10
|
+
const RE_CKM_DH = /\bCKM_DH_PKCS_(?:KEY_PAIR_GEN|DERIVE)\b/g;
|
|
11
|
+
const RULE_PKCS11_RSA = {
|
|
12
|
+
id: "pkcs11-rsa",
|
|
13
|
+
title: "PKCS#11 (HSM) RSA key",
|
|
14
|
+
description: "PKCS#11 RSA key generation / mechanism (pkcs11-tool, CKM_RSA_*)",
|
|
15
|
+
category: "kem",
|
|
16
|
+
severity: "high",
|
|
17
|
+
confidence: "high",
|
|
18
|
+
algorithm: "RSA",
|
|
19
|
+
hndl: true,
|
|
20
|
+
cwe: CWE_BROKEN_CRYPTO,
|
|
21
|
+
message: "A classical RSA key in a PKCS#11 HSM / token — likely a long-lived root (CA / code-signing), and not quantum-safe.",
|
|
22
|
+
remediation: "Inventory HSM-held RSA keys first (longest-lived); plan re-keying to PQC (ML-KEM-768 / ML-DSA-65) as HSM firmware adds support.",
|
|
23
|
+
};
|
|
24
|
+
const RULE_PKCS11_EC = {
|
|
25
|
+
id: "pkcs11-ec",
|
|
26
|
+
title: "PKCS#11 (HSM) EC key",
|
|
27
|
+
description: "PKCS#11 EC key generation / mechanism (CKM_EC*, --key-type EC)",
|
|
28
|
+
category: "key-exchange",
|
|
29
|
+
severity: "high",
|
|
30
|
+
confidence: "high",
|
|
31
|
+
algorithm: "ECDH",
|
|
32
|
+
hndl: true,
|
|
33
|
+
cwe: CWE_BROKEN_CRYPTO,
|
|
34
|
+
message: "A classical EC key in a PKCS#11 HSM / token; EC keys feed ECDSA signatures and ECDH key agreement (the ECDH path is harvest-now-decrypt-later exposed).",
|
|
35
|
+
remediation: "For key agreement: hybrid X25519MLKEM768 (ML-KEM-768). For signatures: ML-DSA-65 (FIPS 204). Prioritise HSM-held keys.",
|
|
36
|
+
};
|
|
37
|
+
const RULE_PKCS11_DSA = {
|
|
38
|
+
id: "pkcs11-dsa",
|
|
39
|
+
title: "PKCS#11 (HSM) DSA key",
|
|
40
|
+
description: "PKCS#11 DSA key generation / mechanism (CKM_DSA*)",
|
|
41
|
+
category: "signature",
|
|
42
|
+
severity: "medium",
|
|
43
|
+
confidence: "high",
|
|
44
|
+
algorithm: "DSA",
|
|
45
|
+
hndl: false,
|
|
46
|
+
cwe: CWE_BROKEN_CRYPTO,
|
|
47
|
+
message: "A classical DSA key in a PKCS#11 HSM / token — deprecated and quantum-forgeable.",
|
|
48
|
+
remediation: "Rotate off DSA; migrate to ML-DSA-65 (FIPS 204).",
|
|
49
|
+
};
|
|
50
|
+
const RULE_PKCS11_DH = {
|
|
51
|
+
id: "pkcs11-dh",
|
|
52
|
+
title: "PKCS#11 (HSM) Diffie-Hellman",
|
|
53
|
+
description: "PKCS#11 finite-field DH key generation / derive (CKM_DH_PKCS_*)",
|
|
54
|
+
category: "key-exchange",
|
|
55
|
+
severity: "medium",
|
|
56
|
+
confidence: "high",
|
|
57
|
+
algorithm: "DH",
|
|
58
|
+
hndl: true,
|
|
59
|
+
cwe: CWE_BROKEN_CRYPTO,
|
|
60
|
+
message: "Finite-field Diffie-Hellman in a PKCS#11 HSM / token; classical key agreement, harvest-now-decrypt-later exposed.",
|
|
61
|
+
remediation: "Migrate key agreement to hybrid X25519MLKEM768 (ML-KEM-768).",
|
|
62
|
+
};
|
|
63
|
+
/** Detects classical asymmetric keys behind a PKCS#11 HSM / token. */
|
|
64
|
+
export const pkcs11Detector = {
|
|
65
|
+
id: "pkcs11-crypto",
|
|
66
|
+
description: "Classical asymmetric keys in a PKCS#11 HSM / token",
|
|
67
|
+
scope: "config",
|
|
68
|
+
language: "any",
|
|
69
|
+
appliesTo: (f) => !hasExtension(f, DOC_EXTENSIONS),
|
|
70
|
+
rules: [RULE_PKCS11_RSA, RULE_PKCS11_EC, RULE_PKCS11_DSA, RULE_PKCS11_DH],
|
|
71
|
+
detect({ file, content }) {
|
|
72
|
+
// Fast reject: only proceed on a distinctive PKCS#11 marker.
|
|
73
|
+
if (!content.includes("CKM_") && !content.includes("--key-type")) {
|
|
74
|
+
return [];
|
|
75
|
+
}
|
|
76
|
+
const findings = [];
|
|
77
|
+
const add = (re, rule) => eachMatch(re, content, (m) => findings.push(findingFromRule(rule, { file, content, index: m.index, matchLength: m[0].length })));
|
|
78
|
+
add(RE_PKCS11_TOOL_RSA, RULE_PKCS11_RSA);
|
|
79
|
+
add(RE_PKCS11_TOOL_EC, RULE_PKCS11_EC);
|
|
80
|
+
add(RE_CKM_RSA, RULE_PKCS11_RSA);
|
|
81
|
+
add(RE_CKM_EC, RULE_PKCS11_EC);
|
|
82
|
+
add(RE_CKM_DSA, RULE_PKCS11_DSA);
|
|
83
|
+
add(RE_CKM_DH, RULE_PKCS11_DH);
|
|
84
|
+
return findings;
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
//# sourceMappingURL=pkcs11.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pkcs11.js","sourceRoot":"","sources":["../../src/detectors/pkcs11.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC9F,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE9C,4EAA4E;AAC5E,MAAM,kBAAkB,GAAG,wBAAwB,CAAC;AACpD,MAAM,iBAAiB,GAAG,gCAAgC,CAAC;AAC3D,yEAAyE;AACzE,MAAM,UAAU,GAAG,+DAA+D,CAAC;AACnF,MAAM,SAAS,GAAG,0DAA0D,CAAC;AAC7E,MAAM,UAAU,GAAG,wCAAwC,CAAC;AAC5D,MAAM,SAAS,GAAG,0CAA0C,CAAC;AAE7D,MAAM,eAAe,GAAa;IAChC,EAAE,EAAE,YAAY;IAChB,KAAK,EAAE,uBAAuB;IAC9B,WAAW,EAAE,iEAAiE;IAC9E,QAAQ,EAAE,KAAK;IACf,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,MAAM;IAClB,SAAS,EAAE,KAAK;IAChB,IAAI,EAAE,IAAI;IACV,GAAG,EAAE,iBAAiB;IACtB,OAAO,EACL,oHAAoH;IACtH,WAAW,EACT,iIAAiI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AE,cAAc,EAAE,eAAe,EAAE,cAAc,CAAC;IACzE,MAAM,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE;QACtB,6DAA6D;QAC7D,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC;YACjE,OAAO,EAAE,CAAC;QACZ,CAAC;QACD,MAAM,QAAQ,GAAc,EAAE,CAAC;QAC/B,MAAM,GAAG,GAAG,CAAC,EAAU,EAAE,IAAc,EAAQ,EAAE,CAC/C,SAAS,CAAC,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE,CAC3B,QAAQ,CAAC,IAAI,CACX,eAAe,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CACnF,CACF,CAAC;QACJ,GAAG,CAAC,kBAAkB,EAAE,eAAe,CAAC,CAAC;QACzC,GAAG,CAAC,iBAAiB,EAAE,cAAc,CAAC,CAAC;QACvC,GAAG,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC;QACjC,GAAG,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;QAC/B,GAAG,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC;QACjC,GAAG,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;QAC/B,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF,CAAC","sourcesContent":["/**\n * Config detector: classical asymmetric keys held in / generated by a PKCS#11 HSM\n * or token. HSMs hold an organization's longest-lived roots (CA keys, code-signing\n * keys), so they are exactly the keys a PQC migration must find first — yet they\n * live behind a PKCS#11 layer the source packs never see.\n *\n * Covered, distinctive lexical surfaces:\n * - `pkcs11-tool --keypairgen --key-type rsa:2048 | EC:secp256r1` — the standard\n * OpenSC keygen invocation recorded in ops scripts / runbooks.\n * - `CKM_RSA_PKCS(_KEY_PAIR_GEN|_OAEP|_PSS)` / `CKM_EC(DSA|DH)` / `CKM_DSA` — the\n * PKCS#11 mechanism constants (SoftHSM, SunPKCS11, pkcs11js, python-pkcs11), which\n * name the exact algorithm.\n */\nimport type { Detector, Finding, RuleMeta } from \"../types.js\";\nimport { DOC_EXTENSIONS, eachMatch, findingFromRule, hasExtension } from \"../detect-utils.js\";\nimport { CWE_BROKEN_CRYPTO } from \"../cwe.js\";\n\n// `pkcs11-tool --keypairgen --key-type rsa:2048` / `EC:secp256r1` (OpenSC).\nconst RE_PKCS11_TOOL_RSA = /--key-type\\s+rsa:\\d+/gi;\nconst RE_PKCS11_TOOL_EC = /--key-type\\s+EC:[A-Za-z0-9]+/gi;\n// PKCS#11 mechanism constants (CKM_*), which name the algorithm exactly.\nconst RE_CKM_RSA = /\\bCKM_RSA_(?:PKCS(?:_KEY_PAIR_GEN|_OAEP|_PSS)?|X_509|9796)\\b/g;\nconst RE_CKM_EC = /\\bCKM_EC(?:DSA(?:_SHA\\d+)?|DH1?_DERIVE|_KEY_PAIR_GEN)\\b/g;\nconst RE_CKM_DSA = /\\bCKM_DSA(?:_SHA\\d+|_KEY_PAIR_GEN)?\\b/g;\nconst RE_CKM_DH = /\\bCKM_DH_PKCS_(?:KEY_PAIR_GEN|DERIVE)\\b/g;\n\nconst RULE_PKCS11_RSA: RuleMeta = {\n id: \"pkcs11-rsa\",\n title: \"PKCS#11 (HSM) RSA key\",\n description: \"PKCS#11 RSA key generation / mechanism (pkcs11-tool, CKM_RSA_*)\",\n category: \"kem\",\n severity: \"high\",\n confidence: \"high\",\n algorithm: \"RSA\",\n hndl: true,\n cwe: CWE_BROKEN_CRYPTO,\n message:\n \"A classical RSA key in a PKCS#11 HSM / token — likely a long-lived root (CA / code-signing), and not quantum-safe.\",\n remediation:\n \"Inventory HSM-held RSA keys first (longest-lived); plan re-keying to PQC (ML-KEM-768 / ML-DSA-65) as HSM firmware adds support.\",\n};\nconst RULE_PKCS11_EC: RuleMeta = {\n id: \"pkcs11-ec\",\n title: \"PKCS#11 (HSM) EC key\",\n description: \"PKCS#11 EC key generation / mechanism (CKM_EC*, --key-type EC)\",\n category: \"key-exchange\",\n severity: \"high\",\n confidence: \"high\",\n algorithm: \"ECDH\",\n hndl: true,\n cwe: CWE_BROKEN_CRYPTO,\n message:\n \"A classical EC key in a PKCS#11 HSM / token; EC keys feed ECDSA signatures and ECDH key agreement (the ECDH path is harvest-now-decrypt-later exposed).\",\n remediation:\n \"For key agreement: hybrid X25519MLKEM768 (ML-KEM-768). For signatures: ML-DSA-65 (FIPS 204). Prioritise HSM-held keys.\",\n};\nconst RULE_PKCS11_DSA: RuleMeta = {\n id: \"pkcs11-dsa\",\n title: \"PKCS#11 (HSM) DSA key\",\n description: \"PKCS#11 DSA key generation / mechanism (CKM_DSA*)\",\n category: \"signature\",\n severity: \"medium\",\n confidence: \"high\",\n algorithm: \"DSA\",\n hndl: false,\n cwe: CWE_BROKEN_CRYPTO,\n message: \"A classical DSA key in a PKCS#11 HSM / token — deprecated and quantum-forgeable.\",\n remediation: \"Rotate off DSA; migrate to ML-DSA-65 (FIPS 204).\",\n};\nconst RULE_PKCS11_DH: RuleMeta = {\n id: \"pkcs11-dh\",\n title: \"PKCS#11 (HSM) Diffie-Hellman\",\n description: \"PKCS#11 finite-field DH key generation / derive (CKM_DH_PKCS_*)\",\n category: \"key-exchange\",\n severity: \"medium\",\n confidence: \"high\",\n algorithm: \"DH\",\n hndl: true,\n cwe: CWE_BROKEN_CRYPTO,\n message:\n \"Finite-field Diffie-Hellman in a PKCS#11 HSM / token; classical key agreement, harvest-now-decrypt-later exposed.\",\n remediation: \"Migrate key agreement to hybrid X25519MLKEM768 (ML-KEM-768).\",\n};\n\n/** Detects classical asymmetric keys behind a PKCS#11 HSM / token. */\nexport const pkcs11Detector: Detector = {\n id: \"pkcs11-crypto\",\n description: \"Classical asymmetric keys in a PKCS#11 HSM / token\",\n scope: \"config\",\n language: \"any\",\n appliesTo: (f) => !hasExtension(f, DOC_EXTENSIONS),\n rules: [RULE_PKCS11_RSA, RULE_PKCS11_EC, RULE_PKCS11_DSA, RULE_PKCS11_DH],\n detect({ file, content }): Finding[] {\n // Fast reject: only proceed on a distinctive PKCS#11 marker.\n if (!content.includes(\"CKM_\") && !content.includes(\"--key-type\")) {\n return [];\n }\n const findings: Finding[] = [];\n const add = (re: RegExp, rule: RuleMeta): void =>\n eachMatch(re, content, (m) =>\n findings.push(\n findingFromRule(rule, { file, content, index: m.index, matchLength: m[0].length }),\n ),\n );\n add(RE_PKCS11_TOOL_RSA, RULE_PKCS11_RSA);\n add(RE_PKCS11_TOOL_EC, RULE_PKCS11_EC);\n add(RE_CKM_RSA, RULE_PKCS11_RSA);\n add(RE_CKM_EC, RULE_PKCS11_EC);\n add(RE_CKM_DSA, RULE_PKCS11_DSA);\n add(RE_CKM_DH, RULE_PKCS11_DH);\n return findings;\n },\n};\n"]}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Config detector: classical-certificate TLS termination in standalone
|
|
3
|
+
* reverse-proxy / load-balancer configuration and in-code gRPC channel
|
|
4
|
+
* credentials.
|
|
5
|
+
*
|
|
6
|
+
* A standalone Envoy, Nginx, HAProxy, Traefik, or Caddy config that terminates
|
|
7
|
+
* TLS with an RSA/ECDSA leaf certificate and negotiates an ECDHE key exchange is
|
|
8
|
+
* the canonical harvest-now-decrypt-later (HNDL) surface: an attacker who
|
|
9
|
+
* records today's handshake + ciphertext can decrypt it retroactively once a
|
|
10
|
+
* cryptographically-relevant quantum computer (CRQC) can break the ephemeral
|
|
11
|
+
* (EC)DHE secret. The Kubernetes / service-mesh detectors (`k8s.ts`, `mesh.ts`)
|
|
12
|
+
* cover the CLUSTER-managed cert + mesh-mTLS surfaces; the STANDALONE proxy
|
|
13
|
+
* config FILES and the in-code gRPC credential constructors below are seen by
|
|
14
|
+
* neither them nor the language packs, so they are covered here.
|
|
15
|
+
*
|
|
16
|
+
* Because the config token itself does not name the cert's key algorithm (the
|
|
17
|
+
* key lives in a referenced PEM file, out of band), these findings use
|
|
18
|
+
* `algorithm: "unknown"` — the evidence is "a classical-cert TLS channel is
|
|
19
|
+
* configured HERE", not a specific family. They are `category: "key-exchange"`
|
|
20
|
+
* (the ECDHE handshake is the harvestable primitive) and `hndl: true`.
|
|
21
|
+
* Confidence is `medium`: a config-level indicator of a classical TLS channel,
|
|
22
|
+
* not a matched algorithm string.
|
|
23
|
+
*
|
|
24
|
+
* PRECISION / fast-reject: several of the matched tokens (`ssl_certificate`,
|
|
25
|
+
* `private_key:`, `certificates:`) are generic enough to appear in unrelated
|
|
26
|
+
* YAML/config, so `detect()` bails unless the file carries a distinctive
|
|
27
|
+
* proxy/gRPC marker (see `hasProxyMarker`). This keeps a random YAML that merely
|
|
28
|
+
* has a `private_key:` key, or a Traefik-shaped `certificates:` list that isn't
|
|
29
|
+
* a Traefik config, from firing. Comments are masked (YAML/nginx/HCL `#`, plus
|
|
30
|
+
* `//` and C-style `/* … *\/` blocks) so a commented-out directive can't fire.
|
|
31
|
+
*
|
|
32
|
+
* Covered surfaces:
|
|
33
|
+
* - Envoy — `common_tls_context:` / `DownstreamTlsContext` /
|
|
34
|
+
* `UpstreamTlsContext` with `tls_certificates:` carrying a
|
|
35
|
+
* `certificate_chain:` + `private_key:` (and the
|
|
36
|
+
* `envoy.transport_sockets.tls` transport socket).
|
|
37
|
+
* - Nginx — `ssl_certificate` + `ssl_certificate_key` directives.
|
|
38
|
+
* - HAProxy — `bind … ssl crt …` lines and `crt-store` sections.
|
|
39
|
+
* - Traefik — a `tls:` block's `certificates:` with `certFile:` + `keyFile:`
|
|
40
|
+
* (dynamic config) or a `certResolver` (ACME) reference.
|
|
41
|
+
* - gRPC — in-code TLS channel credentials: `grpc.ssl_channel_credentials(`
|
|
42
|
+
* (Python), `grpc.credentials.createSsl(` (Node),
|
|
43
|
+
* `TlsChannelCredentials` (Java), `credentials.NewTLS(` (Go).
|
|
44
|
+
*/
|
|
45
|
+
import type { Detector } from "../types.js";
|
|
46
|
+
/**
|
|
47
|
+
* Detects classical-cert TLS termination in standalone reverse-proxy /
|
|
48
|
+
* load-balancer config files and in-code gRPC channel credentials. See the
|
|
49
|
+
* module docstring for the covered surfaces and the fast-reject rationale.
|
|
50
|
+
*/
|
|
51
|
+
export declare const proxyDetector: Detector;
|
|
52
|
+
//# sourceMappingURL=proxy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proxy.d.ts","sourceRoot":"","sources":["../../src/detectors/proxy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAqB,MAAM,aAAa,CAAC;AA2J/D;;;;GAIG;AACH,eAAO,MAAM,aAAa,EAAE,QA+B3B,CAAC"}
|