6 ms·
OpenWRT remote code execution via MITM due to bug in package manager
- deleted 7y ago[deleted]
- callesgg 7y agoCalling that remote code execution is a bit of a stretch. Maybe technically accurate. don't know.
- deleted 7y ago[deleted]
- guidovranken 7y agoWhy, because it requires a MITM position? Actually, using a DNS server serving the wrong IP for downloads.openwrt.org will have the same effect.
- blfr 7y agoWhy, because it requires a MITM position? Yes, pretty much.
- asdfasdf1231 7y agoI never understood why domains used to NTP and Package mirrors depend on external, commercial, certificate authorities. It could be a fallback, with a red big warning to manually check the certs are alright when you need it (e.g too long without synching your root certificates package). But for most cases there is no excuse not having it local at all times. I mean MITM a domain essential for the "distro" should be at least just a little bit harder than regular MITM.
- procombo 7y agoI've always wondered a similar thing... why is reputation-based TLD network security limited to a single verification entity (CA w/ revocation policy)? Seems obvious to me certs should be signed (and thus revokable) from multiple entities by default. I've implemented this before in clients ad-hoc, but why isn't it default? Don't get me started on authoritative DNS security.
- eggsome 7y agoI'm confused, they recommend using your vulnerable version of opkg to update opkg?
- deleted 7y ago[deleted]
- presumably 7y agoIn that recommendation, they provide clear and easy to follow instructions for doing the checksum verification manually before applying the update. > Compare both checksums and, if matching, proceed with installing the package
- pkgsupplysec 7y agoIt's definitely an issue that the sha256 checksum check was broken. But, can someone explain why a person who is MITM'ing ipk downloads would change the package and not the checksum? Are there GPG signatures of the package checksums signed with a key that ships with the release? Are package repos downloaded over HTTPS? Is there a CA bundle in the release with which repo x.509 certs are validated?
- slrz 7y agoThe SHA-2 checksums to verify packages against are delivered as part of the (signed) package index (as the article alludes to).
- pkgsupplysec 7y agoAnd those package repo sha256 checksums are signed and verified with ed25519 by usign and ucert (with a key built into the firmware) usign: https://git.openwrt.org/project/usign.git https://git.openwrt.org/project/usign.git ucert: https://git.openwrt.org/project/ucert.git https://git.openwrt.org/project/ucert.git Firmware releases are also signed with GPG: https://openwrt.org/docs/guide-user/security/release_signatures https://openwrt.org/docs/guide-user/security/release_signatu... openwrt/openwrt: https://github.com/openwrt/openwrt https://github.com/openwrt/openwrt openwrt/packages: https://github.com/openwrt/packages https://github.com/openwrt/packages openwrt/openwrt/search?q="usign" https://github.com/openwrt/openwrt/search?q=usign https://github.com/openwrt/openwrt/search?q=usign
- procombo 7y agoI installed newest version OpenWRT on a popular brand, recently manufactured wireless router last week. The OpenWRT firmware couldn't access https sites without installing multiple packages first. Then they had me install all the root certs over an unencrypted connection. The opkg repos and install files are all downloaded over http. With full seriousness, I really hope nobody expects operational security using these routers.
- bloopernova 7y ago
- honkycat 7y ago"The bug has been introduced with commit https://git.openwrt.org/54cc7e3 https://git.openwrt.org/54cc7e3 which failed to advance the proper string pointer when skipping the leading white- space portition of the checksum string, causing the subsequent hex decoding loop to return early with a zero length checksum." I can't believe someone messed up something so simple! ( Sarcasm ) There HAS to be a better way lmao
- DSMan195276 7y agoYeah, yuck, this definitely could have been avoided if they did some proper lexing/parsing before dealing with the line, instead of manually separating things apart after matching on the beginning of the string... That said, perhaps it's just too early in the morning but I don't think that commit introduced the error. The math/logic looks to be identical and I think the bug is `line + strlen("SHA256sum") + 1` which was already there before and doesn't increment past any spaces which might come after the (implied I guess?) colon. Though considering the colon isn't checked for in `SHA256sum`, you could put any character there and it'll work. Yay...
- plapetomain 7y agoNice catch I think. I’ll be damned if I can see a difference. Looks like the old code will also skip the checksum in the case of any non hexdigit padding.
- missosoup 7y agoIf one is of the tinfoil hat persuasion, then https://en.wikipedia.org/wiki/Underhanded_C_Contest https://en.wikipedia.org/wiki/Underhanded_C_Contest
- tapper82 7y agoFixt in new builds of OpenWrt. If you are running the 18.xx or 19.xx branches then update to latest and all is good again.
- pabs3 7y agoJust updating isn't a very safe way to upgrade, use what they suggest in the mail instead: To update the opkg package itself without upgrading the entire firmware, the following commands may be used once all repositories have been updated: cd /tmp opkg update opkg download opkg zcat ./opkg-lists/openwrt_base | grep -A10 "Package: opkg" | grep SHA256sum sha256sum ./opkg_2020-01-25-c09fe209-1_*.ipk Compare both checksums and, if matching, proceed with installing the package: opkg install ./opkg_2020-01-25-c09fe209-1_*.ipk
- pabs3 7y agoFor those who are using the Turris OS OpenWrt derivative: fixed in 5.0-rc0, for 4.0.x there is a bigger problem they are working on, for 3.x it might not have been introduced yet
- beagle3 7y agoTangentially related: I want to run OpenWRT but need at least 500Mbps WAN/LAN filtered routing capacity; my old tp-link 4300 barely manages 150mbps; can anyone recommend a modern home WiFi/router that can run OpenWRT and do line speed packet filtering between WAN and LAN?
- anonsivalley652 7y agoFor ac, 500+ Mbps is primarily feasible only at 5 GHz around 2 m / 5 ft away. WRT3200ACM If you care about performance rather than open source purity tests, Asus RT-AX88U is the way to go.
- beagle3 7y agoThanks. I should have made this more explicit, but I care less about the WLAN performance (as long as it's ok) - I care more about the wired one. Most OpenWRT ports don't offload the LAN/WAN routing, and doing it on a lowly ARM CPU often effectively limits this to a few hundred megabits - e.g. 150mbps on my WDR4300 (which does manage 800Mbps for the same task with the original closed firmware which does do some hardware offloading)
- stas2k 7y agoGet a Xiaomi Router 3G. It is more difficult to do an initial flash, but is well worth it with an awesome $40 price tag on Aliexpress. Only downside is that it only has 3 GigE ports.
- paulcarroty 7y agoPlease not, shitty wifi stability and much more: https://forum.openwrt.org/t/xiaomi-wifi-router-3g/5377/1187 https://forum.openwrt.org/t/xiaomi-wifi-router-3g/5377/1187
- stas2k 7y agoI have three of them serving 802.11n on 2.4 and 802.11ac on 5 gigs and all work fine. Know some people who use them for a bridged setup over ac standard. No issues there as well.
- deleted 7y ago[deleted]