Ubuntu 16.04 LTS / 18.04 LTS / 19.04 / 19.10 : PHP vulnerability (USN-4166-1) - Nessus

Critical   Plugin ID: 130362

This page contains detailed information about the Ubuntu 16.04 LTS / 18.04 LTS / 19.04 / 19.10 : PHP vulnerability (USN-4166-1) Nessus plugin including available exploits and PoCs found on GitHub, in Metasploit or Exploit-DB for verifying of this vulnerability.

Plugin Overview


ID: 130362
Name: Ubuntu 16.04 LTS / 18.04 LTS / 19.04 / 19.10 : PHP vulnerability (USN-4166-1)
Filename: ubuntu_USN-4166-1.nasl
Vulnerability Published: 2019-10-28
This Plugin Published: 2019-10-29
Last Modification Time: 2022-03-29
Plugin Version: 1.11
Plugin Type: local
Plugin Family: Ubuntu Local Security Checks
Dependencies: ssh_get_info.nasl
Required KB Items [?]: Host/cpu, Host/Debian/dpkg-l, Host/Ubuntu, Host/Ubuntu/release

Vulnerability Information


Severity: Critical
Vulnerability Published: 2019-10-28
Patch Published: 2019-10-28
CVE [?]: CVE-2019-11043
CPE [?]: cpe:/o:canonical:ubuntu_linux:16.04, cpe:/o:canonical:ubuntu_linux:18.04:-:lts, cpe:/o:canonical:ubuntu_linux:19.04, cpe:/o:canonical:ubuntu_linux:19.10, p-cpe:/a:canonical:ubuntu_linux:libapache2-mod-php7.0, p-cpe:/a:canonical:ubuntu_linux:libapache2-mod-php7.2, p-cpe:/a:canonical:ubuntu_linux:libapache2-mod-php7.3, p-cpe:/a:canonical:ubuntu_linux:php7.0-cgi, p-cpe:/a:canonical:ubuntu_linux:php7.0-cli, p-cpe:/a:canonical:ubuntu_linux:php7.0-fpm, p-cpe:/a:canonical:ubuntu_linux:php7.2-cgi, p-cpe:/a:canonical:ubuntu_linux:php7.2-cli, p-cpe:/a:canonical:ubuntu_linux:php7.2-fpm, p-cpe:/a:canonical:ubuntu_linux:php7.3-cgi, p-cpe:/a:canonical:ubuntu_linux:php7.3-cli, p-cpe:/a:canonical:ubuntu_linux:php7.3-fpm

Synopsis

The remote Ubuntu host is missing one or more security-related patches.

Description

It was discovered that PHP incorrectly handled certain paths when being used in FastCGI configurations. A remote attacker could possibly use this issue to execute arbitrary code.

Note that Tenable Network Security has extracted the preceding description block directly from the Ubuntu security advisory. Tenable has attempted to automatically clean and format it as much as possible without introducing additional issues.

Solution

Update the affected packages.

Public Exploits


Target Network Port(s): N/A
Target Asset(s): N/A
Exploit Available: True (Metasploit Framework, Exploit-DB, GitHub)
Exploit Ease: Exploits are available

Here's the list of publicly known exploits and PoCs for verifying the Ubuntu 16.04 LTS / 18.04 LTS / 19.04 / 19.10 : PHP vulnerability (USN-4166-1) vulnerability:

  1. Metasploit: exploit/multi/http/php_fpm_rce
    [PHP-FPM Underflow RCE]
  2. Exploit-DB: exploits/php/remote/48182.rb
    [EDB-48182: PHP-FPM - Underflow Remote Code Execution (Metasploit)]
  3. Exploit-DB: exploits/php/webapps/47553.md
    [EDB-47553: PHP-FPM + Nginx - Remote Code Execution]
  4. GitHub: https://github.com/HxDDD/CVE-PoC
    [CVE-2019-11043]
  5. GitHub: https://github.com/LubinLew/WEB-CVE
    [CVE-2019-11043]
  6. GitHub: https://github.com/Mr-xn/Penetration_Testing_POC
    [CVE-2019-11043]
  7. GitHub: https://github.com/SexyBeast233/SecBooks
    [CVE-2019-11043]
  8. GitHub: https://github.com/akamajoris/CVE-2019-11043-Docker
    [CVE-2019-11043]
  9. GitHub: https://github.com/alokaranasinghe/cve-2019-11043
    [CVE-2019-11043]
  10. GitHub: https://github.com/b0o/starred
    [CVE-2019-11043]
  11. GitHub: https://github.com/babebbu/TNI-CWC-GGEZ-Hosting
    [CVE-2019-11043]
  12. GitHub: https://github.com/bollwarm/tech-news
    [CVE-2019-11043]
  13. GitHub: https://github.com/fairyming/CVE-2019-11043
    [CVE-2019-11043]
  14. GitHub: https://github.com/hlong12042/CVE_2019_11043
    [CVE-2019-11043]
  15. GitHub: https://github.com/ianxtianxt/CVE-2019-11043
    [CVE-2019-11043]
  16. GitHub: https://github.com/izj007/wechat
    [CVE-2019-11043]
  17. GitHub: https://github.com/jas9reet/CVE-2019-11043
    [CVE-2019-11043: CVE-2019-11043 LAB]
  18. GitHub: https://github.com/jdecool/stars-feed
    [CVE-2019-11043]
  19. GitHub: https://github.com/jiangsir404/POC-S
    [CVE-2019-11043]
  20. GitHub: https://github.com/jptr218/php_hack
    [CVE-2019-11043]
  21. GitHub: https://github.com/lindemer/CVE-2019-11043
    [CVE-2019-11043: PHP-FPM Remote Command Execution Exploit]
  22. GitHub: https://github.com/linuxserver/docker-nextcloud
    [CVE-2019-11043]
  23. GitHub: https://github.com/lovechinacoco/https-github.com-mai-lang-chai-Middleware-Vulnerability-detection
    [CVE-2019-11043]
  24. GitHub: https://github.com/ltfafei/my_POC
    [CVE-2019-11043]
  25. GitHub: https://github.com/lucianonooijen/stargazed
    [CVE-2019-11043]
  26. GitHub: https://github.com/m0ver/drupal-installation-issues
    [CVE-2019-11043]
  27. GitHub: https://github.com/supercid/awesome-starred
    [CVE-2019-11043]
  28. GitHub: https://github.com/tdtc7/qps
    [CVE-2019-11043]
  29. GitHub: https://github.com/tinker-li/CVE-2019-11043
    [CVE-2019-11043]
  30. GitHub: https://github.com/tjkess/byol
    [CVE-2019-11043]
  31. GitHub: https://github.com/ugur-ercan/exploit-collection
    [CVE-2019-11043]
  32. GitHub: https://github.com/whoadmin/pocs
    [CVE-2019-11043]
  33. GitHub: https://github.com/zhengjim/loophole
    [CVE-2019-11043]
  34. GitHub: https://github.com/offensive-security/exploitdb-bin-sploits/blob/master/bin-sploits/47553.zip
    [EDB-47553]
  35. GitHub: https://github.com/0th3rs-Security-Team/CVE-2019-11043
    [CVE-2019-11043: CVE-2019-11043 PHP7.x RCE]
  36. GitHub: https://github.com/AleWong/PHP-FPM-Remote-Code-Execution-Vulnerability-CVE-2019-11043-
    [CVE-2019-11043: PHP-FPM Remote Code Execution Vulnerability (CVE-2019-11043) POC in Python]
  37. GitHub: https://github.com/B1gd0g/CVE-2019-11043
    [CVE-2019-11043]
  38. GitHub: https://github.com/corifeo/CVE-2019-11043
    [CVE-2019-11043: Quick and dirty PHP RCE proof of concept]
  39. GitHub: https://github.com/huowen/CVE-2019-11043
    [CVE-2019-11043: Python exp for CVE-2019-11043]
  40. GitHub: https://github.com/k8gege/CVE-2019-11043
    [CVE-2019-11043: Ladon POC Moudle CVE-2019-11043 (PHP-FPM + Ngnix)]
  41. GitHub: https://github.com/kriskhub/CVE-2019-11043
    [CVE-2019-11043: This repository provides a dockerized infrastructure and a python implementation of ...]
  42. GitHub: https://github.com/MRdoulestar/CVE-2019-11043
    [CVE-2019-11043: CVE-2019-11043 && PHP7.x && RCE EXP]
  43. GitHub: https://github.com/neex/phuip-fpizdam
    [CVE-2019-11043: Exploit for CVE-2019-11043]
  44. GitHub: https://github.com/shadow-horse/cve-2019-11043
    [CVE-2019-11043: CVE-2019-11043 PHP远程代码执行]
  45. GitHub: https://github.com/theMiddleBlue/CVE-2019-11043
    [CVE-2019-11043: (PoC) Python version of CVE-2019-11043 exploit by neex]
  46. GitHub: https://github.com/ypereirareis/docker-CVE-2019-11043
    [CVE-2019-11043: Docker image and commands to check CVE-2019-11043 vulnerability on nginx/php-fpm ...]
  47. GitHub: https://github.com/jas502n/CVE-2019-11043
    [CVE-2019-11043: Php-fpm+Nginx RCE]
  48. GitHub: https://github.com/moniik/CVE-2019-11043_env
    [CVE-2019-11043: Remote debug environment for CLion]

Before running any exploit against any system, make sure you are authorized by the owner of the target system(s) to perform such activity. In any other case, this would be considered as an illegal activity.

WARNING: Beware of using unverified exploits from sources such as GitHub or Exploit-DB. These exploits and PoCs could contain malware. For more information, see how to use exploits safely.

Risk Information


CVSS Score Source [?]: CVE-2019-11043
CVSS V2 Vector: AV:N/AC:L/Au:N/C:P/I:P/A:P/E:H/RL:OF/RC:C
CVSS Base Score:7.5 (High)
Impact Subscore:6.4
Exploitability Subscore:10.0
CVSS Temporal Score:6.5 (Medium)
CVSS Environmental Score:NA (None)
Modified Impact Subscore:NA
Overall CVSS Score:6.5 (Medium)
CVSS V3 Vector: CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H/E:H/RL:O/RC:C
CVSS Base Score:9.8 (Critical)
Impact Subscore:5.9
Exploitability Subscore:3.9
CVSS Temporal Score:9.4 (Critical)
CVSS Environmental Score:NA (None)
Modified Impact Subscore:NA
Overall CVSS Score:9.4 (Critical)
STIG Severity [?]: I
STIG Risk Rating: High

Go back to menu.

Plugin Source


This is the ubuntu_USN-4166-1.nasl nessus plugin source code. Ubuntu Security Notice (C) 2019-2022 Canonical, Inc. / NASL script (C) 2019-2022 and is owned by Tenable, Inc. or an Affiliate thereof.

#%NASL_MIN_LEVEL 70300
#
# (C) Tenable Network Security, Inc.
#
# The descriptive text and package checks in this plugin were
# extracted from Ubuntu Security Notice USN-4166-1. The text 
# itself is copyright (C) Canonical, Inc. See 
# <http://www.ubuntu.com/usn/>. Ubuntu(R) is a registered 
# trademark of Canonical, Inc.
#

include('deprecated_nasl_level.inc');
include("compat.inc");

if (description)
{
  script_id(130362);
  script_version("1.11");
  script_set_attribute(attribute:"plugin_modification_date", value:"2022/03/29");

  script_cve_id("CVE-2019-11043");
  script_xref(name:"USN", value:"4166-1");
  script_xref(name:"IAVA", value:"2019-A-0399-S");
  script_xref(name:"CISA-KNOWN-EXPLOITED", value:"2022/04/15");

  script_name(english:"Ubuntu 16.04 LTS / 18.04 LTS / 19.04 / 19.10 : PHP vulnerability (USN-4166-1)");
  script_summary(english:"Checks dpkg output for updated packages.");

  script_set_attribute(
    attribute:"synopsis",
    value:
"The remote Ubuntu host is missing one or more security-related
patches."
  );
  script_set_attribute(
    attribute:"description",
    value:
"It was discovered that PHP incorrectly handled certain paths when
being used in FastCGI configurations. A remote attacker could possibly
use this issue to execute arbitrary code.

Note that Tenable Network Security has extracted the preceding
description block directly from the Ubuntu security advisory. Tenable
has attempted to automatically clean and format it as much as possible
without introducing additional issues."
  );
  script_set_attribute(
    attribute:"see_also",
    value:"https://usn.ubuntu.com/4166-1/"
  );
  script_set_attribute(attribute:"solution", value:"Update the affected packages.");
  script_set_cvss_base_vector("CVSS2#AV:N/AC:L/Au:N/C:P/I:P/A:P");
  script_set_cvss_temporal_vector("CVSS2#E:H/RL:OF/RC:C");
  script_set_cvss3_base_vector("CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H");
  script_set_cvss3_temporal_vector("CVSS:3.0/E:H/RL:O/RC:C");
  script_set_attribute(attribute:"cvss_score_source", value:"CVE-2019-11043");
  script_set_attribute(attribute:"exploitability_ease", value:"Exploits are available");
  script_set_attribute(attribute:"exploit_available", value:"true");
  script_set_attribute(attribute:"metasploit_name", value:'PHP-FPM Underflow RCE');
  script_set_attribute(attribute:"exploit_framework_metasploit", value:"true");

  script_set_attribute(attribute:"plugin_type", value:"local");
  script_set_attribute(attribute:"cpe", value:"p-cpe:/a:canonical:ubuntu_linux:libapache2-mod-php7.0");
  script_set_attribute(attribute:"cpe", value:"p-cpe:/a:canonical:ubuntu_linux:libapache2-mod-php7.2");
  script_set_attribute(attribute:"cpe", value:"p-cpe:/a:canonical:ubuntu_linux:libapache2-mod-php7.3");
  script_set_attribute(attribute:"cpe", value:"p-cpe:/a:canonical:ubuntu_linux:php7.0-cgi");
  script_set_attribute(attribute:"cpe", value:"p-cpe:/a:canonical:ubuntu_linux:php7.0-cli");
  script_set_attribute(attribute:"cpe", value:"p-cpe:/a:canonical:ubuntu_linux:php7.0-fpm");
  script_set_attribute(attribute:"cpe", value:"p-cpe:/a:canonical:ubuntu_linux:php7.2-cgi");
  script_set_attribute(attribute:"cpe", value:"p-cpe:/a:canonical:ubuntu_linux:php7.2-cli");
  script_set_attribute(attribute:"cpe", value:"p-cpe:/a:canonical:ubuntu_linux:php7.2-fpm");
  script_set_attribute(attribute:"cpe", value:"p-cpe:/a:canonical:ubuntu_linux:php7.3-cgi");
  script_set_attribute(attribute:"cpe", value:"p-cpe:/a:canonical:ubuntu_linux:php7.3-cli");
  script_set_attribute(attribute:"cpe", value:"p-cpe:/a:canonical:ubuntu_linux:php7.3-fpm");
  script_set_attribute(attribute:"cpe", value:"cpe:/o:canonical:ubuntu_linux:16.04");
  script_set_attribute(attribute:"cpe", value:"cpe:/o:canonical:ubuntu_linux:18.04:-:lts");
  script_set_attribute(attribute:"cpe", value:"cpe:/o:canonical:ubuntu_linux:19.04");
  script_set_attribute(attribute:"cpe", value:"cpe:/o:canonical:ubuntu_linux:19.10");

  script_set_attribute(attribute:"vuln_publication_date", value:"2019/10/28");
  script_set_attribute(attribute:"patch_publication_date", value:"2019/10/28");
  script_set_attribute(attribute:"plugin_publication_date", value:"2019/10/29");
  script_set_attribute(attribute:"generated_plugin", value:"current");
  script_set_attribute(attribute:"stig_severity", value:"I");
  script_end_attributes();

  script_category(ACT_GATHER_INFO);
  script_copyright(english:"Ubuntu Security Notice (C) 2019-2022 Canonical, Inc. / NASL script (C) 2019-2022 and is owned by Tenable, Inc. or an Affiliate thereof.");
  script_family(english:"Ubuntu Local Security Checks");

  script_dependencies("ssh_get_info.nasl");
  script_require_keys("Host/cpu", "Host/Ubuntu", "Host/Ubuntu/release", "Host/Debian/dpkg-l");

  exit(0);
}


include("audit.inc");
include("ubuntu.inc");
include("misc_func.inc");

if ( ! get_kb_item("Host/local_checks_enabled") ) audit(AUDIT_LOCAL_CHECKS_NOT_ENABLED);
release = get_kb_item("Host/Ubuntu/release");
if ( isnull(release) ) audit(AUDIT_OS_NOT, "Ubuntu");
release = chomp(release);
if (! preg(pattern:"^(16\.04|18\.04|19\.04|19\.10)$", string:release)) audit(AUDIT_OS_NOT, "Ubuntu 16.04 / 18.04 / 19.04 / 19.10", "Ubuntu " + release);
if ( ! get_kb_item("Host/Debian/dpkg-l") ) audit(AUDIT_PACKAGE_LIST_MISSING);

cpu = get_kb_item("Host/cpu");
if (isnull(cpu)) audit(AUDIT_UNKNOWN_ARCH);
if ("x86_64" >!< cpu && cpu !~ "^i[3-6]86$") audit(AUDIT_LOCAL_CHECKS_NOT_IMPLEMENTED, "Ubuntu", cpu);

flag = 0;

if (ubuntu_check(osver:"16.04", pkgname:"libapache2-mod-php7.0", pkgver:"7.0.33-0ubuntu0.16.04.7")) flag++;
if (ubuntu_check(osver:"16.04", pkgname:"php7.0-cgi", pkgver:"7.0.33-0ubuntu0.16.04.7")) flag++;
if (ubuntu_check(osver:"16.04", pkgname:"php7.0-cli", pkgver:"7.0.33-0ubuntu0.16.04.7")) flag++;
if (ubuntu_check(osver:"16.04", pkgname:"php7.0-fpm", pkgver:"7.0.33-0ubuntu0.16.04.7")) flag++;
if (ubuntu_check(osver:"18.04", pkgname:"libapache2-mod-php7.2", pkgver:"7.2.24-0ubuntu0.18.04.1")) flag++;
if (ubuntu_check(osver:"18.04", pkgname:"php7.2-cgi", pkgver:"7.2.24-0ubuntu0.18.04.1")) flag++;
if (ubuntu_check(osver:"18.04", pkgname:"php7.2-cli", pkgver:"7.2.24-0ubuntu0.18.04.1")) flag++;
if (ubuntu_check(osver:"18.04", pkgname:"php7.2-fpm", pkgver:"7.2.24-0ubuntu0.18.04.1")) flag++;
if (ubuntu_check(osver:"19.04", pkgname:"libapache2-mod-php7.2", pkgver:"7.2.24-0ubuntu0.19.04.1")) flag++;
if (ubuntu_check(osver:"19.04", pkgname:"php7.2-cgi", pkgver:"7.2.24-0ubuntu0.19.04.1")) flag++;
if (ubuntu_check(osver:"19.04", pkgname:"php7.2-cli", pkgver:"7.2.24-0ubuntu0.19.04.1")) flag++;
if (ubuntu_check(osver:"19.04", pkgname:"php7.2-fpm", pkgver:"7.2.24-0ubuntu0.19.04.1")) flag++;
if (ubuntu_check(osver:"19.10", pkgname:"libapache2-mod-php7.3", pkgver:"7.3.11-0ubuntu0.19.10.1")) flag++;
if (ubuntu_check(osver:"19.10", pkgname:"php7.3-cgi", pkgver:"7.3.11-0ubuntu0.19.10.1")) flag++;
if (ubuntu_check(osver:"19.10", pkgname:"php7.3-cli", pkgver:"7.3.11-0ubuntu0.19.10.1")) flag++;
if (ubuntu_check(osver:"19.10", pkgname:"php7.3-fpm", pkgver:"7.3.11-0ubuntu0.19.10.1")) flag++;

if (flag)
{
  security_report_v4(
    port       : 0,
    severity   : SECURITY_HOLE,
    extra      : ubuntu_report_get()
  );
  exit(0);
}
else
{
  tested = ubuntu_pkg_tests_get();
  if (tested) audit(AUDIT_PACKAGE_NOT_AFFECTED, tested);
  else audit(AUDIT_PACKAGE_NOT_INSTALLED, "libapache2-mod-php7.0 / libapache2-mod-php7.2 / etc");
}

The latest version of this script can be found in these locations depending on your platform:

  • Linux / Unix:
    /opt/nessus/lib/nessus/plugins/ubuntu_USN-4166-1.nasl
  • Windows:
    C:\ProgramData\Tenable\Nessus\nessus\plugins\ubuntu_USN-4166-1.nasl
  • Mac OS X:
    /Library/Nessus/run/lib/nessus/plugins/ubuntu_USN-4166-1.nasl

Go back to menu.

How to Run


Here is how to run the Ubuntu 16.04 LTS / 18.04 LTS / 19.04 / 19.10 : PHP vulnerability (USN-4166-1) as a standalone plugin via the Nessus web user interface (https://localhost:8834/):

  1. Click to start a New Scan.
  2. Select Advanced Scan.
  3. Navigate to the Plugins tab.
  4. On the top right corner click to Disable All plugins.
  5. On the left side table select Ubuntu Local Security Checks plugin family.
  6. On the right side table select Ubuntu 16.04 LTS / 18.04 LTS / 19.04 / 19.10 : PHP vulnerability (USN-4166-1) plugin ID 130362.
  7. Specify the target on the Settings tab and click to Save the scan.
  8. Run the scan.

Here are a few examples of how to run the plugin in the command line. Note that the examples below demonstrate the usage on the Linux / Unix platform.

Basic usage:

/opt/nessus/bin/nasl ubuntu_USN-4166-1.nasl -t <IP/HOST>

Run the plugin with audit trail message on the console:

/opt/nessus/bin/nasl -a ubuntu_USN-4166-1.nasl -t <IP/HOST>

Run the plugin with trace script execution written to the console (useful for debugging):

/opt/nessus/bin/nasl -T - ubuntu_USN-4166-1.nasl -t <IP/HOST>

Run the plugin with using a state file for the target and updating it (useful for running multiple plugins on the target):

/opt/nessus/bin/nasl -K /tmp/state ubuntu_USN-4166-1.nasl -t <IP/HOST>

Go back to menu.

References


IAVA | Information Assurance Vulnerability Alert:
  • 2019-A-0399-S
USN | Ubuntu Security Notice: See also: Similar and related Nessus plugins:
  • 130276 - PHP < 7.1.33 / 7.2.x < 7.2.24 / 7.3.x < 7.3.11 Remote Code Execution Vulnerability.
  • 130283 - Debian DLA-1970-1 : php5 security update
  • 130329 - GLSA-201910-01 : PHP: Arbitrary code execution
  • 130349 - Debian DSA-4552-1 : php7.0 - security update
  • 130350 - Debian DSA-4553-1 : php7.3 - security update
  • 130390 - SUSE SLES12 Security Update : php7 (SUSE-SU-2019:2809-1)
  • 130411 - Fedora 31 : php (2019-4adc49a476)
  • 130421 - SUSE SLED15 / SLES15 Security Update : php7 (SUSE-SU-2019:2819-1)
  • 130442 - Oracle Linux 7 : php (ELSA-2019-3286)
  • 130445 - RHEL 7 : php (RHSA-2019:3286)
  • 130446 - RHEL 6 : php (RHSA-2019:3287)
  • 130447 - Scientific Linux Security Update : php on SL7.x x86_64 (20191031)
  • 130470 - Amazon Linux 2 : php (ALAS-2019-1344)
  • 130471 - Amazon Linux AMI : php71 / php72, php73, php56 (ALAS-2019-1315)
  • 130473 - CentOS 7 : php (CESA-2019:3286)
  • 130474 - CentOS 6 : php (CESA-2019:3287)
  • 130476 - Fedora 29 : php (2019-187ae3128d)
  • 130482 - Fedora 30 : php (2019-7bb07c3b02)
  • 130497 - Oracle Linux 6 : php (ELSA-2019-3287)
  • 130499 - Scientific Linux Security Update : php on SL6.x i386/x86_64 (20191031)
  • 130580 - openSUSE Security Update : php7 (openSUSE-2019-2441)
  • 130617 - FreeBSD : php -- env_path_info underflow in fpm_main.c can lead to RCE (6a7c2ab0-00dd-11ea-83ce-705a0f828759)

Version


This page has been produced using Nessus Professional 10.1.2 (#68) LINUX, Plugin set 202205072148.
Plugin file ubuntu_USN-4166-1.nasl version 1.11. For more plugins, visit the Nessus Plugin Library.

Go back to menu.