Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Go製のネットワーククライアントに対する継続的 / Fuzzing for network client in Go
Search
mururu
April 24, 2021
Programming
4
2.5k
Go製のネットワーククライアントに対する継続的 / Fuzzing for network client in Go
Go Conference 2021 Spring
mururu
April 24, 2021
Tweet
Share
More Decks by mururu
See All by mururu
Go で始める将棋 AI
mururu
1
2.4k
カンム と React Native / Kanmu React Native
mururu
0
3.3k
カンムでの React Native の 歴史と現在 / React Native in Kanmu
mururu
1
370
Building FIDO2 server in Go
mururu
2
6.2k
「ElixirがリアルタイムWebに強い」 というのは本当か?
mururu
13
6.4k
Erlang: Improve the performance of cryptographic functions by AES-NI
mururu
1
190
Treasure Data Summer Intern 2015 Final Report
mururu
0
3k
Elixir 1.0
mururu
3
730
Why Elixir
mururu
9
2k
Other Decks in Programming
See All in Programming
Terraformテスト入門
msato
0
540
Introduction of Happy Eyeballs Version 2 (RFC8305) to the Socket library
coe401_
1
220
CSC307 Lecture 08
javiergs
PRO
0
330
SRE チーム立ち上げ前に考えたこと・取り組んだこと / Considerations and Preparations Before Establishing an SRE Team
mackey0225
3
320
3 Effective Rules for Success with Signals in Angular
manfredsteyer
PRO
0
120
ドメイン駆動設計の実践
masuda220
PRO
19
5.3k
英語
s_shimotori
1
220
ぼっちを避けて楽しむためのアノテコノテ / Various Tips and Tricks to Avoid Loneliness and Have Fun
nrslib
3
1.7k
Rust.Nagoya #1
codemountains
0
170
最古の関数型言語「Lisp」ことはじめ / lisp_in_kamiyama
uhooi
1
190
はしめてのプログラミングとロボット制御
watawatavoltage
0
290
なぜ宣言的 UI は壊れにくいのか / Why declarative UI is less fragile
uenitty
29
13k
Featured
See All Featured
Code Reviewing Like a Champion
maltzj
517
39k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
20
7.2k
Debugging Ruby Performance
tmm1
71
11k
The Straight Up "How To Draw Better" Workshop
denniskardys
229
130k
Embracing the Ebb and Flow
colly
81
4.3k
Design by the Numbers
sachag
277
18k
Writing Fast Ruby
sferik
623
60k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
121
18k
Why Our Code Smells
bkeepers
PRO
332
56k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
90
47k
Art, The Web, and Tiny UX
lynnandtonic
291
20k
Atom: Resistance is Futile
akmur
261
25k
Transcript
Go 製のネットワーククライアントに対 する継続的 Fuzzing 伊藤 友気 2021.4.24 Go Conference 2021
Spring
Copyright Kanmu, Inc. All right reserved. 2 伊藤 友気 CTO
at Kanmu, Inc. @mururu @mururururu 自己紹介
Copyright Kanmu, Inc. All right reserved. 3 バンドルカードつくってます
Copyright Kanmu, Inc. All right reserved. 4 Fuzzing とは Go
と Fuzzing 継続的な Fuzzing の実例と課題 1 2 3 アジェンダ
Fuzzing とは 1
Copyright Kanmu, Inc. All right reserved. Fuzzing とは 6 1
テキストを入れたり。テキストを入れたり。テキストを入れた り。テキストを入れたり。テキストを入れたり。テキストを入 れたり。テキストを入れたり。テキストを入れたり。 予測不可能なデータをインプットとして与えることによりその不具合 を発見するテスト手法
Copyright Kanmu, Inc. All right reserved. Fuzzing とは 7 1
テキストを入れたり。テキストを入れたり。テキストを入れた り。テキストを入れたり。テキストを入れたり。テキストを入 れたり。テキストを入れたり。テキストを入れたり。 • ブラックボックステスト • 予測不可能な大量のデータ(fuzz)を自動で生成してシステムに 入力しその挙動を監視することで、不具合、脆弱性を発見する ファジングツール (fuzzer) fuzz
Copyright Kanmu, Inc. All right reserved. Fuzzing とは - なぜ
8 1 テキストを入れたり。テキストを入れたり。テキストを入れた り。テキストを入れたり。テキストを入れたり。テキストを入 れたり。テキストを入れたり。テキストを入れたり。 • あらゆる入力を事前に予測したり、静的に検証したりすることは 多くの場合容易ではない ◦ それは思いつかないみたいなコーナーケース • ならば自動で大量にデータを生成して入力してみようという手法 のテスト手法の一つ ファジングツール (fuzzer) fuzz
Copyright Kanmu, Inc. All right reserved. Fuzzing とは - バリエーション
9 1 テキストを入れたり。テキストを入れたり。テキストを入れた り。テキストを入れたり。テキストを入れたり。テキストを入 れたり。テキストを入れたり。テキストを入れたり。 • fuzz の生成方法 • テスト対象やそれに応じた fuzz の与え方 • 商用 / OSS • 有名どころ ◦ AFL ◦ libfuzzer
Go と Fuzzing 2
Copyright Kanmu, Inc. All right reserved. Go と Fuzzing 11
2 テキストを入れたり。テキストを入れたり。テキストを入れた り。テキストを入れたり。テキストを入れたり。テキストを入 れたり。テキストを入れたり。テキストを入れたり。 こんなコード書いてしまったことないですか?
Copyright Kanmu, Inc. All right reserved. Go と Fuzzing -
dvyukov/go-fuzz 12 2 テキストを入れたり。テキストを入れたり。テキストを入れた り。テキストを入れたり。テキストを入れたり。テキストを入 れたり。テキストを入れたり。テキストを入れたり。 • dvyukov/go-fuzz ◦ Go のファジングツールのデファクト ◦ Go 本体のバグも多く検出している
Copyright Kanmu, Inc. All right reserved. Go と Fuzzing -
dvyukov/go-fuzz 13 2 テキストを入れたり。テキストを入れたり。テキストを入れた り。テキストを入れたり。テキストを入れたり。テキストを入 れたり。テキストを入れたり。テキストを入れたり。 • Fuzz 関数を定義して対象の関数を呼びだす • go-fuzz-build でビルドして go-fuzz で実行するだけ
Copyright Kanmu, Inc. All right reserved. Go と Fuzzing -
余談 14 2 テキストを入れたり。テキストを入れたり。テキストを入れた り。テキストを入れたり。テキストを入れたり。テキストを入 れたり。テキストを入れたり。テキストを入れたり。 • Design Draft: First Class Fuzzing : golang.org/s/draft-fuzzing-design • dev branch: https://github.com/golang/go/tree/dev.fuzz
継続的な Fuzzing の実例と課題 3
Copyright Kanmu, Inc. All right reserved. 継続的 Fuzzing - テスト対象
16 3 • カード決済に関するメッセージのやりとりをするクライアント • サーバーとは TCP のコネクション張りっぱなしで管理下の カードを用いた決済が行われた際にサーバーから ISO8583 という規格のフォーマットでメッセージが発行され る • この ISO8583 のメッセージのパースを対象としている • 初期値として用いる corpus (fuzz) はもともとのテストデータ など
Copyright Kanmu, Inc. All right reserved. 継続的 Fuzzing - テスト対象
17 3
Copyright Kanmu, Inc. All right reserved. 継続的 Fuzzing - テスト対象
18 3
Copyright Kanmu, Inc. All right reserved. 継続的 Fuzzing - テスト対象
19 3
Copyright Kanmu, Inc. All right reserved. 継続的 Fuzzing - テスト方法
20 3 • テスト対象とする Fuzz 関数を用意 • GitHub Actions 上で go-fuzz-build でビルドし libfuzzer で Fuzzing、を毎日定時実行 • crash する fuzz が見つかれば自動で corpus に追加する PR を作成する
Copyright Kanmu, Inc. All right reserved. 継続的 Fuzzing - テスト方法
1 21 3
Copyright Kanmu, Inc. All right reserved. 継続的 Fuzzing - テスト方法
2 22 3
Copyright Kanmu, Inc. All right reserved. 継続的 Fuzzing - テスト方法
3 23 3 • crash したらその corpus の追加の PR が自動で作成される • crash した corpus は リグレッションテストのテストケースとしても使 われ、次回以降通常のCI上でのテストでも使われる
Copyright Kanmu, Inc. All right reserved. 継続的 Fuzzing - 課題
24 3 • go-fuzz / libfuzzer が macOS 未サポートのため mac で開発していると素直にローカルで実行できない • 初期値として用いる corpus の管理、更新、最適化を いい感じにやりたい
Copyright Kanmu, Inc. All right reserved. 25 • Fuzzing は大量のデータを自動生成してシステムに入
力することにより不具合を検出するテスト手法 • Go で Fuzzing をするのは現状でも結構簡単 まとめ
Go製のネットワーククライアントに対 する継続的Fuzzing 伊藤 友気 2021.4.24 Go Conference 2021 Spring