Have you ever wondered how IoT and other hardware manufactures debug and test their devices. Well, most of the time they leave serial interfaces that they can hook into to read real-time debugging logs or interact via a shell. There are a couple different serial interfaces, but one of the most common ones is the Universal Asynchronous Receiver-Transmitter (UART).
On this tutorial we will discuss how to connect via UART to the TP-Link WR841N (version 9.0) using the Attify Badge. This write-up is a loose follow-up on the previous 5-Min Tutorial on lifting firmware with the Bus Pirate, so you might want to check that out first (but it's not required).
* Recently revived my old Twitter account. Follow me for more hacking content! Follow @konukoii
UART
Before proceeding I wanted to go a little bit more in-depth of what UART is and how it works. Feel free to skip this part if you just wanna get to the hacking!
UART refers to Universal Asynchronous Receiver / Transmitter. It is a serial communication interface that doesn't depend on a clock (unlike other serial interfaces). It can be anywhere from simplex (one directional communication), half-duplex (devices take turns transmitting), or full-duplex (both devices can communicate at the same time). The communication itself is done via packets:
Finding the UART Ports
The UART ports on the physical device are usually found as a line of 3/4 pins or pads next to each other. In the case of the TP-Link WR841N (version 9.0) we can see them as 4 pads as shown below:
Once you find the UART ports we have to distinguish each pin (GND, VCC, TX, RX). To do this we have to follow the next steps:
- Identifying GND: Turn off device. Place your multimeter in Continuity mode (The dot with three semi circles to the side) Place the black probe on Ground Surface (Any metallic surface on the board - e.g Ethernet shield). Place the red probe on each of the four pads, when it beeps you'll know thats GND.
- Identifying VCC: Place the Multimeter on DC Voltage (V-). Place black probe on GND and use Red probe to check UART pins. Power Cycle the device, the place where you see a constant high voltage is our VCC Pin. (Hint: It'll be close to either 3.3V or 5V)
- Identifying TX: Once you know VCC and Ground, TX is the pin that hast the biggest fluctuations in voltage during the initial 10-15 seconds of boot-up. This is because a lot of information is transmitted during boot-up.
- Identifying RX: RX can be determined by the pin having the lowest voltage during the entire process. Otherwise it is the last pin remaining.
Now that we have identified all the proper ports, you can solder some connectors to it and hook it up to the Attify Badge as follows:
| TPLink | Attify Badge |
| GND | GND |
| TX | D0 |
| RX | D1 |
| VCC | - None - |
Interacting with UART
Before we actually start communicating with the UART ports we need to find the Baud Rate. The Baud Rate is the rate at which data is transferred between the devices. In other words the # of bits per second. Some common baud rates can be 9600, 38400, 19200, 57600, 115200, but theoretically it can be whatever the manufacturer wants.
We will use devttys0's python script to quickly find the proper Baud Rate.
$ git clone https://github.com/devttys0/baudrate
$ cd baudrate
After downloading the tool, we will connect our TP-Link to power and we will want to power it on and at the same time run the script.
$ sudo python baudrate.py
Afterwards you can use your up and down keys to scan through different baud rates, as if you where tuning into a radio station. Scroll until you start seeing a bunch of debugging statements. If you don't see anything, try turning power on/off, as most devices will spit out large quantities of debugging statements during bootup.
In our case, the TP-Link router is using a baud rate of 115200.
To interact with our device via UART, we can simply run:
screen /dev/ttyUSB0 115200
Boom! we have root shell access! You can now look around or modify the filesystem any way you wish!
Unexpected Surprises!
These are some interesting behaviors I witnessed during my experiments:
TP-Link Dumbing Down their Security!
Recently I did some experiments on both the TP-Link WR841N v.9 and v.20, and I found a surprising behavior. On the v.9 router when you try to access a shell via UART, you are asked for a login/password. Instead on v.20 you are given free reign on the shell!
I have no idea why TP-Link would purposely degrade the hardware security level on their own routers?!
UART + First Boot-up = No Go
So I noticed this interesting behaviour were if you hook everything up to UART and try to boot up for the first time, the router won't actually start. Instead you have to take out the TX/RX cables and once you hit the power actually reconnect. This gave me an interesting look at the very first boot-up sequence.
Here you can see interesting moments such as the creation of Dropbear rsa/dss keys:
If you are curious and want to look at all the dump feel free to download it from here: tp-link-bootup-konukoii.txt
TP-Link WR841N v.9 UART First Boot-Up log.
Captured by: KonukoII
dm_major = 253
spiflash_ioctl_read, Read from 0x007df100 length 0x6, ret 0, retlen 0x6
Read MAC from flash( 7df100) 7c-ffffff8b-ffffffca-48-60-ffffffba
GMAC1_MAC_ADRH -- : 0x00007c8b
GMAC1_MAC_ADRL -- : 0xca4860ba
Ralink APSoC Ethernet Driver Initilization. v3.1 256 rx/tx descriptors allocated, mtu = 1500!
NAPI enable, Tx Ring = 256, Rx Ring = 256
spifd from 0x007df100 length 0x6, ret 0, retlen 0x6
Read MAC from flash( 7df100) 7c-ffffff8b-ffffffca-48-60-ffffffba
GMAC1_MAC_ADRH -- : 0x00007c8b
GMAC1_MAC_ADRL -- : 0xca4860ba
PROC INIT OK!
add domain:tplinkwifi.net
add domain:tplinkap.net
add domain:tplinkrepeater.net
add domain:tplinklogin.net
tp_domain init ok
L2TP core driver, V2.0
PPPoL2TP kernel driver, V2.0
Set: phy[0].reg[0] = 3900
Set: phy[1].reg[0] = 3900
Set: phy[2].reg[0] = 3900
Set: phy[3].reg[0] = 3900
Set: phy[4].reg[0] = 3900
Set: phy[0].reg[0] = 3300
Set: phy[1].reg[0] = 3300
Set: phy[2].reg[0] = 3300
Set: phy[3].reg[0] = 3300
Set: phy[4].reg[0] = 3300
resetMiiPortV over.
starting pid 66, tty '/dev/ttyS1': '/bin/sh'
~ # [ util_execSystem ] 139: ipt_init cmd is "/var/tmp/dconf/rc.router"
[ dm_readFile ] 2061: can not open xml file /var/tmp/pc/reduced_data_model.xml!, about to open file /etc/reduced_data_model.xml
spiflash_ioctl_read, Read from 0x007c0000 length 0x10000, ret 0, retlen 0x10000
spiflash_ioctl_read, Read from 0x007c0000 length 0x10, ret 0, retlen 0x10
[ dm_loadCfg ] 2347: software version is not match, in config, version = 0
[ dm_readFile ] 2061: can not open xml file /var/tmp/pc/default_config.xml!, about to open file /etc/default_config.xml
[ parseConfigNode ] 525: Meet unrecognized object node "PhDDNSCfg", skip the node
[ parseConfigNode ] 530: Meet unrecognized parameter node "PhDDNSCfg", skip the node
[ parseConfigNode ] 525: Meet unrecognized object node "ACL", skip the node
[ parseConfigNode ] 530: Meet unrecognized parameter node "ACL", skip the node
[ parseConfigNode ] 530: Meet unrecognized parameter node "MACAddressControlEnabled", skip the node
[ parseConfigNode ] 530: Meet unrecognized parameter node "X_TP_MACAddressControlRule", skip the node
[ parseConfigNode ] 530: Meet unrecognized parameter node "Vlan", skip the node
[ parseConfigNode ] 530: Meet unrecognized parameter node "MACAddressControlEnabled", skip the node
[ parseConfigNode ] 530: Meet unrecognized parameter node "X_TP_MACAddressControlRule", skip the node
[ parseConfigNode ] 530: Meet unrecognized parameter node "Vlan", skip the node
[ parseConfigNode ] 530: Meet unrecognized parameter node "MACAddressControlEnabled", skip the node
[ parseConfigNode ] 530: Meet unrecognized parameter node "X_TP_MACAddressControlRule", skip the node
[ parseConfigNode ] 530: Meet unrecognized parameter node "Vlan", skip the node
[ parseConfigNode ] 525: Meet unrecognized object node "X_TP_QuickSave", skip the node
[ parseConfigNode ] 525: Meet unrecognized object node "X_TP_QuickSave", skip the node
[ parseConfigNode ] 525: Meet unrecognized object node "X_TP_WANUSB3gLinkConfig", skip the node
[ parseConfigNode ] 525: Meet unrecognized object node "QueueManagement", skip the node
[ parseConfigNode ] 525: Meet unrecognized object node "X_TP_IPTV", skip the node
[ parseConfigNode ] 525: Meet unrecognized object node "VoiceService", skip the node
[ parseConfigNode ] 530: Meet unrecognized parameter node "VoiceService", skip the node
[ parseConfigNode ]spiflash_ioctl_read, Read from 0x007df100 length 0x6, ret 0, retlen 0x6
525: Meet unrespiflash_ioctl_read, Read from 0x007df200 length 0x4, ret 0, retlen 0x4
cognized object spiflash_ioctl_read, Read from 0x007df300 length 0x4, ret 0, retlen 0x4
node "StorageSerspiflash_ioctl_read, Read from 0x007df400 length 0x10, ret 0, retlen 0x10
vice", skip the spiflash_ioctl_read, Read from 0x007df500 length 0x29, ret 0, retlen 0x29
node
[ parseConspiflash_ioctl_read, Read from 0x007df600 length 0x21, ret 0, retlen 0x21
figNode ] 525: spiflash_ioctl_read, Read from 0x007df700 length 0x10, ret 0, retlen 0x10
Meet _ioctl_read, Read from 0x00020000 length 0x1d0, ret 0, retlen 0x1d0
d object node "Xspiflash_ioctl_read, Read from 0x007df100 length 0x6, ret 0, retlen 0x6
_TP_SpeedDialCfg", skip the node
[ parseConfigNode ] 525: Meet unrecognized object node "X_TP_MultiIspDialPlan", skip the node
[ parseConfigNode ] 525: Meet unrecognized object node "X_TP_CallLogCfg", skip the node
[ parseConfigNode ] 530: Meet unrecognized parameter node "WEPKeyIndex", skip the node
[ parseConfigNode ] 530: Meet unrecognized parameter node "WEPKeyIndex", skip the node
[ parseConfigNode ] 530: Meet unrecognized parameter node "WEPKeyIndex", skip the node
[ parseConfigNode ] 530: Meet unrecognized parameter node "WEPKeyIndex", skip the node
[ parseConfigNode ] 530: Meet unrecognized parameter node "WEPKeyIndex", skip the node
[ parseConfigNode ] 530: Meet unrecognized parameter node "WEPKeyIndex", skip the node
[ parseConfigNode ] 530: Meet unrecognized parameter node "WEPKeyIndex", skip the node
[ parseConfigNode ] 530: Meet unrecognized parameter node "WEPKeyIndex", skip the node
===>Enter Router mode
sendto: No such file or directory
pid 65 send 2001 error
[ util_execSystem ] 139: oal_startDynDns cmd is "dyndns /var/tmp/dconf/dyndns.conf"
[ oal_sys_getOldTZInfo ] 519: Open TZ file error!
[ util_execSystem ] 139: oal_sys_unsetTZ cmd is "echo "" > /etc/TZ"
[ util_execSystem ] 139: oal_startNoipDns cmd is "noipdns /var/tmp/dconf/noipdns.conf"
[ util_execSystem ] 139: oal_startCmxDns cmd is "cmxdns /var/tmp/dconf/cmxdns.conf"
ioctl: No such device
[ util_execSystem ] 139: oal_br_addBridge cmd is "brctl addbr br0;brctl setfd br0 0;brctl stp br0 off"
[ util_execSystem ] 139: oal_ipt_addLanRules cmd is "iptables -t filter -A INPUT -i br+ -j ACCEPT
"
[ util_execSystem ] 139: oal_intf_setIntf cmd is "ifconfig br0 192.168.0.1 netmask 255.255.255.0 up"
[ util_execSystem ] 139: oal_util_setProcLanAddr cmd is "echo "br0 16820416," > /proc/net/conRaeth v3.1 (ntract_LocalAddrNAPI
"
[ util_exec,SkbRecycleSystem ] 139: o)
al_intf_enableIn
phy_tx_ring = 0x030aa000, tx_ring = 0xa30aa000
tf cmd is "ifcon
phy_rx_ring0 = 0x030ab000, rx_ring0 = 0xa30ab000
fig eth0 up"
[fe_sw_init:5185]rt305x_esw_init.
disable switch phyport...
GMAC1_MAC_ADRH -- : 0x00007c8b
GMAC1_MAC_ADRL -- : 0xca4860ba
RT305x_ESW: Link Status Changed
[ rsl_getUnusedVlan ] 1042: GET UNUSED VLAN TAG 1 : [3]
[ rsl_getUnusedVlan ] 1042: GET UNUSED VLAN TAG 2 : [4]
[ rsl_getUnusedVlan ] 1042: GET UNUSED VLAN TAG 3 : [5]
[ rsl_getUnusedVlan ] 1042: GET UNUSED VLAN TAG 4 : [6]
[ util_execSystem ] 139: oal_addVlanTagIntf cmd is "vconfig add eth0 3"
[ util_execSystem ] 139: oal_intf_enableIntf cmd is "ifconfig eth0.3 up"
set if eth0.3 to *not wan dev
[ util_execSystem ] 139: oal_addVlanTagIntf cmd is "vconfig add eth0 4"
[ util_execSystem ] 139: oal_intf_enableIntf cmd is "ifconfig eth0.4 up"
set if eth0.4 to *not wan dev
[ util_execSystem ] 139: oal_addVlanTagIntf cmd is "vconfig add eth0 5"
[ util_execSystem ] 139: oal_intf_enableIntf cmd is "ifconfig eth0.5 up"
set if eth0.5 to *not wan dev
[ util_execSystem ] 139: oal_addVlanTagIntf cmd is "vconfig add eth0 6"
[ util_execSystem ] 139: oal_intf_edevice eth0.3 entered promiscuous mode
nableIntf cmd isdevice eth0 entered promiscuous mode
"ifconfig eth0.br0: port 1(eth0.3) entering forwarding state
6 up"
set if br0: port 1(eth0.3) entering forwarding state
eth0.6 to *not wan dev
[ util_execSystem ] 139: oal_addVlanTagIntf cmd is "vcodevice eth0.4 entered promiscuous mode
nfig add eth0 2"br0: port 2(eth0.4) entering forwarding state
[ util_execSbr0: port 2(eth0.4) entering forwarding state
ystem ] 139: oal_intf_enableIntf cmd is "ifconfig eth0.2 up"
set if eth0.2 tdevice eth0.5 entere
o wan dev
[ vlabr0: port 3(eth0.5) entering forwarding state
n_addLanPortsIntbr0: port 3(eth0.5) entering forwarding state
oBridge ] 574: add lan Port 255 from br0
[ util_execSystem ] 139: oal_br_addIdevice eth0.6 entered promiscuous mode
ntfIntoBridge cmbr0: port 4(eth0.6) entering forwarding state
d is "brctl addibr0: port 4(eth0.6) entering forwarding state
f br0 eth0.3"
[ util_execSystem ] 139: oal_br_addIntfIntoBridge cmd is "brctl addif br0 eth0.4"
[ util_execSystem ] 139: oal_br_addIntfIntoBridge cmd is "brctl addif br0 eth0.5"
[ util_execSystem ] 139: oal_br_addIntfIntoBridge cmd is "brctl addif br0 e
[ util_execSystem ] 139: rsl_initIPv6CfgObj cmd is "echo 1 > /proc/sys/net/ipv6/conf/all/disable_ipv6"
[ util_execSystem ] 139: oal_eth_setIGMPSnoopParam cmd is "for i in /sys/devices/virtual/net/*/bridge/multicast_snooping;do echo 1 > $i ; done"
[ util_execSystem ] 139: oal_wlan_ra_setCountryRegion cmd is "cp /etc/SingleSKU_FCC.dat /var/Wireless/RT2860AP/SingleSKU.dat"
[ util_execSystem ] 139: oal_wlan_ra_setCountryRegion cmd is "iwpriv ra0 set CountryRegion=0"
ra0 no private ioctls.
[ util_execSystem ] 166: execute ok, exit status = 255
[ util_execSystem ] 139: oal_wlan_ra_loadDriver cmd is "insmod /lib/modules/kmdir/kernel/drivers/net/wireless/mt_wifi_ap/mt_wifi.ko"
ADDRCONF(NETDEV_CHANGE): eth0.4: link becomes ready
ADDRCONF(NETDEV_CHANGE): eth0.5: link becomes ready
ADDRCONF(NETDEV_CHANGE): eth0.6: link becomes ready
ADDRCONF(NETDEV_CHANGE): eth0.2: link becomes ready
=== pAd = c082d000, size = 1493064 ===
<-- RTMPAllocTxRxRingMemory, Status=0, ErrorValue=0x
<-- RTMPAllocAdapterBlock, Status=0
RtmpChipOpsHook(492): Not support for HIF_MT yet!
mt7628_init()-->
mt7628_init(FW(8a00), HW(8a01), CHIPID(7628))
e2.bin mt7628_init(1156)::(2), pChipCap->fw_len(64560)
mt_bcn_buf_init(218): Not support for HIF_MT yet!
<--
[ util_execSystem ] 139: oal_wlan_ra_initWlan cmd is "ifconfig ra0 up"
TX_BCN DESC a3282000 size = 320
RX[0] DESC a3284000 size = 2048
RX[1] DESC a3285000 size = 2048
RT_CfgSetApcliMacAddress : invalid mac setting
cfg_mode=9
cfg_mode=9
wmode_band_equal(): Band Equal!
AndesSendCmdMsg: Could not send in band command due to diable fRTMP_ADAPTER_MCU_SEND_IN_BAND_CMD
APSDCapable[0]=0
APSDCapable[1]=0
APSDCapable[2]=0
APSDCapable[3]=0
APSDCapable[4]=0
APSDCapable[5]=0
APSDCapable[6]=0
APSDCapable[7]=0
APSDCapable[8]=0
APSDCapable[9]=0
APSDCapable[10]=0
APSDCapable[11]=0
APSDCapable[12]=0
APSDCapable[13]=0
APSDCapable[14]=0
APSDCapable[15]=0
default ApCliAPSDCapable[0]=0
Key1Str is Invalid key length(0) or Type(0)
Key1Str is Invalid key length(0) or Type(0)
Key2Str is Invalid key length(0) or Type(0)
Key2Str is Invalid key length(0) or Type(0)
Key3Str is Invalid key length(0) or Type(0)
Key3Str is Invalid key length(0) or Type(0)
Key4Str is Invalid key length(0) or Type(0)
Key4Str is Invalid key length(0) or Type(0)
WscKeyASCII=8
WscKeyASCII=8
[RTMPReadParametersHook:297]wifi read profile faild.
load fw image from fw_header_image
AndesMTLoadFwMethod1(2263)::pChipCap->fw_len(64560)
FW Version:1
FW Build Date:20161213152835
CmdAddressLenReq:(ret = 0)
CmdFwStartReq: override = 1, address = 1048576
CmdStartDLRsp: WiFI FW Download Success
MtAsicDMASchedulerInit(): DMA Scheduler Mode=0(LMAC)
efuse_probe: efuse = 10000012
RtmpChipOpsEepromHook::e2p_type=2, inf_Type=4
RtmpEepromGetDefault::e2p_dafault=2
RtmpChipOpsEepromHook: E2P type(2), E2pAccessMode = 2, E2P default = 2
NVM is FLASH mode
1. Phy Mode = 14
exec!
spiflash_ioctl_read, Read from 0x007f0000 length 0x400, ret 0, retlen 0x400
eeFlashId = 0x7628!
Country Region from e2p = ffff
tssi_1_target_pwr_g_band = 36
2. Phy Mode = 14
3. Phy Mode = 14
NICInitPwrPinCfg(11): Not support for HIF_MT yet!
NICInitializeAsic(651): Not support rtmp_mac_sys_reset () for HIF_MT yet!
mt_mac_init()-->
MtAsicInitMac()-->
mt7628_init_mac_cr()-->
MtAsicSetMacMaxLen(1277): Set the Max RxPktLen=450!
<--mt_mac_init()
WTBL Segment 1 info:
MemBaseAddr/FID:0x28000/0
EntrySize/Cnt:32/128
WTBL Segment 2 info:
MemBaseAddr/FID:0x40000/0
EntrySize/Cnt:64/128
WTBL Segment 3 info:
MemBaseAddr/FID:0x42000/64
EntrySize/Cnt:64/128
WTBL Segment 4 info:
MemBaseAddr/FID:0x44000/128
EntrySize/Cnt:32/128
AntCfgInit(2946): Not support for HIF_MT yet!
MCS Set = ff ff 00 00 01
MtAsicSetChBusyStat(861): Not support for HIF_MT yet!
FW LOG: !!!! Pass, dont need recal (total fail[0])
FW LOG: !!!! Pass, dont need recal (total fail[0])
FW LOG: !!!! Pass, dont need recal (total fail[0])
FW LOG: RxDCOC Set DC Valid(8)(2)
CmdSlotTimeSet:(ret = 0)
[PMF]ap_pmf_init:: apidx=0, MFPC=0, MFPR=0, SHA256=0
[PMF]RTMPMakeRsnIeCap: RSNIE Capability MFPC=0, MFPR=0
[PMF]ap_pmf_init:: apidx=1, MFPC=0, MFPR=0, SHA256=0
MtAsicSetRalinkBurstMode(3048): Not support for HIF_MT yet!
MtAsicSetPiggyBack(796): Not support for HIF_MT yet!
reload DPD from flash , 0x9F = [ca00] doReload bit7[0]
CmdLoadDPDDataFromFlash: Channel = 10, DoReload = 0
MtAsicSetTxPreamble(3027): Not support for HIF_MT yet!
MtAsicAddSharedKeyEntry(1344): Not support for HIF_MT yet!
The 4-BSSID mode is enabled, the BSSID byte5 MUST be the multiple of 4
MtAsicSetPreTbtt(): bss_idx=0, PreTBTT timeout = 0xf0
ap_ftkd> Initialize FT KDP Module...
Main bssid = 7c:8b:ca:48:60:ba
<==== rt28xx_init, Status=0
@@@ ed_monitor_exit : ===>
@@@ ed_monitor_exit : <===
mt7628_set_ed_cca: TURN OFF EDCCA mac 0x10618 = 0xd7083f0f, EDCCA_Status=0
WiFi Startup Cost (ra0): 3.056s
[ util_execSystem ] 139: oal_wlan_ra_initWlan cmd is "echo 1 > /proc/tplink/led_wlan_24G"
[ util_execSystem ] 139: oal_wlan_ra_setStaNum cmd is "iwpriv ra0 set MaxStaNum=32"
[ util_execSystem ] 139: oal_br_addIntfIndevice ra0 entered promiscuous mode
toBridge cmd is br0: port 5(ra0) entering forwarding state
"brctl addif br0br0: port 5(ra0) entering forwarding state
ra0"
[ util_execSystem ] 139: oal_br_addIntfIntoBridge cmd is "brctldevice apcli0 entered promiscuous mode
addif br0 apcli0"
[ util_execSystem ] 139: oal_br_addIntfIntoBridge cmd is "brctl addif br0 apcli0"
brctl: bridge br0: Device or resource busy
[ util_edevice ra1 entered promiscuous mode
xecSystem ] 166: execute ok, exit status = 1
[ util_execSystem ] 139: oal_bspiflash_ioctl_read, Read from 0x007f0000 length 0x2, ret 0, retlen 0x2
r_addIntfIntoBridge cmd is "brctl addif br0 ra1"
[ util_execSystem ] 139: oal_wlan_ra_initEnd cmd is "wlNetlinkTool &"
[ util_execSystem ] 139: oal_wlan_ra_initEnd cmd is "killall -q wscd"
[ util_execSystem ] 166: execute ok, exit status = 1
[ util_execSystem ] 139: oal_wlan_ra_initEnd cmd is "wscd -i ra0 -m 1 -w /var/tmp/wsc_upnp/ &"
[ util_execSystem ] 139: rsl_initLanWlanObj cmd is "echo 0 > /proc/tplink/wl_mode"
WLAN-Start wlNetlinkTool
Waiting for Wireless Events from interfaces...
swWlanChkAhbErr: netlink to do
[ oal_wlan_ra_loadDriver ] 2032: no 5G chip.
[ rsl_initLanWlanObj ] 9093: perror:1
wscd: SSDP UDP PORT = 1900
sendto: No such file or directory
pid 65 send 2030 error
sendto: No such file or directory
pid 65 send 2004 error
[ util_execSystem ] 139: oal_startDhcps cmd is "dhcpd /var/tmp/dconf/udhcpd.conf"
[ util_execSystem ] 139: oal_lan6_startDhcp6s cmd is "dhcp6s -c /var/tmp/dconf/dhcp6s_br0.conf -P /var/run/dhcp6s_br0.pid br0 &"
[ util_execSystem ] 139: oal_lan6_startRadvd cmd is "radvd -C /var/tmp/dconf/radvd_br0.conf -p /var/run/radvd_br0.pid &"
[ util_execSystem ] 139: oal_startSnmp cmd is "snmpd -f /var/tmp/dconf/snmpd.conf"
mldProxy# file: src/mld_ifinfo.c;line: 102; error = No such file or directory
mldProxy# Err: get LLA failed
iptables: Bad rule (does a matching rule exist in that chain?).
radvd starting
[Jan 01 00:00:07] radvd: no linklocal address configured for br0
[Jan 01 00:00:07] radvd: error parsing or activating the config file: /var/tmp/dconf/radvd_br0.conf
[ util_execSystem ] 139: oal_br_delIntfFromBridge cmd is "brctl delif br0 eth0.2"
brctl: bridge br0: Invalid argument
[ util_execSystem ] 166: execute ok, exit status = 1
[ util_execSystem ] 139: oal_intf_setIfMac cmd is "ifconfig eth0.2 down"
[ util_execSystem ] 139: oal_intf_setIfMac cmd is "ifconfig eth0.2 hw ether 7C:8B:CA:48:60:BB up"
[ util_execSystem ] 139: oal_intf_enableIntf cmd is "ifconfig eth0.2 up"
[ rsl_initAppObj ] 743: ==> start dhcp client
[ util_execSystem ] 139: oal_ipt_fwDdos cmd is "iptables -D FORWARD -j FIREWALL_DDOS
"
iptables: No chain/target/match by that name.
[ util_execSystem ] 166: execute ok, exit status = 1
[ util_execSystem ] 139: oal_ipt_forbidLanPing cmd is "iptables -t filter -D INPUT -i br+ -p icmp --icmp-type echo-request -j DROP
iptables -t filter -D FORWARD -i br+ -p icmp --icmp-type echo-request -j DROP
"
iptables: Bad rule (does a matching rule exist in that chain?).
iptables: Bad rule (does a matching rule exist in that chain?).
[ util_execSyok, exit status = 1
[ util_execSystem ] 139: oal_ddos_delPingRule cmd is "iptables -t filter -D INPUT ! -i br+ -p icmp --icmp-type echo-request -j ACCEPT
"
iptables: Bad rule (does a matching rule exist in that chain?).
[ util_execSystem ] 166: execute ok, exit status = 1
[ util_execSystem ] 139: oal_ipt_setDDoSRules cmd is "iptables -F FIREWALL_DDOS"
[ util_execSystem ] 139: ddos_clearAll cmd is "rm -f /var/tmp/dosHost"
[ util_execSystem ] 139: oal_initFirewallObj cmd is "ebtables -N FIREWALL"
[ util_execSystem ] 139: oal_initIp6FirewallObj cmd is "ip6tables -F"
[ util_execSystem ] 139: oal_initIp6FirewallObj cmd is "ip6tables -X"
[ util_execSystem ] 139: oal_initIp6FirewallObj cmd is "ip6tables -P INPUT ACCEPT"
[ util_execSystem ] 139: oal_initIp6FirewallObj cmd is "ip6tables -P FORWARD DROP"
[ util_execSystem ] 139: oal_initIp6FirewallObj cmd is "ip6tables -P OUTPUT ACCEPT"
[ util_execSystem ] 139: oal_initIp6FirewallObj cmd is "ip6tables -N FIREWALL"
[ util_execSystem ] 139: oal_initIp6FirewallObj cmd is "ip6tables -N FWRULE"
[ util_execSystem ] 139: oal_initIp6FirewallObj cmd is "ip6tables -N SETMSS"
[ util_execSystem ] 139: oal_initIp6FirewallObj cmd is "ip6tables -A INPUT -i lo -p ALL -j ACCEPT -m comment --comment "loop back""
[ util_execSystem ] 139: oal_initIp6FirewallObj cmd is "ip6tables -A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT"
[ util_execSystem ] 139: oal_initIp6FirewallObj cmd is "ip6tables -A INPUT -i br+ -p tcp --dport 23 -j ACCEPT"
[ util_execSystem ] 139: oal_initIp6FirewallObj cmd is "ip6tables -A INPUT -p tcp --dport 23 -j DROP"
[ util_execSystem ] 139: oal_initIp6FirewallObj cmd is "ip6tables -A INPUT -i br+ -p icmpv6 --icmpv6-type echo-request -j ACCEPT"
[ util_execSystem ] 139: oal_initIp6FirewallObj cmd is "ip6tables -A INPUT -p icmpv6 --icmpv6-type echo-request -j DROP"
[ util_execSystem ] 139: oal_initIp6FirewallObj cmd is "ip6tables -A FORWARD -i br+ -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT"
[ util_execSystem ] 139: oal_initIp6FirewallObj cmd is "ip6tables -A FORWARD -o br+ -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT"
[ util_execSystem ] 139: oal_initIp6FirewallObj cmd is "ip6tables -A FORWARD -j FIREWALL"
[ util_execSystem ] 139: oal_initIp6FirewallObj cmd is "ip6tables -I FORWARD 1 -j SETMSS"
[ util_execSystem ] 139: oal_fw6_setFwEnabeld cmd is "ip6tables -D FIREWALL -j ACCEPT"
ip6tables: Bad rule (does a matching rule exist in that chain?).
[ util_execSystem ] 166: execute ok, exit status = 1
[ util_execSystem ] 139: oal_fw6_setFwEnabeld cmd is "ip6tables -F FIREWALL"
[ util_execSystem ] 139: oal_fw6_setFwEnabeld cmd is "ip6tables -A FIREWALL -j ACCEPT"
[ util_execSystem ] 139: setupModules cmd is "insmod /lib/modules/kmdfilter/nf_conntrack_ftp.ko"
[ util_execSystem ] 139: setupModules cmd is "insmod /lib/modules/kmdir/kernel/net/ipv4/netfilter/nf_nat_ftp.ko"
[ util_execSystem ] 139: oal_openAlg cmd is "iptables -D FORWARD_VPN_PASSTHROUGH -p udp --dport 500 -j DROP"
iptables: Bad rule (does a matching rule exist in that chain?).
[ util_execSystem ] 166: execute ok, exit status = 1
[ util_execSystem ] 139: setupModules cmd is "insmod /lib/modules/kmdir/kernel/net/ipv4/netfilter/nf_nat_proto_gre.ko"
[ util_execSystem ] 139: setupModules cmd is "insmod /lib/modules/kmdir/kernel/net/ipv4/netfilter/nf_nat_pptp.ko"
[ util_execSystem ] 139: oal_openAlg cmd is "iptables -D FORWARD_VPN_PASSTHROUGH -p tcp --dport 1723 -j DROP"
iptables: Bad rule (does a matching rule exist in that chain?).
[ util_execSystem ] 166: execute ok, exit status = 1
[ util_execSystem ] 139: oal_openAlg cmd is "iptables -D FORWARD_VPN_PASSTHROUGH -p udp --dport 1701 -j DROP"
iptables: Bad rule (does a matching rule exist in that chain?).
[ util_execSystem ] 166: execute ok, exit status = 1
[ util_execSystem ] 139: setupModules cmd is "insmod /lib/modules/kmdir/kernel/net/netfilter/nf_conntrack_tftp.ko"
[ util_execSystem ] 139: setupModules cmd is "insmod /lib/modules/kmdir/kernel/net/ipv4/netfilter/nf_nat_tftp.ko"
[ util_execSystem ] 139: setupModules cmd is "insmod /lib/modules/kmdir/kernel/net/netfilter/nf_conntrack_h323.ko"
[ util_execSystem ] 139: setupModules cmd is "insmod /lib/modules/kmdir/kernel/net/ipv4/netfilter/nf_nat_h323.ko"
[ util_execSystem ] 139: setupModules cmd is "insmod /lib/modules/kmdir/kernel/net/netfilter/nf_conntrack_sip.ko"
[ util_execSystem ] 139: setupModules cmd is "insmod /lib/modules/kmdir/kernel/net/ipv4/netfilter/nf_nat_sip.ko"
[ util_execSystem ] 139: setupModules cmd is "insmod /lib/modules/kmdir/kernel/net/netfilter/nf_conntrack_rtsp.ko"
[ util_execSystem ] 139: setupModules cmd is "insmod /lib/modules/kmdir/kernel/net/ipv4/netfilter/nf_nat_rtsp.ko"
nf_nat_rtsp v0.6.21 loading
enable switch phyport...
Set: phy[0].reg[0] = 3900
Set: phy[1].reg[0] = 3900
[cmd_dutInit():878] init shm
[tddp_taskEntry():151] tddp task start
Set: phy[2].reg[0] = 3900
Set: phy[3].reg[0] = 3900
Set: phy[4].reg[0] = 3900
Set: phy[0].reg[0] = 3300
Set: phy[1].reg[0] = 3300
Set: phy[2].reg[0] = 3300
Set: phy[3].reg[0] = 3300
Set: phy[4].reg[0] = 3300
resetMiiPortV over.
[ util_execSystem ] 139: oal_sys_unsetTZ cmd is "echo "" > /etc/TZ"
[ util_execSystem ] 139: prepareDropbear cmd is "dropbearkey -t rsa -f /var/tmp/dropbear/dropbear_rsa_host_key"
Will output 1024 bit rsa secret key to '/var/tmp/dropbear/dropbear_rsa_host_key'
Generating key, this may take a while...
[ util_execSystem ] 139: prepareDropbear cmd is "dropbearkey -t dss -f /var/tmp/dropbear/dropbear_dss_host_key"
Will output 1024 bit dss secret key to '/var/tmp/dropbear/dropbear_dss_host_key'
Generating key, this may take a while...
[ util_execSystem ] 139: prepareDropbear cmd is "dropbear -p 22 -r /var/tmp/dropbear/dropbear_rsa_host_key -d /var/tmp/dropbear/dropbear_dss_host_key -A /var/tmp/dropbear/dropbearpwd"
[ util_execSystem ] 139: oal_sys_unsetTZ cmd is "echo "" > /etc/TZ"
[ util_execSystem ] 139: oal_sys_unsetTZ cmd is "echo "" > /etc/TZ"
l lib l
web e
help
I am uncertain why this happens, or how they even check if something is hooked up to UART. If anyone has any ideas please let me know; I really would love to know!
Further Research
My main goal now is to create backdoors in these routers either by creating malicious firmware or modifying certain files via UART. I'll also continue investigating what other changes have happened between the two router versions, but for now I hope this has been an interesting read and, as always, feel free to hit me up with any question or comments. Keep on Hacking!