Taifajobs — 1 vulnerability check

noctis ships 1 vulnerability check for Taifajobs, covering 1 CVE; each one has to observe the bug on the live service before it reports a finding.

← All products · Feeds on GitHub

Taifajobs jobdetails.php jobid SQL Injection

CVECVE-2009-0727
Severityhigh · CVSS 7.5
Categorysqli — SQL injection
Serviceshttp, https
Detectionscript, set_var, http_request, match · highest QoD 97
Feedtests/vulnerabilities/taifajobs/CVE-2009-0727.yaml

Taifajobs (Job Recruitment System) 1.0 and earlier puts the jobid parameter of jobdetails.php unquoted into an SQL query and prints the row it returns, allowing unauthenticated SQL injection (an attacker can read the whole database, user logins and password hashes included).

This check requests jobdetails.php under the web root and the usual install paths and keeps the ones that answer with the product's job details form. There, it sends a jobid that is a UNION SELECT of an expression multiplying two random numbers. The vulnerability is confirmed when the page returns the product computed by the database, which never appears in the request. No table data is read and nothing is written.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request GET {{dir}}/jobdetails.php
  3. Parses / computes the next value with a Rhai script
  4. HTTP(S) request GET {{dir}}/jobdetails.php?jobid={{sc.q}}
  5. Parses / computes the next value with a Rhai script
  6. Checks hit_dir for ^/ → finding QoD 97: Taifajobs jobdetails.php jobid SQL Injection (CVE-2009-0727)

References:

Feed source — tests/vulnerabilities/taifajobs/CVE-2009-0727.yaml
# Taifajobs (Job Recruitment System) <= 1.0 — jobdetails.php jobid SQL injection — CVE-2009-0727
#
# jobdetails.php copies $_GET["jobid"] unquoted to the end of a 20-column SELECT
#     ... FROM job LEFT JOIN countries ... LEFT JOIN jobcat ... WHERE job.jobid = $search
# and prints the row: jobid in the hidden <input name="jobid" value="…">, jobtitle
# in an <h3>, then category, city, country, organisation, contact details…
# Public PoC (EDB-8098): jobid=-5 union select 12345678987654321,2,3,...,
# concat(admin,0x23,email,0x5D,loginname,0x7E,pass),...,0 from users--
#
# Detection (QoD 97): on a jobdetails.php that answers 200 with the product's
# <form name="jobdetails">, jobid = -1 union select C,...,C (20 columns)-- - with
# C = CONCAT(0x4e4f43544953, a*b, 0x454e44) and random a, b. The product a*b is
# never in the request, so only an SQL engine that evaluated our expression can
# return "NOCTIS<a*b>END". Read-only, no table referenced, no quotes, nothing
# extracted (the PoC dumps the users table with password hashes).
#
# Better than the source NASL:
#   - the NASL only matches when the users table holds a row whose concatenated
#     admin/email/login/pass looks like an MD5 account (an empty users table
#     prints nothing: checked on MariaDB 10.11 through PHP); the computed marker
#     needs no table at all;
#   - no read of the users table (admin e-mail, login and password hash);
#   - a database-computed value instead of a fixed number echoed back, so a page
#     reflecting jobid cannot match.
#
# Source: OpenVAS/Greenbone NVT 2009/gb_taifajobs_sqli_vuln.nasl
# (OID 1.3.6.1.4.1.25623.1.0.100002, GPL-2.0-only).
uid: 5c81eca8-e39b-45bd-a30b-7b3c98f12785
name: "Taifajobs jobdetails.php jobid SQL Injection (CVE-2009-0727)"
description: |
  Taifajobs (Job Recruitment System) 1.0 and earlier puts the jobid parameter of
  jobdetails.php unquoted into an SQL query and prints the row it returns,
  allowing unauthenticated SQL injection (an attacker can read the whole database,
  user logins and password hashes included).

  This check requests jobdetails.php under the web root and the usual install
  paths and keeps the ones that answer with the product's job details form. There,
  it sends a jobid that is a UNION SELECT of an expression multiplying two random
  numbers. The vulnerability is confirmed when the page returns the product
  computed by the database, which never appears in the request. No table data is
  read and nothing is written.
cves: [CVE-2009-0727]
cvss: 7.5
severity: high
category: sqli
confidence_base: 0.30
tags: [taifajobs, job-recruitment-system, sqli, union-based, php]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2009-0727"
  - "https://www.exploit-db.com/exploits/8098"
  - "http://www.securityfocus.com/bid/33864"
  - "https://sourceforge.net/projects/taifajobs/"
  # OpenVAS/Greenbone NASL 2009/gb_taifajobs_sqli_vuln.nasl (GPL-2.0-only)

steps:
  # ── Random operands, expected marker and the encoded jobid value ──────────
  - id: gen-proof
    action: script
    code: |
      let a = rand_int(100000, 999999);
      let b = rand_int(100000, 999999);
      let c = "CONCAT(0x4e4f43544953," + a + "*" + b + ",0x454e44)";
      let cols = c;
      for i in 1..20 { cols += "," + c; }
      #{ want: "NOCTIS" + (a * b) + "END",
         expr: a + "*" + b,
         q: "-1%20union%20select%20" + cols + "--%20-" }
    store_as: sc

  - id: init-hit
    action: set_var
    var_name: hit_dir
    var_value: ""

  # ── Per candidate install path (loop group) ───────────────────────────────
  - id: init-landing
    action: set_var
    var_name: landing
    var_value: {status: 0, body: ""}
    loop:
      var: dir
      over: ["", "/tjobs", "/jobs", "/taifajobs"]

  - id: init-probe-resp
    action: set_var
    var_name: tj_resp
    var_value: {status: 0, body: ""}

  - id: fetch-landing
    action: http_request
    method: GET
    path: "{{dir}}/jobdetails.php"
    port: "{{port}}"
    tls_insecure: true
    timeout_secs: 15
    condition: 'hit_dir == ""'
    store_as: landing

  - id: fingerprint
    action: script
    condition: 'hit_dir == ""'
    code: |
      let body = if type_of(landing.body) == "string" { landing.body } else { "" };
      landing.status == 200 && egrep("(?i)<form[^>]+name=\"jobdetails\"", body) != ""
    store_as: is_taifa

  - id: union-probe
    action: http_request
    method: GET
    path: "{{dir}}/jobdetails.php?jobid={{sc.q}}"
    port: "{{port}}"
    tls_insecure: true
    timeout_secs: 15
    condition: 'hit_dir == "" && is_taifa == true'
    store_as: tj_resp

  - id: check-product
    action: script
    condition: 'hit_dir == "" && is_taifa == true'
    code: |
      let body = if type_of(tj_resp.body) == "string" { tj_resp.body } else { "" };
      if body.contains(sc.want) { if dir == "" { "/" } else { dir } } else { "" }
    store_as: hit_dir

  # ── Finding ───────────────────────────────────────────────────────────────
  - id: report
    action: match
    source: hit_dir
    pattern: "^/"
    on_match:
      finding:
        title: "Taifajobs jobdetails.php jobid SQL Injection (CVE-2009-0727)"
        description: "An unauthenticated request to jobdetails.php with jobid set to a UNION SELECT of a multiplication of two random numbers returned the product computed by the database: jobid reaches the SQL query unquoted, so an attacker can read the whole database (user logins and password hashes included)."
        remediation: "No fixed release of Taifajobs is known: remove the application, or make jobdetails.php cast jobid to an integer (or use a prepared statement) before building the query."
        confidence_delta: 0.67
        qod: 97
        evidence: "install dir {{hit_dir}}: jobdetails.php?jobid=-1 union select CONCAT(0x4e4f43544953,{{sc.expr}},0x454e44),... (20 columns)-- - returned the database-computed value {{sc.want}}"
      stop: true

View these feeds on GitHub