id: joomla-detect

info:
  name: Joomla! Detect
  author: ricardomaia
  severity: info
  description: |
    Joomla! is a free and open-source content management system (CMS) for publishing content on websites.
  reference:
    - https://www.joomla.org/
    - https://github.com/joomla/joomla-cms
    - https://www.itoctopus.com/how-to-quickly-know-the-version-of-any-joomla-website
    - https://hackertarget.com/attacking-enumerating-joomla/
  classification:
    cpe: cpe:2.3:a:joomla:joomla\\!:*:*:*:*:*:*:*:*
  metadata:
    verified: true
    max-request: 5
    vendor: joomla
    product: joomla\\!
    google-query: Joomla! Administration Login inurl:"/index.php" || intitle:"Joomla Web Installer"
  tags: tech,joomla,cms,oss,discovery

http:
  - method: GET
    path:
      - "{{BaseURL}}/administrator/manifests/files/joomla.xml" # >= 1.6.0
      - "{{BaseURL}}/language/en-GB/en-GB.xml" # >= 1.5.0 and <= 1.5.26
      - "{{BaseURL}}/README.txt"
      - "{{BaseURL}}/modules/custom.xml" # < 1.5.0
      - "{{BaseURL}}" # >= 1.5.0 and <= 1.5.26

    stop-at-first-match: true
    host-redirects: true
    max-redirects: 2

    matchers-condition: or
    matchers:
      - type: word
        part: body
        words:
          - "<version>"
          - "<creationDate>"
          - "</metafile>"
        condition: and

      - type: regex
        part: body
        regex:
          - "(?:<div[^>]+id=\"wrapper_r\"|<(?:link|script)[^>]+(?:feed|components)/com_|<table[^>]+class=\"pill)"
          - "(?i)<meta\\s+name=[\"']generator[\"']\\s+content=[\"']\\s*joomla[^\"']*"
          - "(?i)Joomla_([\\d.|\\d]+)_version_history"
          - "FILES_JOOMLA_XML_DESCRIPTION"
        condition: or

    extractors:
      - type: regex
        name: version
        group: 1
        regex:
          - '<version>(.*?)</version>'
          - '(?i)Joomla_([\d.|\d]+)_version_history'
        part: body
# digest: 4b0a00483046022100a0567b0029a6185e93e9879635dd83afe4375d55057aba7879221a0724c332b4022100bc1e3e1c30837073892ecee9e56b2680418ef5b59b9ca326e501d978d1764b86:922c64590222798bb761d5b6d8e72950