Vulnerabilities > CVE-2013-2171 - Permissions, Privileges, and Access Controls vulnerability in Freebsd 9.0/9.1
Attack vector
LOCAL Attack complexity
MEDIUM Privileges required
NONE Confidentiality impact
COMPLETE Integrity impact
COMPLETE Availability impact
COMPLETE Summary
The vm_map_lookup function in sys/vm/vm_map.c in the mmap implementation in the kernel in FreeBSD 9.0 through 9.1-RELEASE-p4 does not properly determine whether a task should have write access to a memory location, which allows local users to bypass filesystem write permissions and consequently gain privileges via a crafted application that leverages read permissions, and makes mmap and ptrace system calls.
Vulnerable Configurations
Part | Description | Count |
---|---|---|
OS | 3 |
Common Weakness Enumeration (CWE)
Common Attack Pattern Enumeration and Classification (CAPEC)
- Accessing, Modifying or Executing Executable Files An attack of this type exploits a system's configuration that allows an attacker to either directly access an executable file, for example through shell access; or in a possible worst case allows an attacker to upload a file and then execute it. Web servers, ftp servers, and message oriented middleware systems which have many integration points are particularly vulnerable, because both the programmers and the administrators must be in synch regarding the interfaces and the correct privileges for each interface.
- Leverage Executable Code in Non-Executable Files An attack of this type exploits a system's trust in configuration and resource files, when the executable loads the resource (such as an image file or configuration file) the attacker has modified the file to either execute malicious code directly or manipulate the target process (e.g. application server) to execute based on the malicious configuration parameters. Since systems are increasingly interrelated mashing up resources from local and remote sources the possibility of this attack occurring is high. The attack can be directed at a client system, such as causing buffer overrun through loading seemingly benign image files, as in Microsoft Security Bulletin MS04-028 where specially crafted JPEG files could cause a buffer overrun once loaded into the browser. Another example targets clients reading pdf files. In this case the attacker simply appends javascript to the end of a legitimate url for a pdf (http://www.gnucitizen.org/blog/danger-danger-danger/) http://path/to/pdf/file.pdf#whatever_name_you_want=javascript:your_code_here The client assumes that they are reading a pdf, but the attacker has modified the resource and loaded executable javascript into the client's browser process. The attack can also target server processes. The attacker edits the resource or configuration file, for example a web.xml file used to configure security permissions for a J2EE app server, adding role name "public" grants all users with the public role the ability to use the administration functionality. The server trusts its configuration file to be correct, but when they are manipulated, the attacker gains full control.
- Blue Boxing This type of attack against older telephone switches and trunks has been around for decades. A tone is sent by an adversary to impersonate a supervisor signal which has the effect of rerouting or usurping command of the line. While the US infrastructure proper may not contain widespread vulnerabilities to this type of attack, many companies are connected globally through call centers and business process outsourcing. These international systems may be operated in countries which have not upgraded Telco infrastructure and so are vulnerable to Blue boxing. Blue boxing is a result of failure on the part of the system to enforce strong authorization for administrative functions. While the infrastructure is different than standard current applications like web applications, there are historical lessons to be learned to upgrade the access control for administrative functions.
- Restful Privilege Elevation Rest uses standard HTTP (Get, Put, Delete) style permissions methods, but these are not necessarily correlated generally with back end programs. Strict interpretation of HTTP get methods means that these HTTP Get services should not be used to delete information on the server, but there is no access control mechanism to back up this logic. This means that unless the services are properly ACL'd and the application's service implementation are following these guidelines then an HTTP request can easily execute a delete or update on the server side. The attacker identifies a HTTP Get URL such as http://victimsite/updateOrder, which calls out to a program to update orders on a database or other resource. The URL is not idempotent so the request can be submitted multiple times by the attacker, additionally, the attacker may be able to exploit the URL published as a Get method that actually performs updates (instead of merely retrieving data). This may result in malicious or inadvertent altering of data on the server.
- Target Programs with Elevated Privileges This attack targets programs running with elevated privileges. The attacker would try to leverage a bug in the running program and get arbitrary code to execute with elevated privileges. For instance an attacker would look for programs that write to the system directories or registry keys (such as HKLM, which stores a number of critical Windows environment variables). These programs are typically running with elevated privileges and have usually not been designed with security in mind. Such programs are excellent exploit targets because they yield lots of power when they break. The malicious user try to execute its code at the same level as a privileged system call.
Exploit-Db
description FreeBSD 9 - Address Space Manipulation Privilege Escalation. CVE-2013-2171. Local exploit for freebsd platform id EDB-ID:26454 last seen 2016-02-03 modified 2013-06-26 published 2013-06-26 reporter metasploit source https://www.exploit-db.com/download/26454/ title FreeBSD 9 - Address Space Manipulation Privilege Escalation description FreeBSD 9.0-9.1 mmap/ptrace - Privilege Escalation Exploit. CVE-2013-2171. Local exploit for freebsd platform id EDB-ID:26368 last seen 2016-02-03 modified 2013-06-21 published 2013-06-21 reporter Hunger source https://www.exploit-db.com/download/26368/ title FreeBSD 9.0-9.1 mmap/ptrace - Privilege Escalation Exploit
Metasploit
description | This module exploits a vulnerability that can be used to modify portions of a process's address space, which may lead to privilege escalation. Systems such as FreeBSD 9.0 and 9.1 are known to be vulnerable. |
id | MSF:EXPLOIT/FREEBSD/LOCAL/MMAP |
last seen | 2020-06-10 |
modified | 2017-07-24 |
published | 2013-06-24 |
references | |
reporter | Rapid7 |
source | https://github.com/rapid7/metasploit-framework/blob/master//modules/exploits/freebsd/local/mmap.rb |
title | FreeBSD 9 Address Space Manipulation Privilege Escalation |
Nessus
NASL family FreeBSD Local Security Checks NASL id FREEBSD_PKG_ABEF280DD82911E2B71C8C705AF55518.NASL description Due to insufficient permission checks in the virtual memory system, a tracing process (such as a debugger) may be able to modify portions of the traced process last seen 2020-06-01 modified 2020-06-02 plugin id 66919 published 2013-06-19 reporter This script is Copyright (C) 2013-2018 and is owned by Tenable, Inc. or an Affiliate thereof. source https://www.tenable.com/plugins/nessus/66919 title FreeBSD : FreeBSD -- Privilege escalation via mmap (abef280d-d829-11e2-b71c-8c705af55518) code # # (C) Tenable Network Security, Inc. # # The descriptive text and package checks in this plugin were # extracted from the FreeBSD VuXML database : # # Copyright 2003-2018 Jacques Vidrine and contributors # # Redistribution and use in source (VuXML) and 'compiled' forms (SGML, # HTML, PDF, PostScript, RTF and so forth) with or without modification, # are permitted provided that the following conditions are met: # 1. Redistributions of source code (VuXML) must retain the above # copyright notice, this list of conditions and the following # disclaimer as the first lines of this file unmodified. # 2. Redistributions in compiled form (transformed to other DTDs, # published online in any format, converted to PDF, PostScript, # RTF and other formats) must reproduce the above copyright # notice, this list of conditions and the following disclaimer # in the documentation and/or other materials provided with the # distribution. # # THIS DOCUMENTATION IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, # OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT # OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR # BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE # OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS DOCUMENTATION, # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # include("compat.inc"); if (description) { script_id(66919); script_version("1.12"); script_cvs_date("Date: 2018/11/10 11:49:43"); script_cve_id("CVE-2013-2171"); script_bugtraq_id(60615); script_xref(name:"FreeBSD", value:"SA-13:06.mmap"); script_name(english:"FreeBSD : FreeBSD -- Privilege escalation via mmap (abef280d-d829-11e2-b71c-8c705af55518)"); script_summary(english:"Checks for updated package in pkg_info output"); script_set_attribute( attribute:"synopsis", value:"The remote FreeBSD host is missing a security-related update." ); script_set_attribute( attribute:"description", value: "Due to insufficient permission checks in the virtual memory system, a tracing process (such as a debugger) may be able to modify portions of the traced process's address space to which the traced process itself does not have write access." ); # https://vuxml.freebsd.org/freebsd/abef280d-d829-11e2-b71c-8c705af55518.html script_set_attribute( attribute:"see_also", value:"http://www.nessus.org/u?2e47e853" ); script_set_attribute(attribute:"solution", value:"Update the affected package."); script_set_cvss_base_vector("CVSS2#AV:L/AC:M/Au:N/C:C/I:C/A:C"); script_set_cvss_temporal_vector("CVSS2#E:H/RL:OF/RC:C"); script_set_attribute(attribute:"exploitability_ease", value:"Exploits are available"); script_set_attribute(attribute:"exploit_available", value:"true"); script_set_attribute(attribute:"exploit_framework_core", value:"true"); script_set_attribute(attribute:"exploited_by_malware", value:"true"); script_set_attribute(attribute:"metasploit_name", value:'FreeBSD 9 Address Space Manipulation Privilege Escalation'); script_set_attribute(attribute:"exploit_framework_metasploit", value:"true"); script_set_attribute(attribute:"exploit_framework_canvas", value:"true"); script_set_attribute(attribute:"canvas_package", value:'CANVAS'); script_set_attribute(attribute:"plugin_type", value:"local"); script_set_attribute(attribute:"cpe", value:"p-cpe:/a:freebsd:freebsd:FreeBSD"); script_set_attribute(attribute:"cpe", value:"cpe:/o:freebsd:freebsd"); script_set_attribute(attribute:"vuln_publication_date", value:"2013/06/18"); script_set_attribute(attribute:"patch_publication_date", value:"2013/06/18"); script_set_attribute(attribute:"plugin_publication_date", value:"2013/06/19"); script_end_attributes(); script_category(ACT_GATHER_INFO); script_copyright(english:"This script is Copyright (C) 2013-2018 and is owned by Tenable, Inc. or an Affiliate thereof."); script_family(english:"FreeBSD Local Security Checks"); script_dependencies("ssh_get_info.nasl"); script_require_keys("Host/local_checks_enabled", "Host/FreeBSD/release", "Host/FreeBSD/pkg_info", "Settings/ParanoidReport"); exit(0); } include("audit.inc"); include("freebsd_package.inc"); if (!get_kb_item("Host/local_checks_enabled")) audit(AUDIT_LOCAL_CHECKS_NOT_ENABLED); if (!get_kb_item("Host/FreeBSD/release")) audit(AUDIT_OS_NOT, "FreeBSD"); if (!get_kb_item("Host/FreeBSD/pkg_info")) audit(AUDIT_PACKAGE_LIST_MISSING); if (report_paranoia < 2) audit(AUDIT_PARANOID); flag = 0; if (pkg_test(save_report:TRUE, pkg:"FreeBSD>=9.0<9.1_4")) flag++; if (flag) { if (report_verbosity > 0) security_warning(port:0, extra:pkg_report_get()); else security_warning(0); exit(0); } else audit(AUDIT_HOST_NOT, "affected");
NASL family Debian Local Security Checks NASL id DEBIAN_DSA-2714.NASL description Konstantin Belousov and Alan Cox discovered that insufficient permission checks in the memory management of the FreeBSD kernel could lead to privilege escalation. last seen 2020-03-17 modified 2013-06-26 plugin id 66976 published 2013-06-26 reporter This script is Copyright (C) 2013-2020 and is owned by Tenable, Inc. or an Affiliate thereof. source https://www.tenable.com/plugins/nessus/66976 title Debian DSA-2714-1 : kfreebsd-9 - programming error
Packetstorm
data source https://packetstormsecurity.com/files/download/122164/mmap.rb.txt id PACKETSTORM:122164 last seen 2016-12-05 published 2013-06-26 reporter Alan Cox source https://packetstormsecurity.com/files/122164/FreeBSD-9-Address-Space-Manipulation-Privilege-Escalation.html title FreeBSD 9 Address Space Manipulation Privilege Escalation data source https://packetstormsecurity.com/files/download/122135/fbsd9mmap-escalate.txt id PACKETSTORM:122135 last seen 2016-12-05 published 2013-06-22 reporter SynQ source https://packetstormsecurity.com/files/122135/FreeBSD-9.0-Privilege-Escalation.html title FreeBSD 9.0+ Privilege Escalation
Seebug
bulletinFamily exploit description BUGTRAQ ID: 60615 CVE(CAN) ID: CVE-2013-2171 FreeBSD是一种UNIX操作系统,是由经过BSD、386BSD和4.4BSD发展而来的Unix的一个重要分支 FreeBSD 9.0及其他版本的虚拟内存系统对权限检查不充分,注入debugger之类的跟踪进程可在未授权情况下修改被跟踪进程的地址空间,覆盖内核内存,造成权限提升或系统崩溃 0 FreeBSD >= 9.0 厂商补丁: FreeBSD ------- FreeBSD已经为此发布了一个安全公告(FreeBSD-SA-13:06.mmap.asc)以及相应补丁: FreeBSD-SA-13:06.mmap.asc:Privilege escalation via mmap 链接:http://www.freebsd.org/security/advisories/FreeBSD-SA-13:06.mmap.asc id SSV:60871 last seen 2017-11-19 modified 2013-07-05 published 2013-07-05 reporter Root source https://www.seebug.org/vuldb/ssvid-60871 title FreeBSD 本地权限提升漏洞(CVE-2013-2171) bulletinFamily exploit description Bugtraq ID:60615 CVE ID:CVE-2013-2171 FreeBSD是一款基于BSD的操作系统 FreeBSD虚拟内存系统实现存在错误,允许本地攻击者利用漏洞通过某些内存映射和跟踪操作,未授权对某些文件进行修改。 要成功利用漏洞需要用户对文件拥有读权限 0 FreeBSD 9.0 厂商解决方案 1) 将有漏洞的系统升级到FreeBSD STABLE或RELEASE安全版本。 2) 通过源代码路径升级受此漏洞影响的系统: 以下补丁确认可应用于FreeBSD release版本。 a) 从以下位置下载相关补丁,并使用PGP工具验证附带的PGP签名。 # fetch http://security.FreeBSD.org/patches/SA-13:06/mmap.patch # fetch http://security.FreeBSD.org/patches/SA-13:06/mmap.patch.asc # gpg --verify mmap.patch.asc b) 以root执行以下命令: # cd /usr/src # patch < /path/to/patch c)重编译内核。 3)通过两进制补丁升级有漏洞的系统 在i386或amd64平台上运行RELEASE的系统,可通过freebsd-update(8)工具升级: # freebsd-update fetch # freebsd-update install id SSV:60853 last seen 2017-11-19 modified 2013-06-26 published 2013-06-26 reporter Root title FreeBSD 9.0 本地权限提升漏洞(CVE-2013-2171) bulletinFamily exploit description No description provided by source. id SSV:80089 last seen 2017-11-19 modified 2014-07-01 published 2014-07-01 reporter Root source https://www.seebug.org/vuldb/ssvid-80089 title FreeBSD 9 Address Space Manipulation Privilege Escalation