单片机加密和破解

120 views
Skip to first unread message

Rafael Lee

unread,
Apr 6, 2018, 10:32:39 AM4/6/18
to Shenzhen DIY community
最近工作中涉及单片机加密的事情。

在网上随便看了一下。
发现一篇文章:

你的单片机是如何被别人破解的?

我在 STM32 上写了一个在 SRAM 中运行的程序,在没有读保护的情况下可以直接读出 FLASH 内容。
但是开了读保护之后就不能访问 FLASH 内容了。
这和手册 PM0075 Programming manual STM32F10xxx Flash memory microcontrollers 中描述的情形相同。

Once the protection byte has been programmed:
 Main Flash memory read access is not allowed except for the user code (when booting
from main Flash memory itself with the debug mode not active).
 Pages 0-3 (for low- and medium-density devices), or pages 0-1 (for high-density and
connectivity line devices) are automatically write-protected. The rest of the memory can
be programmed by the code executed from the main Flash memory (for IAP, constant
storage, etc.), but it is protected against write/erase (but not against mass erase) in
debug mode or when booting from the embedded SRAM.


淘宝上写的芯片破解的描述大概是这样:
xxx电子是一家以单片机解密/IC复制/PCB抄板/制板/贴片加工/样品制作一条龙服务的公司,公司有多年经验解密的工程师及技术团队。过硬的技术和优质的服务,是您放心的选择。我们公司提供的芯片解密服务的主营产品类别有:
 
1、ATMEL  品牌      AT89C**全系列/ATMEGA***全系列
2、MICROCHIP品牌    PIC12F***全系列/PIC16F***全系列/PIC18F***全系列/PIC10F***全系列
3、SYNCMOS 新茂品牌 SM89****全系列
4、WINBOND品牌      W78E****全系列
5、STC 宏晶品牌     STC89***全系列 STC12C****全系列
6、TI  ST 品牌     STM32F***全系列 STM8S****全系列
7、富士通品牌    MB89F*****全系列 MB90F****全系列
8、NEC  品牌        UPD78F82**全系列  UPD78F92**全系列等系列品牌的解密
9、单片机代烧录.芯片销售,IC出售
10、PCB抄板,制板.BOM清单的制作.
11、半成品加工.生产.原样复制


看来是没有办法完全防范 MCU 被破解了。

以后,可能的策略是这个样子,用一个性能更高的处理器(ARM A53/A57,性能高意味着芯片工艺先进,<22 nm)负责密钥的存储,和 STM32 通过公钥交换信息,由 STM32 完成逻辑。
或者,在 ARM A57 上直接模拟出一个 STM32。
要么,把 STM32 用树脂包起来,里面放一个光/气压传感器,如果树脂被揭开,MCU 程序自毁。这样的话,拆开芯片要同时满足光和空气都不能进入才可以。

FANG Felix

unread,
Apr 8, 2018, 1:14:59 AM4/8/18
to sz...@googlegroups.com
正好用到单片机加密的一些方式
分享下,抛砖引玉希望能听到大家的讨论
首先,完全防止单片机被破解,个人认为是不太现实的。只能尽可能提高破解者成本或者给破解者造成损失

物理层加密手段
1、芯片自带的读保护
此方案最成本最低,破解最容易,大多主流FLASH芯片甚至不用decap,OTP类型的decap之后磨IC找到存储区后也能全部抄出
2、芯片磨字
稍微给破解者造成障碍,但是行业内的,即便不看丝印也能猜出型号或者代替型号,decap后一定能确定单片机品牌,有些开盖后能看到Logo
3、利用“唯一”ID
有些单片机的有唯一ID,利用唯一ID与带有唯一ID的外围芯片进行绑定,校验绑定。绑定完成后自毁绑定程序,缺点是FLSH单片机唯一ID基本都不能做到唯一,通过工具可以烧写,只能寄希望于外围芯片的ID不像单片机那样容易修改
4、入侵检测
在外壳上做入侵检测,检测到入侵后存在RAM区的秘钥自毁。缺点需要电池供电,有误自毁风险,有巧妙的打开外壳方法避开入侵检测
5、利用加密芯片
取决于加密芯片的强度

软件层面
1、强壮的bootloader
2、配合物理层数据运算,如果是单纯的使用一段加密程序,容易被反汇编后跳过
3、发现自校验不过时,不是完全无功能,可以定时挂掉或者有部分功能增加抄袭者成本,上电1000小时挂掉对于有些行业会疯掉
4、在线验证,对于始终联网产品间隔回传ID发现重复直接锁掉

其它偏门的方法
1、单片机FLASH中存有一些校准数据使用这些数据作为唯一ID补充,例如ADC,内部高速时钟等,这些数据虽然可以被修改,但是修改后会影响性能
例如采样定电压,发现采样值不对,或者使用内部高速时钟与外部晶振时钟做比对发现偏差大于规格。
利用这样做加密可以导致破解后不良率异常的高,某款单片机强行将内部高速震荡校准值烧录为定值后测试常温下有1/5的芯片时钟偏差达到规格书的2倍。
更高阶的方法是故意将ADC与内部时钟烧偏,使用偏移后数值,这样普通芯片即便获得程序也无法使用,但是一般需要原厂支援校准程序、方法及工具,难度较大
2、供应链入手
使用定制化封装芯片或者补充一个非常不常用的单片机作为辅助逻辑运算。市面上使用越多的单片机破解成本相对容易做低,不常用的破解成本相对较高。定制化封装可以只封出使用的引脚,部分引脚顺序可以修改,会强迫别人修改PCB,在PCB面积很紧张时格外有效,定制化封装需要找到能拿到Wafer的代理商,一些芯片是Wafer进来国内封装,有些品牌高级别的代理商有自己封装的权限。

以上手段混合使用能达到非常不错的效果

另外树脂包起来想法不错,但是自毁程序需要供电,同时STM32特定情况下可以不开盖破解
之前有见到过一款加密芯片是防止对芯片入侵的,制成比较特殊对可见光敏感??,开盖后敏感数据丢失,这个是凭印象没有查证。但是其它方式的破解是否有效不确定


发件人: sz...@googlegroups.com <sz...@googlegroups.com> 代表 Rafael Lee <rafael...@gmail.com>
发送时间: 2018年4月6日 14:32
收件人: Shenzhen DIY community
主题: [szdiy] 单片机加密和破解
 
--
--
You received this message because you are subscribed to the Google
Groups "Shenzhen DIY community" group.
To post to this group, send email to sz...@googlegroups.com
To unsubscribe from this group, send email to
szdiy+un...@googlegroups.com
For more options, visit this group at
http://www.szdiy.org
http://groups.google.com/group/szdiy?hl=zh-CN
---
您收到此邮件是因为您订阅了Google网上论坛上的“Shenzhen DIY community”群组。
要退订此群组并停止接收此群组的电子邮件,请发送电子邮件到szdiy+un...@googlegroups.com
要查看更多选项,请访问https://groups.google.com/d/optout

Nala Ginrut

unread,
Apr 8, 2018, 11:44:34 AM4/8/18
to sz...@googlegroups.com
绝对地防止破解是不可能的,如今防破解真正有价值的做法是尽可能设置障碍,并且在研发上加快迭代,期望在对方破解这个版本前出下一个版本

thomas92911

unread,
Apr 22, 2018, 9:21:03 PM4/22/18
to sz...@googlegroups.com
道德的归道德,法律的归法律,技术不能当上帝。

绝对地防止破解是不可能的,如今防破解真正有价值的做法是尽可能设置障碍,并且在研发上加快迭代,期望在对方破解这个版本前出下一个版本

> For more options, visit this group at
> http://www.szdiy.org
> http://groups.google.com/group/szdiy?hl=zh-CN
> ---
> 您收到此邮件是因为您订阅了Google网上论坛上的“Shenzhen DIY community”群组。
> 要退订此群组并停止接收此群组的电子邮件,请发送电子邮件到szdiy+unsubscribe@googlegroups.com

> 要查看更多选项,请访问https://groups.google.com/d/optout
>
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Shenzhen DIY community" group.
> To post to this group, send email to sz...@googlegroups.com
> To unsubscribe from this group, send email to

> For more options, visit this group at
> http://www.szdiy.org
> http://groups.google.com/group/szdiy?hl=zh-CN
> ---
> 您收到此邮件是因为您订阅了Google网上论坛上的“Shenzhen DIY community”群组。
> 要退订此群组并停止接收此群组的电子邮件,请发送电子邮件到szdiy+unsubscribe@googlegroups.com

> 要查看更多选项,请访问https://groups.google.com/d/optout

--
--
You received this message because you are subscribed to the Google
Groups "Shenzhen DIY community" group.
To post to this group, send email to sz...@googlegroups.com
To unsubscribe from this group, send email to

For more options, visit this group at
http://www.szdiy.org
http://groups.google.com/group/szdiy?hl=zh-CN
---
您收到此邮件是因为您订阅了 Google 网上论坛的“Shenzhen DIY community”群组。
要退订此群组并停止接收此群组的电子邮件,请发送电子邮件到szdiy+unsubscribe@googlegroups.com
要查看更多选项,请访问 https://groups.google.com/d/optout

Rafael Lee

unread,
May 8, 2018, 11:47:36 AM5/8/18
to Shenzhen DIY community
采用了英飞凌科技SLE 66PE系列芯片的“深圳通”CPU卡发卡量已经成功突破200万张
http://www.chinaiccard.com/industry/970.html

"Unhackable" Infineon Chip Physically Cracked
https://www.pcworld.com/article/189144/unhackable_chip_pwned.html

看起来这个芯片的破解要比 STM32 难不少。

附上 Data Brief
https://media.digikey.com/pdf/Data%20Sheets/Infineon%20PDFs/SLE%2066CX80PE.pdf

淘宝上只有几家卖。
道德的归道德,法律的归法律,技术不能当上帝。

绝对地防止破解是不可能的,如今防破解真正有价值的做法是尽可能设置障碍,并且在研发上加快迭代,期望在对方破解这个版本前出下一个版本

> For more options, visit this group at
> http://www.szdiy.org
> http://groups.google.com/group/szdiy?hl=zh-CN
> ---
> 您收到此邮件是因为您订阅了Google网上论坛上的“Shenzhen DIY community”群组。
> 要退订此群组并停止接收此群组的电子邮件,请发送电子邮件到szdiy+unsubscribe@googlegroups.com
> 要查看更多选项,请访问https://groups.google.com/d/optout
>
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Shenzhen DIY community" group.
> To post to this group, send email to sz...@googlegroups.com
> To unsubscribe from this group, send email to

> For more options, visit this group at
> http://www.szdiy.org
> http://groups.google.com/group/szdiy?hl=zh-CN
> ---
> 您收到此邮件是因为您订阅了Google网上论坛上的“Shenzhen DIY community”群组。
> 要退订此群组并停止接收此群组的电子邮件,请发送电子邮件到szdiy+unsubscribe@googlegroups.com
> 要查看更多选项,请访问https://groups.google.com/d/optout

--
--
You received this message because you are subscribed to the Google
Groups "Shenzhen DIY community" group.
To post to this group, send email to sz...@googlegroups.com
To unsubscribe from this group, send email to

For more options, visit this group at
http://www.szdiy.org
http://groups.google.com/group/szdiy?hl=zh-CN
---
Reply all
Reply to author
Forward
0 new messages