Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

README を良くする #35

Open
n4o847 opened this issue Nov 28, 2020 · 4 comments
Open

README を良くする #35

n4o847 opened this issue Nov 28, 2020 · 4 comments
Labels
documentation Improvements or additions to documentation

Comments

@n4o847
Copy link
Owner

n4o847 commented Nov 28, 2020

とりあえず、現状の

npm start

は動きません。

@masa5555
Copy link
Collaborator

masa5555 commented Dec 6, 2020

ReDoS検出プログラム

このレポジトリは、
セキュリティ・キャンプ全国大会2020 オンライン [Z-Ⅲ] ReDoSの検出プログラムの作成とOSSへの適用
にて作成したものです。

What is ReDoS ?

Regular expression Denial of Service - 脆弱な正規表現が原因で起こるDoS攻撃
例えば、/^(a|a)*$//^a*a*$/には、マッチング処理に文字列の大きさの指数時間や2乗時間かかるような攻撃文字列が存在する。
その処理によってサーバーに多大な負荷がかかってしまう可能性があるので、多大な負荷の原因となる正規表現を検出したい。

Demo

/* 攻撃文字列とサブマッチをMergeされたら、pages or ローカル実行のスクショ */

Usage

~/$ git clone https://github.com/n4o847/seccamp-redos.git
~/$ cd seccamp-redos
~/seccamp-redos$ npm install
~/seccamp-redos$ npx ts-node src/test.ts

Dependency or Requirement

  • npm

@masa5555
Copy link
Collaborator

masa5555 commented Dec 6, 2020

まだ中途半端ですが、作ってみました。(あまりやったことがないので、これでいいのかわかりませんが)
あとはスライドのアルゴリズムの全容の図を乗せるのは見やすくて良さそうだと思いました。(ファイル構造がわかりやすい?)
まあ、スライドのリンクを貼るのが早いですかね

@n4o847
Copy link
Owner Author

n4o847 commented Dec 6, 2020

ありがとうございます!

デモ載せるの良いですね。

@n4o847
Copy link
Owner Author

n4o847 commented Dec 6, 2020

Usage 案です。

  • ブラウザのやつを紹介するのであればブラウザから検出できる機能もほしいですね……
  • このテストの使い方はテストとしていいのかみたいなところがありますね (テストを書く #36 で解決すべき問題ではある)
  • ライブラリとしての使い方も載せたいです

Usage

ブラウザで確認する

ブラウザで正規表現から作られるオートマトンを確認できます。

https://n4o847.github.io/seccamp-redos/

ESLintプラグインとして使う

このツールをESLintプラグインとして使えるようにしたものが公開されています。

https://github.com/Neccolini/seccampZ3-linter

ライブラリとして使う

$ npm install n4o847/seccamp-redos
const redos = require('seccamp-redos');

const re = /(a|a)*/;
console.log(redos.detectReDoS(re.source, re.flags));
// { status: 'Vulnerable', message: 'Detected EDA.' }

ローカルで動かす

(同じ)

@n4o847 n4o847 added the documentation Improvements or additions to documentation label Dec 6, 2020
@n4o847 n4o847 mentioned this issue Dec 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants