GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Home
  • Archives
  • ABOUT

This view

  • Original page
  • New address

GeezerVison is showing coderming.github.io — tech - M's BLOG

  • Home
  • Archives
  • ABOUT
  • Categories
  • tech
  • school

浅析 protobuf 编码解码的实现

xxx

2020/09/04 posted in  tech

Timing Attack的原理和实用库 cryptiles

最近在刷node的基础知识,偶然间看到了Node中的“Timing Attack”问题。于是尝试深入了解了一下,就有了这篇文章👇

什么是 Timing Attack?cryptiles 是做什么用的?

Timing Attack,直译过来就是“时间攻击”。是利用了语言引擎比对两个字符串的实现方法来进行的攻击。
对于JS引擎,匹配两个字符串是否相等,是做以下两件事:
- 查看两个字符串长度是否有为0的,如果都为0就返回true,只有一个为0就返回false
- 从字符串的第0个元素开始,比对两个字符串对应的字符是否相同。如果不同,就返回false。这样一直运行到两个字符串都结尾,如果结尾的标志符(在C语言中是'\0',在JS的引擎实现不清楚)都一样的话,就返回true
对于这个实现算法,我们知道其运行时间并非稳定的。因为开头正确位数不一样,所以匹配时间也不一样。而Timing Attack就是利用了匹配时间上的差距,来猜测匹配的字符串对了几位。

有什么解决方案?

Node官方自带的 crypto模块就有解决方案。具体的API可以看这里:crypto | Node.js API 文档(目前只有英文)
那 cryptiles 是做什么的呢?就是一个避免 Timing Attack 的工具。具体请看:
GitHub - hapijs/cryptiles: General purpose crypto utilities

有了这些工具,就可以很显著地避免这个问题了。

2020/06/23 posted in  tech

M's BLOG

keep active, keep motivate.
Email RSS

Categories

tech school

Recent Posts

  • 浅析 protobuf 编码解码的实现
  • Timing Attack的原理和实用库 cryptiles
  • 浅析阿里2018秋招前端编程测验题

Copyright © 2015 Powered by MWeb,  Theme used GitHub CSS.

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.