Today we got our hands on a brand new TP Link Archer C5 router which we will be testing for known vulnerabilities such as hidden backdoors and vulnerabilities, brute force default passwords and WPS vulnerabilities. In this new WiFi hacking tutorial we will be using different tools on Kali Linux 2.0 like Reaver, pixiewps and the Aircrack-ng suite to exploit possible vulnerabilities. TP Link is known to use easy to break default passwords such as the WPS PIN as default wireless password or a password which is derived directly from the MAC address. Especially the last one would make it very easy to retrieve the password because the MAC address is not meant to be secret and is actually send with every single wireless packet send from the router. With a packet analyser like Wireshark it is very easy to retrieve MAC addresses from sending and receiving devices, including the router. In this tutorial we’ll be using airodump-ng for this purpose.
TP Link Archer C5 Router Specifications
The TP Link Archer C5 Router is a consumer grade router priced at approximately $70,- dollars and offers a lot of value for the money. The router supports the 802.11 ac standard and offers dual band simultaneous 2.4GHz 300Mbps and 5GHz 867Mbps connections for a total available bandwidth of 1.2Gbps. Both IPv4 and IPv6 are supported by the router. The TP-Link Archer C5 has the following antennas and ports available:
TP Link Archer C5 Front view
TP Link Archer C5 Rear view
With a private wireless guest network you don’t have to share your WiFi password with anyone.
TP Link Archer C5 package contents
The contents of the package included:
TP Link Archer C5 Default passwords and settings
As we already expected the default password for the wireless network is the default WPS PIN which consists of 8 numbers. The C5 router we’re testing has the following default WPS PIN which is used as the default wireless key: 98159338. The default username and password to access the router settings is just like all TP Link routers:
Username: admin
Password: admin
TP Link Archer C5 Default SSID settings
The standard SSID name for the 2.4 GHz network is TP-LINK_A361 and for the 5 GHz network is TP-LINK_A360. The standard SSID is based on the routers MAC Address and consists of the last 4 digits of the MAC address subtracted by 1 for the 2.4 GHz SSID and subtracted by 2 with _5G added for the 5 GHz SSID.
The MAC address is in hexadecimal notation so if the MAC address ends with a letter that letter is actually a number in decimal notation. For example when the MAC address ends with an A, which is hexadecimal for 10 in decimal, you should subtract 1 from 10 to determine the last digit of the default SSID which would be 9 in this case. If you want to calculate the last digit of the MAC address using the default SSID you would know that it would be A when the last digit of the default SSID is 9.
So far so good because there are TP Link routers around which have their default wireless password based on the MAC address. This is not the case for the TP Link Archer C5 router. Let’s continue with connecting the router and see if it has any WPS vulnerabilities we can exploit.
Scanning the TP Link Archer C5 for WPS vulnerabilities
Wi-Fi Protected Setup (WPS) provides simplified mechanisms connect to wireless networks with a PIN consisting of 8 numbers. The PIN exchange mechanism is vulnerable to brute-force attacks which will return the PIN and WPA key to the attack which can be used to connect to the wireless network. Theoretically there are 10^8 (= 100.000.000) possible values for the WPS PIN. Unfortunately the WPS PIN consists of 8 numbers divided into 3 segments from which can be tested separately with a brute force attack. The last digit is checksum which can be calculated. The PIN has been composed as following:
WPS is enabled by default on the TP Link Archer C5 router so we will be checking it for known WPS vulnerabilities. We’ve done several tutorials on Hacking Tutorials about exploiting WPS vulnerabilities with Reaver and Pixiewps so we won’t get into great detail on these. For detailed tutorials on these subjects have a look at <tutorial name> and <tutorial name>. Let’s fire up Kali Linux and see if we can hack the TP Link Archer C5 router by brute forcing the WPS PIN with Reaver.
Brute forcing the Archer C5 WPS PIN with reaver
First we put our Wifi adapter in monitoring mode using the following command:
Airmon-ng start wlan0
The interface for the monitoring adapter will be wlan0mon. You will most likely receive a message about process who might cause trouble, kill them using the kill command. We can use airodump-ng to locate our access point and retrieve the MAC address. Use the following command to start airodump-ng:
airodump-ng –i wlan0mon
The MAC address appears in the first column which can be copied to your clipboard.
Next we will use the following command to start Reaver:
reaver –I wlan0mon –b [router MAC address]–c [channel]–vv
The reaver attack will start testing some common PINS and will than start with 0 and work its way up to 9.999 for the first WPS PIN segment. As we already expected the TP Link router has rate limiting on the number of WPS attempts. It will lock up after a couple attempts and we need to unlock it manually. When the rate limiting occurs Reaver will throw a warning as following:
TP Link Archer C5 Pixie dust attack
Another WPS vulnerability is known as the Pixie Dust Attack. The Pixie dust attack is performed with a modified version of Reaver with a secondary tool called pixiewps. The pixie dust attack is an offline WPS attack which means that the attackers retrieves the needed data in seconds which than can be used to retrieve the wireless password. This is only applicable to routers which are vulnerable to this attack. Let’s see if the TP Link Archer C5 is vulnerable to this offline pixie dust attack.
To start the pixie dust attack using Reaver use the following command:
reaver -i wlan0mon -b [Router MAC address] -c [channel]-vvv -K 1 –f
Or use the following command to start pixiewps manually and supply the needed data yourself:
pixiewps -e [PKE] -s [EHASH1] -z [EHASH2] -a [AUTHKEY] -S
The TP Link Archer C5 router seems to be invulnerable to the pixie dust WPS attack. If a router is vulnerable than pixiewps will return the WPS PIN which can be used in Reaver to retrieve the WPA key using the following command:
reaver -i mon0 -c 1 -b [Router MAC] -vv -S –pin=[WPS PIN]
Let’s see if we run this command on the Archer C5 with the valid WPS PIN:
reaver -i mon0 -c 1 -b [Router MAC] –vv –d 0 –w –n -S –pin=98159338
With the correct PIN Reaver will return the WPA PSK.
Although the access point locks itself up after a few attempts it is possible to retrieve the WPA PSK with the correct WPS PIN and Reaver.
Reversing the default WPS PIN
The remaining question now is how does the TP Link Archer C5 generates the default WPS PIN because every time we restore the WPS PIN it resets back to the same default PIN. Some router manufacturers, like Belkin (Belkin N900) and D-Link (D-Link DIR-810L), used to calculate the default PIN from the MAC address in the past which has been discovered by reversing engineering the algorithm. Other routers have the default PIN programmed in the NVRAM at the factory. NVRAM stands for Non-volatile random-access memory which is memory that retains the stored content after the power is turned off. Of course router manufacturers do not want to lose the default WPS PIN after powering off the device.
At this moment we do not know which method is used by TP-Link for restoring the default PIN of the Archer C5 router. If somebody succeeds in finding a method to reverse the default WPS PIN from static figures like the MAC Address or serial number it would leave a lot of routers vulnerable with WPS turned on. Retrieving the wireless password would then be as simple as feeding the PIN, BSSID and channel to Reaver as we’ve demonstrated earlier in this tutorial.
Defending against attackers exploiting WPS vulnerabilities
We always recommend you to turn off WPS in the router settings to prevent attackers from exploiting WPS vulnerabilities. Even though this router is not vulnerable to any of the tested WPS attacks, new WPS vulnerabilities can arise without you knowing it. Since routers basically have a long lifecycle (often without updates) when used in homes and small offices it is even more advised to turn this useless feature off. For the Archer C5 router you can simply access the wireless menu and turn WPS off using the ‘Disable WPS’ button as pictured below.
Disable WPS in this menu
Let’s continue to see if the router has any known backdoors or vulnerabilities in the next chapter.
TP Link Archer C5 Backdoors and Vulnerabilities
A good point to start searching for known backdoors and vulnerabilities for our TP Link Archer C5 router is the National Vulnerability Database and exploit database websites. On these websites we’ve came across two vulnerabilities for the Archer C5 router with a high severity rating; CVE-2015-3035 and CVE-2015-3036. Both vulnerabilities have been fixed already by the vendor through a firmware update in 2015.
CVE-2015-3035: Directory traversal vulnerability
This directory traversal vulnerability allows the remote attacker to read arbitrary files via a .. (dot dot) in the PATH_INFO to login/. This vulnerability affects the following TP Link router products including the Archer C5 router (Hardware version 1.2) with firmware before 150317:
CVE-2015-3036: Stack-based buffer overflow in the KCodes NetUSB module
Stack-based buffer overflow in the run_init_sbus function in the KCodes NetUSB module for the Linux kernel. KCodes NetUSB is used in certain Netgear, TP-LINK, and other products and allows remote attackers to execute arbitrary code by providing a long computer name in a session on TCP port 20005. You can find more information about this vulnerability here:
How to avoid vulnerability exploits on your router
Both of the severe rated vulnerabilities show you the importance of keeping the firmware of your router up-to-date. CVE-2015-3035 and CVE-2015-3036 were fixed in 2015 for the Archer C5 with the following update: Archer C5(UN)_V2_150515. TP Link mentions the following about the update on their website:
Brute forcing the TP Link Archer C5 default password
The default wireless password for the Archer C5 router is the default WPS PIN. The WPS PIN is an eight number figure which leaves us with 10^8 = 100.000.000 different possibilities if we would brute force the password. In the Cracking WPA with oclHashcat GPU on Windows tutorial from last year we’ve learned that an old video card like an AMD Radeon 7670M can do 20.000 attempts per second. A newer and more powerful video card like the AMD HD7970 can easily do 142.000 attempts per second. When we divide the 100 million possibilities by 142.000 it takes 705 seconds, which is less than 12 minutes, to brute force the password. Keep in mind that a newer and better performing video card could probably do it less than 10 minutes. With these figures coming from consumer grade hardware with really average processing power we’re still surprised that TP Link is using the default WPS PIN as default wireless password. If there was any good reason to do that, they could at least inform or warn the end user about changing the default wireless password to a more secure one. Last year we already did a tutorial on how brute force WPA passwords with the power of GPU’s. You can watch it here.
TP Link Archer C5 Router Specifications
The TP Link Archer C5 Router is a consumer grade router priced at approximately $70,- dollars and offers a lot of value for the money. The router supports the 802.11 ac standard and offers dual band simultaneous 2.4GHz 300Mbps and 5GHz 867Mbps connections for a total available bandwidth of 1.2Gbps. Both IPv4 and IPv6 are supported by the router. The TP-Link Archer C5 has the following antennas and ports available:
- 2 External detachable antenna
- 1 Gigabit WAN port
- 4 Gigabit LAN ports
- 2 USB ports for external devices
TP Link Archer C5 Front view
TP Link Archer C5 Rear view
With a private wireless guest network you don’t have to share your WiFi password with anyone.
TP Link Archer C5 package contents
The contents of the package included:
- AC1200 Wireless Dual Band Gigabit Router Archer C5
- 2 detachable antennas
- Power supply unit
- Resource CD
- Ethernet Cable
- Quick Installation Guide
TP Link Archer C5 Default passwords and settings
As we already expected the default password for the wireless network is the default WPS PIN which consists of 8 numbers. The C5 router we’re testing has the following default WPS PIN which is used as the default wireless key: 98159338. The default username and password to access the router settings is just like all TP Link routers:
Username: admin
Password: admin
TP Link Archer C5 Default SSID settings
The standard SSID name for the 2.4 GHz network is TP-LINK_A361 and for the 5 GHz network is TP-LINK_A360. The standard SSID is based on the routers MAC Address and consists of the last 4 digits of the MAC address subtracted by 1 for the 2.4 GHz SSID and subtracted by 2 with _5G added for the 5 GHz SSID.
The MAC address is in hexadecimal notation so if the MAC address ends with a letter that letter is actually a number in decimal notation. For example when the MAC address ends with an A, which is hexadecimal for 10 in decimal, you should subtract 1 from 10 to determine the last digit of the default SSID which would be 9 in this case. If you want to calculate the last digit of the MAC address using the default SSID you would know that it would be A when the last digit of the default SSID is 9.
So far so good because there are TP Link routers around which have their default wireless password based on the MAC address. This is not the case for the TP Link Archer C5 router. Let’s continue with connecting the router and see if it has any WPS vulnerabilities we can exploit.
Scanning the TP Link Archer C5 for WPS vulnerabilities
Wi-Fi Protected Setup (WPS) provides simplified mechanisms connect to wireless networks with a PIN consisting of 8 numbers. The PIN exchange mechanism is vulnerable to brute-force attacks which will return the PIN and WPA key to the attack which can be used to connect to the wireless network. Theoretically there are 10^8 (= 100.000.000) possible values for the WPS PIN. Unfortunately the WPS PIN consists of 8 numbers divided into 3 segments from which can be tested separately with a brute force attack. The last digit is checksum which can be calculated. The PIN has been composed as following:
- Part 1 of the pin is 5 digits = 10^4 (= 10.000) brute force attempts needed to retrieve this segment.
- Part 2 of the PIN is 3 digits = 10^3 (1.000) brute force attempts needed to retrieve this segment.
- Part 3 of the PIN is 1 digit which is a calculated checksum.
WPS is enabled by default on the TP Link Archer C5 router so we will be checking it for known WPS vulnerabilities. We’ve done several tutorials on Hacking Tutorials about exploiting WPS vulnerabilities with Reaver and Pixiewps so we won’t get into great detail on these. For detailed tutorials on these subjects have a look at <tutorial name> and <tutorial name>. Let’s fire up Kali Linux and see if we can hack the TP Link Archer C5 router by brute forcing the WPS PIN with Reaver.
Brute forcing the Archer C5 WPS PIN with reaver
First we put our Wifi adapter in monitoring mode using the following command:
Airmon-ng start wlan0
The interface for the monitoring adapter will be wlan0mon. You will most likely receive a message about process who might cause trouble, kill them using the kill command. We can use airodump-ng to locate our access point and retrieve the MAC address. Use the following command to start airodump-ng:
airodump-ng –i wlan0mon
The MAC address appears in the first column which can be copied to your clipboard.
Next we will use the following command to start Reaver:
reaver –I wlan0mon –b [router MAC address]–c [channel]–vv
The reaver attack will start testing some common PINS and will than start with 0 and work its way up to 9.999 for the first WPS PIN segment. As we already expected the TP Link router has rate limiting on the number of WPS attempts. It will lock up after a couple attempts and we need to unlock it manually. When the rate limiting occurs Reaver will throw a warning as following:
TP Link Archer C5 Pixie dust attack
Another WPS vulnerability is known as the Pixie Dust Attack. The Pixie dust attack is performed with a modified version of Reaver with a secondary tool called pixiewps. The pixie dust attack is an offline WPS attack which means that the attackers retrieves the needed data in seconds which than can be used to retrieve the wireless password. This is only applicable to routers which are vulnerable to this attack. Let’s see if the TP Link Archer C5 is vulnerable to this offline pixie dust attack.
To start the pixie dust attack using Reaver use the following command:
reaver -i wlan0mon -b [Router MAC address] -c [channel]-vvv -K 1 –f
Or use the following command to start pixiewps manually and supply the needed data yourself:
pixiewps -e [PKE] -s [EHASH1] -z [EHASH2] -a [AUTHKEY] -S
The TP Link Archer C5 router seems to be invulnerable to the pixie dust WPS attack. If a router is vulnerable than pixiewps will return the WPS PIN which can be used in Reaver to retrieve the WPA key using the following command:
reaver -i mon0 -c 1 -b [Router MAC] -vv -S –pin=[WPS PIN]
Let’s see if we run this command on the Archer C5 with the valid WPS PIN:
reaver -i mon0 -c 1 -b [Router MAC] –vv –d 0 –w –n -S –pin=98159338
With the correct PIN Reaver will return the WPA PSK.
Although the access point locks itself up after a few attempts it is possible to retrieve the WPA PSK with the correct WPS PIN and Reaver.
Reversing the default WPS PIN
The remaining question now is how does the TP Link Archer C5 generates the default WPS PIN because every time we restore the WPS PIN it resets back to the same default PIN. Some router manufacturers, like Belkin (Belkin N900) and D-Link (D-Link DIR-810L), used to calculate the default PIN from the MAC address in the past which has been discovered by reversing engineering the algorithm. Other routers have the default PIN programmed in the NVRAM at the factory. NVRAM stands for Non-volatile random-access memory which is memory that retains the stored content after the power is turned off. Of course router manufacturers do not want to lose the default WPS PIN after powering off the device.
At this moment we do not know which method is used by TP-Link for restoring the default PIN of the Archer C5 router. If somebody succeeds in finding a method to reverse the default WPS PIN from static figures like the MAC Address or serial number it would leave a lot of routers vulnerable with WPS turned on. Retrieving the wireless password would then be as simple as feeding the PIN, BSSID and channel to Reaver as we’ve demonstrated earlier in this tutorial.
Defending against attackers exploiting WPS vulnerabilities
We always recommend you to turn off WPS in the router settings to prevent attackers from exploiting WPS vulnerabilities. Even though this router is not vulnerable to any of the tested WPS attacks, new WPS vulnerabilities can arise without you knowing it. Since routers basically have a long lifecycle (often without updates) when used in homes and small offices it is even more advised to turn this useless feature off. For the Archer C5 router you can simply access the wireless menu and turn WPS off using the ‘Disable WPS’ button as pictured below.
Disable WPS in this menu
Let’s continue to see if the router has any known backdoors or vulnerabilities in the next chapter.
TP Link Archer C5 Backdoors and Vulnerabilities
A good point to start searching for known backdoors and vulnerabilities for our TP Link Archer C5 router is the National Vulnerability Database and exploit database websites. On these websites we’ve came across two vulnerabilities for the Archer C5 router with a high severity rating; CVE-2015-3035 and CVE-2015-3036. Both vulnerabilities have been fixed already by the vendor through a firmware update in 2015.
CVE-2015-3035: Directory traversal vulnerability
This directory traversal vulnerability allows the remote attacker to read arbitrary files via a .. (dot dot) in the PATH_INFO to login/. This vulnerability affects the following TP Link router products including the Archer C5 router (Hardware version 1.2) with firmware before 150317:
- TP-LINK Archer C5 (1.2) with firmware before 150317
- C7 (2.0) with firmware before 150304
- C8 (1.0) with firmware before 150316
- Archer C9 (1.0)
- TL-WDR3500 (1.0)
- TL-WDR3600 (1.0)
- TL-WDR4300 (1.0) with firmware before 150302
- TL-WR740N (5.0)
- TL-WR741ND (5.0) with firmware before 150312
- TL-WR841N (9.0)
- TL-WR841N (10.0)
- TL-WR841ND (9.0)
- TL-WR841ND (10.0) with firmware before 150310.
CVE-2015-3036: Stack-based buffer overflow in the KCodes NetUSB module
Stack-based buffer overflow in the run_init_sbus function in the KCodes NetUSB module for the Linux kernel. KCodes NetUSB is used in certain Netgear, TP-LINK, and other products and allows remote attackers to execute arbitrary code by providing a long computer name in a session on TCP port 20005. You can find more information about this vulnerability here:
How to avoid vulnerability exploits on your router
Both of the severe rated vulnerabilities show you the importance of keeping the firmware of your router up-to-date. CVE-2015-3035 and CVE-2015-3036 were fixed in 2015 for the Archer C5 with the following update: Archer C5(UN)_V2_150515. TP Link mentions the following about the update on their website:
- Fixed the security bug caused by overflowing of Kcodes buffer.
- Fixed the bug that you can access FTP Server from WAN port without password.
Brute forcing the TP Link Archer C5 default password
The default wireless password for the Archer C5 router is the default WPS PIN. The WPS PIN is an eight number figure which leaves us with 10^8 = 100.000.000 different possibilities if we would brute force the password. In the Cracking WPA with oclHashcat GPU on Windows tutorial from last year we’ve learned that an old video card like an AMD Radeon 7670M can do 20.000 attempts per second. A newer and more powerful video card like the AMD HD7970 can easily do 142.000 attempts per second. When we divide the 100 million possibilities by 142.000 it takes 705 seconds, which is less than 12 minutes, to brute force the password. Keep in mind that a newer and better performing video card could probably do it less than 10 minutes. With these figures coming from consumer grade hardware with really average processing power we’re still surprised that TP Link is using the default WPS PIN as default wireless password. If there was any good reason to do that, they could at least inform or warn the end user about changing the default wireless password to a more secure one. Last year we already did a tutorial on how brute force WPA passwords with the power of GPU’s. You can watch it here.