私のコンピュータでバッファオーバーフロー防止を無効にする方法はありますか?

私のコンピュータでバッファオーバーフロー防止を無効にする方法はありますか?

Debian 6、Ubuntu 12.04、Fedora 16を含む(これに限定されません)、さまざまな仮想マシンでバッファオーバーフロー実験を実行したいが、バッファオーバーフロー攻撃を実行しようとするたびに次のメッセージが表示されます。

stack smashing detected (core dumped)

ちょっと調べたところ、これというプログラムだとわかりました。バッファオーバーフロー防止コンパイラで実装されます。湾岸協力協議会例えばGCCスタックスマッシュプロテクタ(ProPolice)クラン/llvm使用2 つのバッファオーバーフロー検出器、SafeCode および AddressSanitizer

私の質問は:バッファオーバーフロー攻撃を確認したいからです。私のコンピュータにバッファオーバーフロー保護を無効にする方法(コンパイラフラグ、Linux設定ファイルなど)はありますか?

ベストアンサー1

湾岸協力協議会

gcc( man gcc) では、確認は次のように有効になります。

  -fstack-protector
      Emit extra code to check for buffer overflows, such as stack smashing attacks.  >This is done by adding a guard variable to functions with
      vulnerable objects.  This includes functions that call alloca, and functions with >buffers larger than 8 bytes.  The guards are initialized when
      a function is entered and then checked when the function exits.  If a guard check >fails, an error message is printed and the program exits.

  -fstack-protector-all
      Like -fstack-protector except that all functions are protected.

no-オプション名の前に追加すると、両方を無効にできます。

-fno-stack-protector -fno-stack-protector-all

LLVM/クラン

LLVM/Clang情報(http://clang.llvm.org/docs/UsersManual.html#commandline)AdressSanitizerを有効/無効にします。

-f[no-]address-sanitizer: メモリエラー検出器 AddressSanitizer をオンにします。

とセキュリティコード(http://safecode.cs.illinois.edu/docs/UsersGuide.html)

-f[none-] メモリセーフ

おすすめ記事