I have 3 M9 plus devices and I have ordered a serial connector and plan to open one up and try my hand at capturing OEM boot logs. if anyone else here also has devices and have tried similar things or have stuff working then please do share!
Good timing. Thank's to naf's excellent work on Deco exploits I just yesterday tested his M9 Plus version and got root. I also have some pictures of the board and have dumped the SPI flash.
How interesting is it to see if the bootloader is exploitable same as nvrammanager? I've compared the update code between them and it's wildly different. In the compareable function to where fw-type and md5 is checked in nvrammanager both of those are missing in the bootloader. Have they been similar in the other product fw:s you've looked at?
edit: That sounded as if I was done decompiling - I'm not. There could still be some checks, but if so not with reused codebase.
For OpenWRT purposes I think the "user mode" exploit is easy enough to use though.
all deco devices are a little different. some devices used to have the matching buggy/exploitable signature check in both bootloader and usermode (then fixed it in usermode only in later revisions of fw updates), some (porobably more recent) devices have the fix in bootloader as well, some dont check signatures at all, S4V2 additionally supports a completely different (unsigned) format, some have no validity check at all, some have tftp, etc.
if your v1 BL is like the v2, signature check is there but without the buggy fw-type check. easy to find if you look for uses of the public key "BgIAAACkAA". then again it could just be a "we dont do a check" device.
ya enough hacking, one of yall needs to get an openwrt image going
Signature checking is there, it's the md5 ("md5 verify error!") and fw-type (so no sscanf) code that's missing in the bootloader compared to nvrammanager. Otherwise the code is similar enough to easily follow along in both.
I also looked at replicating the popen port forward access exploit named in the paper. However, unless you already have an exploit to get the private key to be able to connect to dropbear at port 20001 the initial step of brute forcing it makes it not worth it compared to downgrading to a usermode exploitable firmware.
You need at least three pins. They're usually in a bank of four as they also have VCC. UART is push pull and they'll probably be "high".
Other than hooking up rx pin and ground of your ttl uart (ensuring your uart doesn't have a high pullup or high burden current with an LED or something...) or going around with a logic analyser looking for test points and pads I can't help you.
You can help with high resolution PCB pictures of front and back. With the cans off if that's not destructive operation and it covers the CPU.
(m4v3 target)
and tried to load the .itb file via tftpboot from uboot and I am stuck at this. It does not go any further. I have waited 10 minutes.
Anybody knows what's going on ?
(IPQ40xx) # setenv serverip 192.168.0.2
(IPQ40xx) # setenv ipaddr 192.168.0.1
(IPQ40xx) # tftpboot 0x82000000 openwrt-ipq40xx-generic-tp-link_deco-m4r-v3-initramfs-uImage.itb
eth0 PHY0 Down Speed :10 Half duplex
eth0 PHY1 Down Speed :10 Half duplex
eth0 PHY2 Down Speed :10 Half duplex
eth0 PHY3 Down Speed :10 Half duplex
eth0 PHY4 up Speed :1000 Full duplex
Using eth0 device
TFTP from server 192.168.0.2; our IP address is 192.168.0.1
Filename 'openwrt-ipq40xx-generic-tp-link_deco-m4r-v3-initramfs-uImage.itb'.
Load address: 0x82000000
Loading: *#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
############################
done
Bytes transferred = 8993692 (893b9c hex)
(IPQ40xx) # bootm 0x82000000
## Booting kernel from FIT Image at 82000000 ...
Using 'config@1' configuration
Trying 'kernel@1' kernel subimage
Description: ARM OpenWrt Linux-5.15.167
Type: Kernel Image
Compression: gzip compressed
Data Start: 0x820000e4
Data Size: 8973348 Bytes = 8.6 MiB
Architecture: ARM
OS: Linux
Load Address: 0x80208000
Entry Point: 0x80208000
Hash algo: crc32
Hash value: 47d22440
Hash algo: sha1
Hash value: f9557b60f4c5ee90b6f3e489484c02b7a0b1607a
Verifying Hash Integrity ... crc32+ sha1+ OK
## Flattened Device Tree from FIT Image at 82000000
Using 'config@1' configuration
Trying 'fdt@1' FDT blob subimage
Description: ARM OpenWrt tp-link_deco-m4r-v3 device tree blob
Type: Flat Device Tree
Compression: uncompressed
Data Start: 0x8288ee48
Data Size: 18448 Bytes = 18 KiB
Architecture: ARM
Hash algo: crc32
Hash value: 1f0b149a
Hash algo: sha1
Hash value: e3216a6a5ff745e3e2511c0efb2fa21ae0696804
Verifying Hash Integrity ... crc32+ sha1+ OK
Booting using the fdt blob at 0x8288ee48
Uncompressing Kernel Image ... OK
Loading Device Tree to 862a8000, end 862af80f ... OK
Device nand2 not found!
eth0 MAC Address from ART is not valid
eth1 MAC Address from ART is not valid
Using machid 0x8010006 from environment
Starting kernel ...
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 5.15.167 (nitin@kali1) (arm-openwrt-linux-muslgnueabi-gcc (OpenWrt GCC 12.3.0 r24130-c66dd32246) 12.3.0, GNU ld (GNU Binutils) 2.40.0) #0 SMP Fri Nov 29 14:16:49 2024
[ 0.000000] CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=10c5387d
[ 0.000000] CPU: div instructions available: patching division code
[ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[ 0.000000] OF: fdt: Machine model: TP-Link Deco M4R v3
[ 0.000000] Memory policy: Data cache writealloc
[ 0.000000] Zone ranges:
[ 0.000000] Normal [mem 0x0000000080000000-0x000000009fffffff]
[ 0.000000] HighMem empty
[ 0.000000] Movable zone start for each node
[ 0.000000] Early memory node ranges
[ 0.000000] node 0: [mem 0x0000000080000000-0x0000000087dfffff]
[ 0.000000] node 0: [mem 0x0000000087e00000-0x0000000087ffffff]
[ 0.000000] node 0: [mem 0x0000000088000000-0x000000009fffffff]
[ 0.000000] Initmem setup node 0 [mem 0x0000000080000000-0x000000009fffffff]
[ 0.000000] percpu: Embedded 12 pages/cpu s19340 r8192 d21620 u49152
[ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 129920
[ 0.000000] Kernel command line:
[ 0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes, linear)
[ 0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes, linear)
[ 0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[ 0.000000] Memory: 494576K/524288K available (6544K kernel code, 608K rwdata, 1672K rodata, 12288K init, 239K bss, 29712K reserved, 0K cma-reserved, 0K highmem)
[ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[ 0.000000] rcu: Hierarchical RCU implementation.
[ 0.000000] Tracing variant of Tasks RCU enabled.
[ 0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies.
[ 0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[ 0.000000] arch_timer: cp15 timer(s) running at 48.00MHz (virt).
[ 0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0xb11fd3bfb, max_idle_ns: 440795203732 ns
[ 0.000001] sched_clock: 56 bits at 48MHz, resolution 20ns, wraps every 4398046511096ns
[ 0.000024] Switching to timer-based delay loop, resolution 20ns
[ 0.000319] Calibrating delay loop (skipped), value calculated using timer frequency.. 96.00 BogoMIPS (lpj=480000)
[ 0.000347] CPU: Testing write buffer coherency: ok
[ 0.000405] pid_max: default: 32768 minimum: 301
[ 0.001246] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[ 0.001277] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[ 0.003247] qcom_scm: convention: smc legacy
[ 0.004439] Setting up static identity map for 0x80300000 - 0x8030003c
[ 0.004618] rcu: Hierarchical SRCU implementation.
[ 0.005211] smp: Bringing up secondary CPUs ...
[ 0.008698] smp: Brought up 1 node, 4 CPUs
[ 0.008734] SMP: Total of 4 processors activated (384.00 BogoMIPS).
[ 0.008751] CPU: All CPU(s) started in SVC mode.
[ 0.015131] VFP support v0.3: implementor 41 architecture 2 part 30 variant 7 rev 5
[ 0.015292] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[ 0.015329] futex hash table entries: 1024 (order: 4, 65536 bytes, linear)
[ 0.015698] pinctrl core: initialized pinctrl subsystem
[ 0.017743] NET: Registered PF_NETLINK/PF_ROUTE protocol family
[ 0.018062] DMA: preallocated 256 KiB pool for atomic coherent allocations
[ 0.019378] thermal_sys: Registered thermal governor 'step_wise'
[ 0.019816] cpuidle: using governor ladder
[ 0.019878] cpuidle: using governor menu
[ 0.045507] cryptd: max_cpu_qlen set to 1000
[ 0.050220] usbcore: registered new interface driver usbfs
[ 0.050302] usbcore: registered new interface driver hub
[ 0.050367] usbcore: registered new device driver usb
[ 0.050457] pps_core: LinuxPPS API ver. 1 registered
[ 0.050471] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[ 0.050503] PTP clock support registered
[ 0.052673] clocksource: Switched to clocksource arch_sys_counter
[ 0.053889] NET: Registered PF_INET protocol family
[ 0.054125] IP idents hash table entries: 8192 (order: 4, 65536 bytes, linear)
[ 0.055297] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 4096 bytes, linear)
[ 0.055342] Table-perturb hash table entries: 65536 (order: 6, 262144 bytes, linear)
[ 0.055365] TCP established hash table entries: 4096 (order: 2, 16384 bytes, linear)
[ 0.055430] TCP bind hash table entries: 4096 (order: 3, 32768 bytes, linear)
[ 0.055525] TCP: Hash tables configured (established 4096 bind 4096)
[ 0.055663] UDP hash table entries: 256 (order: 1, 8192 bytes, linear)
[ 0.055709] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes, linear)
[ 0.056053] NET: Registered PF_UNIX/PF_LOCAL protocol family
[ 0.056109] PCI: CLS 0 bytes, default 64
[ 0.064751] workingset: timestamp_bits=14 max_order=17 bucket_order=3
[ 0.070667] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[ 0.070708] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[ 0.207942] bam-dma-engine 8e04000.dma: num-channels unspecified in dt
[ 0.207976] bam-dma-engine 8e04000.dma: num-ees unspecified in dt
[ 0.208708] tcsr 194b000.tcsr: setting usb hs phy mode select = e700e7
[ 0.208855] tcsr 1953000.ess_tcsr: setting ess interface select = 0
[ 0.208953] tcsr 1949000.tcsr: setting wifi_glb_cfg = 41000000
[ 0.209046] tcsr 1957000.tcsr: setting wifi_noc_memtype_m0_m2 = 2222222
[ 0.209404] Serial: 8250/16550 driver, 2 ports, IRQ sharing disabled
[ 0.210067] msm_serial 78af000.serial: msm_serial: detected port #0
[ 0.210120] msm_serial 78af000.serial: uartclk = 1843200
[ 0.210173] 78af000.serial: ttyMSM0 at MMIO 0x78af000 (irq = 34, base_baud = 115200) is a MSM
[ 0.210210] msm_serial: console setup on port #0
[ 0.747571] printk: console [ttyMSM0] enabled
[ 0.752796] msm_serial 78b0000.serial: msm_serial: detected port #1
[ 0.756518] msm_serial 78b0000.serial: uartclk = 1843200
[ 0.762606] 78b0000.serial: ttyMSM1 at MMIO 0x78b0000 (irq = 35, base_baud = 115200) is a MSM
[ 0.768560] msm_serial: driver initialized
[ 0.782776] loop: module loaded
[ 0.783873] spi_qup 78b5000.spi: IN:block:16, fifo:64, OUT:block:16, fifo:64
[ 0.785750] spi-nor spi0.0: unrecognized JEDEC id bytes: ff ff ff ff ff ff
[ 0.792033] spi-nor: probe of spi0.0 failed with error -2
[ 0.880153] i2c_dev: i2c /dev entries driver
[ 0.880419] i2c_qup 78b7000.i2c: using default clock-frequency 100000
[ 0.886283] sdhci: Secure Digital Host Controller Interface driver
[ 0.889840] sdhci: Copyright(c) Pierre Ossman
[ 0.895936] sdhci-pltfm: SDHCI platform and OF driver helper
[ 0.904294] NET: Registered PF_INET6 protocol family
[ 0.907737] Segment Routing with IPv6
[ 0.911083] In-situ OAM (IOAM) with IPv6
[ 0.914717] NET: Registered PF_PACKET protocol family
[ 0.918896] 8021q: 802.1Q VLAN Support v1.8
[ 0.923587] Registering SWP/SWPB emulation handler
[ 0.949ò[ 0.972187] Freeing unused kernel image (initmem) memory: 12288K
[ 0.972494] Run /init as init process
[ 1.328695] init: Console is alive
[ 1.329078] init: - watchdog -
[ 1.340851] kmodloader: loading kernel modules from /etc/modules-boot.d/*
[ 1.572119] xhci-hcd xhci-hcd.0.auto: xHCI Host Controller
[ 1.572204] xhci-hcd xhci-hcd.0.auto: new USB bus registered, assigned bus number 1
[ 1.576849] xhci-hcd xhci-hcd.0.auto: hcc params 0x0228f665 hci version 0x100 quirks 0x0000008002010010
[ 1.584167] xhci-hcd xhci-hcd.0.auto: irq 71, io mem 0x08a00000
[ 1.593699] xhci-hcd xhci-hcd.0.auto: xHCI Host Controller
[ 1.599394] xhci-hcd xhci-hcd.0.auto: new USB bus registered, assigned bus number 2
[ 1.604940] xhci-hcd xhci-hcd.0.auto: Host supports USB 3.0 SuperSpeed
[ 1.613241] hub 1-0:1.0: USB hub found
[ 1.619104] hub 1-0:1.0: 1 port detected
[ 1.628386] usb usb2: We don't know the algorithms for LPM for this host, disabling LPM.
[ 1.629051] hub 2-0:1.0: USB hub found
[ 1.635653] hub 2-0:1.0: 1 port detected
[ 1.639655] xhci-hcd xhci-hcd.1.auto: xHCI Host Controller
[ 1.643250] xhci-hcd xhci-hcd.1.auto: new USB bus registered, assigned bus number 3
[ 1.648708] xhci-hcd xhci-hcd.1.auto: hcc params 0x0220f665 hci version 0x100 quirks 0x0000008002010010
[ 1.656130] xhci-hcd xhci-hcd.1.auto: irq 72, io mem 0x06000000
[ 1.665655] xhci-hcd xhci-hcd.1.auto: xHCI Host Controller
[ 1.671352] xhci-hcd xhci-hcd.1.auto: new USB bus registered, assigned bus number 4
[ 1.676902] xhci-hcd xhci-hcd.1.auto: Host supports USB 3.0 SuperSpeed
[ 1.685222] hub 3-0:1.0: USB hub found
[ 1.691093] hub 3-0:1.0: 1 port detected
[ 1.695225] usb usb4: We don't know the algorithms for LPM for this host, disabling LPM.
[ 1.699419] hub 4-0:1.0: USB hub found
[ 1.708097] hub 4-0:1.0: config failed, hub doesn't have any ports! (err -19)
[ 1.713106] kmodloader: done loading kernel modules from /etc/modules-boot.d/*
[ 1.725287] init: - preinit -
get_mac_binary: file /dev/mtd10 not found!
ip: SIOCGIFINDEX: No such device
/etc/preinit: line 229: arithmetic syntax error
ip: SIOCGIFINDEX: No such device
[ 2.086737] random: jshn: uninitialized urandom read (4 bytes read)
[ 2.132627] random: jshn: uninitialized urandom read (4 bytes read)
[ 2.165805] random: jshn: uninitialized urandom read (4 bytes read)
Press the [f] key and hit [enter] to enter failsafe mode
Press the [1], [2], [3] or [4] key and hit [enter] to select the debug level
[ 4.613869] procd: - early -
[ 4.614085] procd: - watchdog -
[ 5.149260] procd: - watchdog -
[ 5.149930] procd: - ubus -
[ 5.157646] random: ubusd: uninitialized urandom read (4 bytes read)
[ 5.201864] random: ubusd: uninitialized urandom read (4 bytes read)
[ 5.202263] random: ubusd: uninitialized urandom read (4 bytes read)
[ 5.210122] procd: - init -
Please press Enter to activate this console.
[ 5.517754] kmodloader: loading kernel modules from /etc/modules.d/*
[ 5.527686] Loading modules backported from Linux version v6.1.110-0-g5f55cad62cc9d
[ 5.527739] Backport generated by backports.git v6.1.110-1-0-g965f73fc
[ 5.632303] PPP generic driver version 2.4.2
[ 5.633603] NET: Registered PF_PPPOX protocol family
[ 6.333853] urngd: v1.0.2 started.
[ 6.463403] ath10k_ahb a000000.wifi: qca4019 hw1.0 target 0x01000000 chip_id 0x003b00ff sub 0000:0000
[ 6.463478] ath10k_ahb a000000.wifi: kconfig debug 0 debugfs 1 tracing 0 dfs 1 testmode 0
[ 6.475466] ath10k_ahb a000000.wifi: firmware ver 10.4b-ct-4019-fW-13-5ae337bb1 api 5 features mfp,peer-flow-ctrl,txstatus-noack,wmi-10.x-CT,ratemask-CT,regdump-CT,txrate-CT,flush-all-CT,pingpong-CT,ch-regs-CT,nop-CT,set-special-CT,tx-rc-CT,cust-stats-CT,txrate2-CT,beacon-cb-CT,wmi-block-ack-CT,wmi-bcn-rc-CT crc32 6b2b5c5b
[ 6.503714] ath10k_ahb a000000.wifi: Loading BDF type 0
[ 6.512956] ath10k_ahb a000000.wifi: failed to fetch board data for bus=ahb,vendor=0000,device=0000,subsystem-vendor=0000,subsystem-device=0000,variant=TP-Link_Deco_M4 from ath10k/QCA4019/hw1.0/board-2.bin
[ 6.690035] ath10k_ahb a000000.wifi: failed to fetch board-2.bin or board.bin from ath10k/QCA4019/hw1.0
[ 6.690098] ath10k_ahb a000000.wifi: failed to fetch board file: -12
[ 6.698451] ath10k_ahb a000000.wifi: could not probe fw (-12)
[ 6.869491] random: crng init done
[ 6.869538] random: 30 urandom warning(s) missed due to ratelimiting
[ 7.516189] ath10k_ahb a800000.wifi: qca4019 hw1.0 target 0x01000000 chip_id 0x003b00ff sub 0000:0000
[ 7.516257] ath10k_ahb a800000.wifi: kconfig debug 0 debugfs 1 tracing 0 dfs 1 testmode 0
[ 7.528421] ath10k_ahb a800000.wifi: firmware ver 10.4b-ct-4019-fW-13-5ae337bb1 api 5 features mfp,peer-flow-ctrl,txstatus-noack,wmi-10.x-CT,ratemask-CT,regdump-CT,txrate-CT,flush-all-CT,pingpong-CT,ch-regs-CT,nop-CT,set-special-CT,tx-rc-CT,cust-stats-CT,txrate2-CT,beacon-cb-CT,wmi-block-ack-CT,wmi-bcn-rc-CT crc32 6b2b5c5b
[ 7.556512] ath10k_ahb a800000.wifi: Loading BDF type 0
[ 7.565686] ath10k_ahb a800000.wifi: failed to fetch board data for bus=ahb,vendor=0000,device=0000,subsystem-vendor=0000,subsystem-device=0000,variant=TP-Link_Deco_M4 from ath10k/QCA4019/hw1.0/board-2.bin
[ 7.742021] ath10k_ahb a800000.wifi: failed to fetch board-2.bin or board.bin from ath10k/QCA4019/hw1.0
[ 7.742101] ath10k_ahb a800000.wifi: failed to fetch board file: -12
[ 7.750547] ath10k_ahb a800000.wifi: could not probe fw (-12)
[ 7.764672] kmodloader: done loading kernel modules from /etc/modules.d/*
ill take the low hanging fruit:
i would think that you (and @caeklol) should change all instances of get_mac_binary "/dev/mtd10" to something more like mtd_get_mac_binary "0:ART"
hopefully someone smarter will come along and remind us all how to determine what needs to get in your dts to fix your network cards not getting picked up and the device hanging...