id: wordpress-code-snippets

info:
  name: Code Snippets Detection
  author: ricardomaia
  severity: info
  reference:
    - https://wordpress.org/plugins/code-snippets/
  metadata:
    plugin_namespace: code-snippets
    wpscan: https://wpscan.com/plugin/code-snippets
  tags: tech,wordpress,wp-plugin,top-100,top-200,discovery

http:
  - method: GET
    path:
      - "{{BaseURL}}/wp-content/plugins/code-snippets/readme.txt"

    payloads:
      last_version: helpers/wordpress/plugins/code-snippets.txt

    extractors:
      - type: regex
        part: body
        internal: true
        name: internal_detected_version
        group: 1
        regex:
          - '(?i)Stable.tag:\s?([\w.]+)'

      - type: regex
        part: body
        name: detected_version
        group: 1
        regex:
          - '(?i)Stable.tag:\s?([\w.]+)'

    matchers-condition: or
    matchers:
      - type: dsl
        name: "outdated_version"
        dsl:
          - compare_versions(internal_detected_version, concat("< ", last_version))

      - type: regex
        part: body
        regex:
          - '(?i)Stable.tag:\s?([\w.]+)'
# digest: 4a0a00473045022074d42ee9a44999ce4987ec102df25adebdbc7b7aa274855635fb002f57678675022100d0da56692a5a9368fdfb739a58bdfff5528b9c8cba381c0da6c759b14705a772:922c64590222798bb761d5b6d8e72950