Reverse engineering my Coway air purifier to ditch the cloud
本文为原文前 6,000 字符的节选翻译,完整内容请查看原文。
The year is 2017. A string of annual wildfires rocks the West Coast. The sky looks like this in the daytime:
时间是2017年。一系列年度森林大火席卷了西海岸。白天的天空看起来是这样的:
My home, like many in the Bay Area, has no insulation and isn’t really air sealed. To avoid choking on soot, a lot of people started buying air purifiers like this one:
和湾区的许多家庭一样,我家没有隔热层,也没有进行真正的气密性处理。为了避免被烟尘呛到,许多人开始购买像这样的空气净化器:
The venerable Coway Airmega
备受推崇的 Coway Airmega
It’s an overpriced box fan with a HEPA filter and an air quality sensor. It has some controls for the fan speed, and it can also automatically ramp up if the air quality is bad. It’s ugly, but they’re so ubiquitous around here that I feel like no one even notices them anymore. Also, FWIW, the device works. It really does improve air quality.
它本质上是一个价格虚高的箱式风扇,配有 HEPA 滤网和空气质量传感器。它具备一些风速控制功能,当空气质量变差时,还能自动提高风速。它长得很难看,但在我们这儿随处可见,以至于我觉得已经没人会注意到它们了。另外,不管怎么说,这设备确实有用。它确实能改善空气质量。
This device became a staple item in our household when my wife eventually started cranking up the fan at night for white noise (a dual purpose!). Over time, I have become accustomed to it and now also require it to sleep.
当我的妻子最终开始在晚上调大风扇以制造白噪音(一举两得!)时,这个设备成了我们家的必备品。久而久之,我已经习惯了它,现在睡觉也离不开它了。
Our home also has smart lighting, and it’s all integrated with Apple Home. At night, I always press the “Good Night” button, which shuts off all the lights. I really wanted to tie the fan into that. I’d press Good Night, the lights would shut off, and the fan would crank up to my wife’s preferred white noise volume.
我们家还有智能照明系统,并且全部接入了 Apple Home。晚上,我总是按下“晚安”按钮,关掉所有的灯。我真的很想把风扇也联动进去。按下“晚安”后,灯光熄灭,风扇自动调到我妻子喜欢的白噪音音量。
The old Airmega didn’t have Wi-Fi, so there was no easy way to integrate it with Apple Home. When it eventually broke, I bought the now-discontinued Coway Airmega IconS (for non-discontinued Wi-Fi models, check out the Airmega 250S or Airmega MightyS). It’s still just a box fan with a HEPA filter, but it’s considerably more expensive, aims to look like a piece of fancy mid-century furniture, and most importantly, can be controlled over Wi-Fi (sort of).
旧款 Airmega 没有 Wi-Fi,所以无法轻松接入 Apple Home。当它最终坏掉时,我买了现已停产的 Coway Airmega IconS(若要购买未停产的 Wi-Fi 型号,可以看看 Airmega 250S 或 Airmega MightyS)。它依然只是一个带 HEPA 滤网的箱式风扇,但价格贵得多,外观设计旨在模仿昂贵的中世纪家具,最重要的是,它可以通过 Wi-Fi 进行控制(某种程度上)。
The Coway Airmega IconS
Coway Airmega IconS
Coway’s iPhone app is an absolutely classic IoT affair. It takes forever to load, and it asks me to change my password nearly every time I launch it. Thankfully, a brave soul reverse-engineered the app and wrote an integration for Home Assistant. The integration more or less pretends to be the phone app. It polls the Coway cloud service for status updates and sends commands through it to control the fan. Home Assistant bridges that to Apple Home and… voilà!
Coway 的 iPhone 应用程序是典型的物联网产品。加载速度极慢,而且几乎每次启动都要我修改密码。好在有一位勇士对该应用进行了逆向工程,并为 Home Assistant 编写了一个集成插件。这个集成插件基本上是伪装成手机应用,通过轮询 Coway 云服务获取状态更新,并发送指令来控制风扇。Home Assistant 再将其桥接到 Apple Home,大功告成!
The downside of this approach is that you’re still at the mercy (or lack thereof) of the Coway cloud service. It seems like at least once or twice a year, it breaks.
这种方法的缺点在于,你仍然受制于 Coway 云服务(或者说受制于它的不可靠)。它似乎每年至少会出几次故障。
Here are some of the reasons I have seen it break:
以下是我观察到的一些故障原因:
On top of this, it seems unlikely that Coway will maintain this service forever. I suspect that eventually, like all IoT manufacturers, they’ll either charge for this service or discontinue it. My fan model is already discontinued (though there are other Wi-Fi enabled models, so… who knows).
除此之外,Coway 似乎不太可能永远维护这项服务。我怀疑最终,像所有物联网制造商一样,他们要么会对这项服务收费,要么会将其停掉。我的风扇型号已经停产了(虽然还有其他支持 Wi-Fi 的型号,所以……谁知道呢)。
I admit, I have been lazy. For years, I put off trying to figure out a way to ditch the Coway cloud, because if the device was really locked down, it would be pretty tough. Presumably, when the fan starts up, it connects to coway.com (or whatever) and checks that the server’s SSL certificate is valid. Most likely, I wouldn’t be able to make a fake certificate that passes that check, so the fan wouldn’t connect to my server.
我承认,我一直很懒。多年来,我一直推迟寻找摆脱 Coway 云服务的方法,因为如果设备被完全锁定,那将非常困难。推测起来,当风扇启动时,它会连接到 coway.com(或其他地址),并检查服务器的 SSL 证书是否有效。很可能我无法制作出能通过该检查的伪造证书,因此风扇将无法连接到我的服务器。
Also, setting up a man-in-the-middle (MitM) environment is just a pain in the neck. The fan would have to connect to an isolated Wi-Fi network that routes all its traffic through my own server on the way out to the internet. To do that, you have to configure a bunch of routing and firewall rules to redirect traffic. None of this is impossible (I’ve done it before), but it’s a hassle to set up, and it’s always finicky to get right. And once you have it set up, that’s just step one.
此外,搭建中间人(MitM)环境非常麻烦。风扇必须连接到一个隔离的 Wi-Fi 网络,该网络将所有流量在通往互联网的途中路由到我自己的服务器。为此,你必须配置一系列路由和防火墙规则来重定向流量。这些并非不可能(我以前做过),但设置起来很繁琐,而且总是很难调好。即便设置好了,那也仅仅是第一步。
All that said, two major things have changed.
话虽如此,有两件大事发生了变化。
First, there was a recent security incident (October 2026) where someone discovered that eMudhra, one of the trusted internet certificate authorities, had used a very weak parameter for some of its private keys.
首先,最近发生了一起安全事件(2026 年 10 月),有人发现受信任的互联网证书颁发机构之一 eMudhra 在其部分私钥中使用了非常薄弱的参数。
For the next few days or weeks, anyone now has a root CA thanks to eMudhra. Time to have some fun with MiTMing unwilling devices!
在接下来的几天或几周内,多亏了 eMudhra,任何人现在都拥有了一个根证书颁发机构(Root CA)。是时候通过中间人攻击来“调戏”那些不情愿的设备了!
10:15 AM · Oct 20, 2026
上午 10:15 · 2026 年 10 月 20 日
So, if the device is unpatched AND it has hardcoded root certificates AND it doesn’t pin the cloud service’s certificate, then… maybe that’s a way in. Admittedly, that’s a lot of ifs, but assuming the device doesn’t have any major security mistakes in its design, this could be the foothold needed to take control of it.
因此,如果设备未打补丁,且硬编码了根证书,且没有对云服务的证书进行固定(Pinning),那么……这或许就是切入点。诚然,这需要满足很多假设条件,但如果设备在设计上没有重大的安全漏洞,这可能就是夺取控制权所需的立足点。
The second thing is simply AI. An LLM can set up everything you need for a MitM environment, so you can get straight to sleuthing out how the fan works. It can do this unattended, in minutes.
第二件事就是人工智能。大语言模型(LLM)可以为你搭建中间人环境所需的一切,让你直接开始探究风扇的工作原理。它可以在几分钟内无人值守地完成这些工作。
Once you can sit between the fan and the internet, you can see how it communicates, which should help us understand how to get the fan to talk to us instead of the cloud.
一旦你能处于风扇和互联网之间,你就能看到它是如何通信的,这将有助于我们了解如何让风扇与我们对话,而不是与云端对话。
Initially, I tried to set it up like this:
起初,我尝试这样设置:
This actually didn’t work, because a Raspberry Pi uses a smallish PCB trace antenna that doesn’t get a ton of signal strength. With the Pi in the room with my router, the signal was too weak to reach the fan. I guess I could’ve moved the fan into the room with the router, but why do that when I can solve this with a convoluted technical solution?
这实际上行不通,因为树莓派使用的是小型 PCB 走线天线,信号强度并不高。当树莓派放在路由器所在的房间时,信号太弱,无法覆盖到风扇。我想我本可以把风扇搬到路由器所在的房间,但既然能用复杂的方案解决,为什么要那么做呢?
The Raspberry Pi uses its Wi-Fi radio to run its own access point for the fan to connect to. It can’t easily do that while also connecting over Wi-Fi to the home network. So, I moved the Pi into the room with the fan and plugged its Ethernet port into my laptop, which bridges it to the home network over Wi-Fi:
树莓派利用其 Wi-Fi 无线电运行自己的接入点,供风扇连接。它很难在连接家庭 Wi-Fi 网络的同时轻松做到这一点。因此,我把树莓派搬到了风扇所在的房间,并将其以太网口插入我的笔记本电脑,通过笔记本电脑的 Wi-Fi 将其桥接到家庭网络:
Next, we need to configure the Pi.
接下来,我们需要配置树莓派。
I’m not really making a value judgment here on whether this is a fair thing to block, but Claude will not oblige the request, not even for… uhh… testing purposes.
我在这里并不是要对这种封锁是否合理做出价值判断,但 Claude 不会满足这个请求,即使是出于……呃……测试目的也不行。
Luckily, ChatGPT has no such compunctions.
幸运的是,ChatGPT 没有这种顾虑。
After a few rounds of that, here are the nftables rules it ended up with:
经过几轮对话,它最终给出的 nftables 规则如下:
Basically, the masquerade rule translates the traffic from the isolated Wi-Fi network out through our home internet, and the redirect rule forwards HTTP/HTTPS to a running instance of mitmproxy.
基本上,伪装规则(masquerade rule)将来自隔离 Wi-Fi 网络的流量通过我们的家庭互联网转发出去,而重定向规则将 HTTP/HTTPS 流量转发到正在运行的 mitmproxy 实例。
Also on the Pi, mitmproxy runs with its web interface, mitmweb, using a command line like this:
同样在树莓派上,mitmproxy 通过其 Web 界面 mitmweb 运行,使用的命令行如下:
Yes, of
是的,当然