-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
QSW-2104-2T #1
Comments
The first step will be to create a dump of the flash chip. I did that using a CH341A + SOIC clip and would recommend the same for you. That way you can always go back to stock no matter what happens. If you don’t mind uploading that dump here we can keep them here in the same place for others to find and see how the firmware differs. The way I modified it is by going through it in Ghidra, which was somewhat painful. Knowing what we’re looking for will likely make things easier the second time around. I’d be happy to lend a hand. |
Yeah for sure, I ordered a CH341A which should arrive in the next day or two. I've messed around with Ghidra a bit before but it's been a while. Here is a couple of images of the board for the switch. One thing i wouldn't mind attempting to do is making switch configuration a bit more accessible. Either through an external application utilizing the webapi or if there is a route forward with additional firmware modification. |
But as for going though the dump with Ghidra i'm certainly down to give it a shot. I've poked around with Ghidra before but never got super deep into it. |
I've started experimenting with your flash image for now I've found this which has some helpful tips but I'm going to assume a lot of the memory mapping addresses required are going to be different going based on the info you have in the readme. |
Also looking over your flash.bin so far: I believe the actual bootloader start bytes are: F8 FF 00 20 and there seems to always be AA AA AA AA bytes at the end Which lines up very nicely with what is already known from the output of the bootloader. bootloader: image 1: image 2: Then there also appears to be a few FAT file system images in the flash.bin as well. |
Yeah so my interpretation is that there are 3 "images", two bootable and a third one that contains a FAT12 (?) filesystem. It's been a little while since I looked at it but it took a healthy amount of digging around. I didn't dig too much into the filesystem but you could definitely amend the admin page; you can also do that during runtime by saving new content there without having to re-flash, which might help with iteration. How to find the memory location to disable the login timer: If you extract an image of your choice (say 0x60000) and in Ghidra use 0x10010000 as start position then that should get you going (load it as ARM Cortex 32 Thumb little endian). Make sure that memory isn't marked as writeable, so that Ghidra can simplify some of the decompiled code for you. Searching for strings has proven to be useful to get your bearings as several will include function names for (inactive) debug logging. To keep the management API active for longer, I searched for the string I saw on UART: I didn't find any other location where this was written to, so then went spelunking for some init routine. After a bunch of searching I found a function at 0x100102c8 that seems to be initializing memory between 0x20800000 and 0x208033d8 with data starting at 0x102f7d7c. Once you add this mapping to the memory map (byte map 1:1 from 0x102f7d7c to 0x20800000, length 0x33d8) you'll see a value show up at the memory location we saved before and can make that significantly larger, like 10 years. I think it's a 32 bit value of seconds so there's plenty of room. You could in theory also modify it to not decrement but I found that to be more invasive and brittle. It might also conceivably have some side-effects where something else could be driven by that timer and so making the timeout extremely long seemed like the easiest way forward |
Alright i've dumped the flash and made a pull request for that to be included in the repo |
Also finally got in my ttl serial adapter, so here is the bootup log just for reference:
And when interrupting boot:
|
And the images available:
|
Sorry I was traveling and didn't have time to investigate this. Thanks for the flash dump. |
Which through all of this i think there is certainly enough code out there that if someone wanted to spend the time on it, they could probably put together a totally custom bootloader and firmware. Most of the core code is there and seems identical in the final firmware. I also did find a datasheet publicly that has been somewhat useful for the similar series of chips that the firmware code was originally written for: Comparing it with the unmanaged version of the chip that was found on the other thread they are very similar in most of the key areas so the stuff missing from this datasheet can mostly be pulled from the one above: |
Building from source would obviously be great! |
Interesting, looking quickly at that firmware there's not really any shared strings that i can find between this and our switch firmware. So if they are similar it's heavily customized. I would actually be more curious to see a flash dump from the almost identical TRENDnet TEG-S762 switch https://www.trendnet.com/support/support-detail.asp?prod=115_TEG-S762 |
The main chips that the firmware ours runs on has references to are as follows: |
I also suspect that the TEG-S762 is virtually identical but it's worth pointing out that many of their switches in that same series are running comparatively beefy Realtek switches and full-blown Linux. Among those are the TEG-S350, TEG-S380, and TEG-S750. Obviously the TEG-S762 could still be a minor variant of the QSW-2104-2T and any differences in Firmware might be interesting. Seeing as you're looking for more than just the ability to one-off configure that switch, did you try contacting QNAP and request GPL source? I've done this with Trendnet for the TEG-S750 and it's been almost 6 months now with no movement :/ |
Well that's the thing i don't think there is actually any GPL licensed code on the device. |
An alternative to using a CH341 is if, like me you have a TL866II+ (or these days the T56) it can use the ICSP clip for 25 series chips (and the sw supports it). That's what i'll be using to rip/replace mine shortly. After I did my findings before (and posted on openwrt), kinda gave up and just used it as a switch. It was on a whim that I went back and came across all your findings. Good work. I guess I'm digging back in. lol |
Nice! Yeah i was finally forced to use the switch for what i bought it for and haven't had the time to look into it more since. I'd like to give it another shot at some point though. |
I just ordered the very similar switch the QNAP QSW-2104-2T I'd like to look into how different these switches are since the main difference externally is swapping the sfp+ ports for dual rj-45 10g ports.
Do you have any information on how you modified the firmware image to disable the web interface timeout? So that this change can be applied to other switches?
Thanks!
The text was updated successfully, but these errors were encountered: