0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

PIEのWrite Up

Posted at

PIEとは

  • Position-Independent Executableの頭文字をとったもの

  • プログラムの実行ファイル自体を、メモリ内の任意のアドレスにロードできるようにコンパイルする技術

  • ASLR(Address Space Layout Randomization) と組み合わせることでプログラムのメモリ空間を予測しにくくすることができ、セキュリティが向上する

    • ASLR:プログラムが起動するたびに、スタック、ヒープ、ライブラリなどの主要なメモリ領域のアドレスをランダムに配置する技術

Write Up

Pasted image 20250423174535.png

  • 問題の実行ファイルを起動するとmain関数のアドレス位置が与えられ、ジャンプ先のアドレスの入力を求められる

  • PIEに対応した実行ファイルだった場合でも、プログラム内部のモジュール間の相対アドレスは変わらないのでローカルでデバッガを有効にして実行ファイルをデバッグする

  • print (*win - *main)でmain関数から見たwin関数の相対位置を計算する
    Pasted image 20250423175256.png

  • ncコマンドでサーバにアクセスして、表示されたmain関数のアドレス位置に対して上で計算したwin関数の相対位置を足してジャンプ先として入力するとフラグが手に入る

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?