Lucene search
+L

OSSEC 2.7 < 2.8.1 - 'diff' Local Privilege Escalation

🗓️ 11 Jun 2015 00:00:00Reported by Andrew WiddersheimType 
exploitdb
 exploitdb
🔗 www.exploit-db.com👁 52 Views

OSSEC 2.7 to 2.8.1 'diff' Local Privilege Escalation CVE-2015-3222 Fi

Related
Code
ReporterTitlePublishedViews
Family
zdt
zdt
OSSEC 2.7 <= 2.8.1 - Local Root Escalation Vulnerability
11 Jun 201500:00
–zdt
freebsd
FreeBSD
security/ossec-hids-* -- root escalation via syscheck feature
11 Jun 201500:00
–freebsd
cnvd
CNVD
OSSEC Remote Code Execution Vulnerability
26 Jun 201500:00
–cnvd
cve
CVE
CVE-2015-3222
7 Sep 201720:00
–cve
cvelist
Cvelist
CVE-2015-3222
7 Sep 201720:00
–cvelist
euvd
EUVD
EUVD-2015-3282
7 Oct 202500:30
–euvd
exploitpack
exploitpack
OSSEC 2.7 2.8.1 - diff Local Privilege Escalation
11 Jun 201500:00
–exploitpack
nessus
Tenable Nessus
FreeBSD : security/ossec-hids-* -- root escalation via syscheck feature (c470db07-1098-11e5-b6a8-002590263bf5)
15 Jun 201500:00
–nessus
mend
Mend
CVE-2015-3222
7 Sep 201720:00
–mend
nvd
NVD
CVE-2015-3222
7 Sep 201720:29
–nvd
Rows per page
Fix for CVE-2015-3222 which allows for root escalation via syscheck - https://github.com/ossec/ossec-hids/releases/tag/2.8.2

Affected versions: 2.7 - 2.8.1

Beginning is OSSEC 2.7 (d88cf1c9) a feature was added to syscheck, which
is the daemon that monitors file changes on a system, called
"report_changes". This feature is only available on *NIX systems. It's
purpose is to help determine what about a file has changed. The logic to
do accomplish this is as follows which can be found in
src/syscheck/seechanges.c:

252 /* Run diff */
253 date_of_change = File_DateofChange(old_location);
254 snprintf(diff_cmd, 2048, "diff \"%s\" \"%s\"> \"%s/local/%s/diff.%d\" "
255     "2>/dev/null",
256     tmp_location, old_location,
257     DIFF_DIR_PATH, filename + 1, (int)date_of_change);
258 if (system(diff_cmd) != 256) {
259     merror("%s: ERROR: Unable to run diff for %s",
260            ARGV0,  filename);
261     return (NULL);
262 }

Above, on line 258, the system() call is used to shell out to the
system's "diff" command. The raw filename is passed in as an argument
which presents an attacker with the possibility to run arbitrary code.
Since the syscheck daemon runs as the root user so it can inspect any
file on the system for changes, any code run using this vulnerability
will also be run as the root user.

An example attack might be creating a file called "foo-$(touch bar)"
which should create another file "bar".

Again, this vulnerability exists only on *NIX systems and is contingent
on the following criteria:

1. A vulnerable version is in use.
2. The OSSEC agent is configured to use syscheck to monitor the file
system for changes.
3. The list of directories monitored by syscheck includes those writable
by underprivileged users.
4. The "report_changes" option is enabled for any of those directories.

The fix for this is to create temporary trusted file names that symlink
back to the original files before calling system() and running the
system's "diff" command.

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation