id: admzip-path-overwrite

info:
  name: Admzip Path Overwrite
  author: me_dheeraj (https://twitter.com/Dheerajmadhukar)
  severity: info
  description: Insecure ZIP archive extraction using adm-zip can result in arbitrary path over write and can result in code injection.
  tags: file,nodejs,admzip
file:
  - extensions:
      - all
    matchers:
      - type: regex
        regex:
          - "require\\\\('adm-zip'\\\\)"
          - "\\.forEach\\(function .*\\(.*, \\.\\*\\) \\{"
          - "\\.createWriteStream\\(.*\\) \\}, \\.\\*\\)"
          - "\\.writeFile\\(.*\\)"
          - "\\.writeFileSync\\(.*\\) \\}, \\.\\*\\)"
        condition: or
# digest: 490a00463044022061517677a0b41a2048a4ca951bba30d615fe02b7791d2e1a33d1f771f6f4da6f02204501001dfc2023b6991ba087accb1c0fc74c9c443dd212be4566ebbd7a5c6207:922c64590222798bb761d5b6d8e72950