-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 ## Advisory Information Title: 4 TOTOLINK router models vulnerable to CSRF and XSS attacks Advisory URL: https://pierrekim.github.io/advisories/2015-totolink-0x01.txt Blog URL: http://pierrekim.github.io/blog/2015-07-16-4-TOTOLINK-products-vulnerable-to-CSRF-and-XSS-attacks.html Date published: 2015-07-16 Vendors contacted: None Release mode: Released, 0day CVE: no current CVE ## Product Description TOTOLINK is a brother brand of ipTime which wins over 80% of SOHO markets in South Korea. TOTOLINK produces routers, wifi access points and network devices. Their products are sold worldwide. ## Vulnerability Summary TOTOLINK iPuppy, iPuppy3, N100RE and N200RE are wireless LAN routers. Their current firmwares with default configuration are vulnerable to CSRF-attacks and XSS attacks. Since, the anti-CSRF protection is based on a static HTTP referrer (RFC 1945), an attacker can take over most of the configuration and settings using anyone inside the LAN of the router. Owners are urged to contact TOTOLINK, and activate authentication on this product (disabled by default). It affects (firmwares come from totolink.net and from totolink.cn): - TOTOLINK iPuppy : firmware 1.2.1 (TOTOLINK iPuppy__V1.2.1.update) - TOTOLINK iPuppy3 : firmware 1.0.2 (TOTOLINK iPuppy3_V1.0.2.update) - TOTOLINK N100RE-V1 : firmware V1.1-B20140723-2-432-EN (TOTOLINK-N100RE-IP04216-RT5350-SPI-1M8M-V1.1-B20140723-2-432-EN.update) - TOTOLINK N200RE : firmware V1.4-B20140724-2-457-EN (TOTOLINK-N200RE-IP04220-MT7620-SPI-1M8M-V1.4-B20140724-2-457-EN.update) ## Details - CSRF The HTTP interface allows to edit the configuration. This interface is vulnerable to CSRF. Configuration and settings can be modified with CSRF attacks: - Activate the remote control management - Change the DNS configuration - Update the firmware - Change the Wifi Configuration - Create TCP redirections to the LAN - and more... Example of forms exploiting the CSRF: o Activating the remote control management on port 31337/tcp listening on the WAN interface.
o Changing the DNS configuration to and
The variable GO is an open redirect. Any URL like http://www.google.com/ for instance can be used. The variable GO is also vulnerable to XSS. It's out of scope in this advisory. To bypass the protection (which checks the refer), you can, for example, base64 the form and include it in the webpage. The refer will be empty and the CSRF will be accepted by the device: o activate_admin_wan_csrf_bypass.html: Visiting activate_admin_wan_csrf_bypass.html in a remote location will activate the remote management interface on port 31337/TCP. You can test it through http://pierrekim.github.io/advisories/2015-totolink-0x01-PoC-change_dns_csrf_bypass.html o change_dns_csrf_bypass.html: Visiting activate_admin_wan_csrf_bypass.html in a remote location will change the DNS servers provided by the TOTOLINK device in the LAN. You can test it through http://pierrekim.github.io/advisories/2015-totolink-0x01-PoC-activate_admin_wan_csrf_bypass.html ## Details - stored XSS and fun There is a stored XSS, which can be injected using UPNP from the LAN, without authentication: upnp> host send 0 WANConnectionDevice WANIPConnection AddPortMapping Required argument: Argument Name: NewPortMappingDescription Data Type: string Allowed Values: [] Set NewPortMappingDescription value to: Required argument: Argument Name: NewLeaseDuration Data Type: ui4 Allowed Values: [] Set NewLeaseDuration value to: 0 Required argument: Argument Name: NewInternalClient Data Type: string Allowed Values: [] Set NewInternalClient value to: Required argument: Argument Name: NewEnabled Data Type: boolean Allowed Values: [] Set NewEnabled value to: 1 Required argument: Argument Name: NewExternalPort Data Type: ui2 Allowed Values: [] Set NewExternalPort value to: 80 Required argument: Argument Name: NewRemoteHost Data Type: string Allowed Values: [] Set NewRemoteHost value to: Required argument: Argument Name: NewProtocol Data Type: string Allowed Values: ['TCP', 'UDP'] Set NewProtocol value to: TCP Required argument: Argument Name: NewInternalPort Data Type: ui2 Allowed Values: [] Set NewInternalPort value to: 80 upnp> The UPNP webpage in the administration area ( will show: [...] TCP 21331 :28777 [...] - - - - From my research, there are some bits overflapping with others, resulting in showing funny ports and truncating input data. A remote DoS against the upnpd process seems to be easily done. Gaining Remote Code Execution by UPNP exploitation is again left as a exercise for the reader. ## Vendor Response Due to "un-ethical code" found in TOTOLINK products (= backdoors found in new TOTOLINK devices), TOTOLINK was not contacted in regard of this case. ## Report Timeline * Apr 20, 2015: Vulnerabilities found by Pierre Kim in ipTIME devices. * Jun 20, 2015: Vulnerabilities confirmed with reliable PoCs. * Jun 25, 2015: Vulnerabilities found in TOTOLINK products by looking for similar ipTIME products. * Jul 16, 2015: A public advisory is sent to security mailing lists. ## Credit These vulnerabilities were found by Pierre Kim (@PierreKimSec). ## Greetings Big thanks to Alexandre Torres. ## References https://pierrekim.github.io/advisories/2015-totolink-0x01.txt ## Disclaimer This advisory is licensed under a Creative Commons Attribution Non-Commercial Share-Alike 3.0 License: http://creativecommons.org/licenses/by-nc-sa/3.0/ -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCgAGBQJVq/PbAAoJEMQ+Dtp9ky28JPQQAIaJJ3qgA0YZQ7AG39aUav3t z53mLvi5Cej3FfLVFxWeejbdkLWRLQCr+jwLH/oNyc4V4N/aDE7X8LNWDsN5LRQv wN21zY83sGkcG8FB3cSSubMjWZ2ZjeH7MSwSryXjfIO/RAFfRFFPV/1abdkqQWIn WvLHkDMI/8fHJc5mNJeAqqtsK9+t0kz6OdABmvAA5dNGd1ZddEaG/HW8xnebcAlh ByuLynQ5rgUGr+eTmB+DZinMk1e/P6ZiEs0urmIshUYeX3gx808Q68tF7jKcJNtr lC5NVJ6h8cQ3pjMOMs/5RQLcC6aCRidX3AoaO/kyibMTz+F6VwJD2WQwxb78M0B3 FjjrHb+v1MdLhantwhZ1mfznm7rJ1/5TCq0hVjQ6sXc5/KbkZRQWq8IC65I6kFRm aRp2U17C5OLJ4KQ2vYb/0yy4KaIL1C7gCB2oWZ8CyyG53wn79CxcPQ5uO2Jnf6XM UP597Bq1JDlDsTGpMjf0kBZ8v2vcjc3gN8EZg7T2w4aNuxMjm+Y8gbu51s8yDSdC G0xg6mqZa2ZIt2FbWmMgo/+t04aBaUGB4y5tIeILWH2FFrHlpyvtuU5IMys/DiO+ 7Nr8g4RTEskP8x2/TAh05YJYcY8Bai5RTAQaTwT3cUNdp3B8UiLxtVwfTzmI4//F bjG1WlLuMMpz1dwPfEB6 =c3Q7 -----END PGP SIGNATURE-----