当前位置:网站首页>About security details timing attack
About security details timing attack
2022-07-18 05:19:00 【Qingdong】
order
since:2021 year 5 month 22 Japan 21:12
auth: Hadi
Reference resources :
https://zhuanlan.zhihu.com/p/150689564
https://www.oracle.com/java/technologies/javase/6u17.html
Preface
I saw some posts about security theory in Zhihu , Here I also pull a piece of water blog . The reference code is Sacla in safeEqual String comparison is relevant .
stay String The source code of security comparison in is as follows :
def safeEqual(a: String, b: String) = {
if (a.length != b.length) {
false
} else {
var equal = 0
for (i <- Array.range(0, a.length)) {
equal |= a(i) ^ b(i)
}
equal == 0
}
}
I'm still confused when I see this code , The first part : Return when the length is inconsistent false; The second part uses bit operation to compare the value of each bit , Then take the union value and return , As long as there is one inconsistency, it is false. There seems to be nothing wrong with the code , But this is a common method , We all know the points that can be optimized , Directly compare each bit. If there is a problem with the bit length, return directly false That's it , So why safeEqual How about this ?
The price of safety
Obviously , This method emphasizes that this method is safe , This method deliberately reduces the efficiency , stay java There are also security classes in java.security.MessageDigest There is isEqual Have the same way of writing . So why write like this ?
Timing Attack
timing attack ( Why do you think of interstellar ).
Through power consumption 、 sequential 、 Electromagnetic leakage and other ways to achieve the purpose of cracking . In many physically isolated environments , It's often amazing ; The effectiveness of this attack is much higher than the traditional mathematical method of cryptanalysis . For example, when we call isEqual When , It is likely to compare whether the passwords are consistent .safeEqual("abcdefg","Abcdefg") and safeEqual("abcdefg","abcdefG") The first one is different from the last one , Their running time is completely different , This prevents the input from changing a lot , And calculate the statistical time to brutally crack the compared string .
When we write normally , Will return directly for efficiency , But ignore that others can use this to crack the security we set .
stay Java SE 6 Update Officially joined MessageDigest.isEqual https://www.oracle.com/java/technologies/javase/6u17.html

Postscript
brief , But tell us that the devil is a foot tall and the road is a foot tall , In terms of security and cracking , It's all about change , They attacked each other , Continuously improve , Strive to improve the effectiveness of the code .
边栏推荐
- The seventh day of learning C language with small Bai challenge -- Enumeration, structure, community
- 理财平台哪个最安全收益怎么样
- STM32 IO口模式介绍
- Information system project manager 10 days before the exam limit sprint + answer (7)
- 1 start.s分析
- 阿里云架构师马颂:云上高性能计算助力基因测序
- E-commerce platform background management system --- > system detailed design (user management module)
- 使用1个盘三个5G分区创建12G逻辑卷
- Installation and use of Doxygen and annotation syntax
- 信息系统项目管理师必背核心考点(四)UML类与类之间的关系
猜你喜欢

关于解决token过期失效问题

信息系统项目管理师必背核心考点(十)信息系统规划

Redis02: install redis in Linux Environment

The 9th Blue Bridge Cup group B provincial tournament.

Core examination site for information system project managers (XI) two key technologies and architectures of the Internet of things

STM32F103 串口 +DMA中断实现数据收发

零基础学lua第十五天---最后归纳下

信息系统项目管理师必背核心考点(一)国家信息化体系六要素

(pc+wap) Zhimeng template waterproof building materials website

小白挑战学c语言第一天----运行环境的搭建
随机推荐
Information system project manager core examination site (VIII) software integration technology
ORACLE在修改主键时出现ORA-00955报错解决方法
Salesforce Certified Sharing and Visibility Designer (SU20)认证考试总结
The 9th Blue Bridge Cup group B provincial tournament.
xstream解析xml的时候报错AbstractReflectionConverter$UnknownFieldException
关于安全细节 Timing Attack
IAP Bootload 和 App 间跳转的代码实现
Matlab_调试中figure置顶显示
Matlab_ Figure is displayed on the top during debugging
Salesforce邮件发进垃圾邮箱或未收到SF邮件处理方式 (DKIM - New CNAME Version)
Core examination points for information system project managers (VII) software architecture style
Information system project managers must recite the core examination points (I) six elements of the national information system
(pc+wap) Zhimeng template waterproof building materials website
Information system project managers must recite the core examination points (IV) the relationship between UML classes
STM32F103 串口 +DMA中断实现数据收发
Salesforce Dynamic Forms
STM32F103 serial port DMA + idle interrupt to realize variable length data sending and receiving
Dynamic programming | 0-1 knapsack problem
INSUFFICIENT_ACCESS_ON_ CROSS_REFERENCE_ENTITY APEX / SALESFORCE
Transplantation and analysis of freemodbus on stm32f1 platform