Integer Overflow

htARTE(HackTricks AWS Red Team Expert) を使って、ゼロからヒーローまでAWSハッキングを学ぶ
fn main() {

let mut quantity = 2147483647;

let (mul_result, _) = i32::overflowing_mul(32767, quantity);
let (add_result, _) = i32::overflowing_add(1, quantity);

println!("{}", mul_result);
println!("{}", add_result);
}

整数オーバーフローは、整数の最大値を超える計算結果が発生する脆弱性です。これは、C言語などの低レベル言語で特に一般的です。整数オーバーフローは、攻撃者が予期しない動作を引き起こし、メモリの破壊やセキュリティ上の脆弱性を悪用する可能性があります。整数オーバーフローを防ぐためには、適切な入力検証と整数演算の結果を確認することが重要です。

```c #include #include

int main() { int a = INT_MAX; int b = 0; int c = 0;

b = a * 100; c = a + 1;

printf("%d\n", INT_MAX); printf("%d\n", b); printf("%d\n", c); return 0; }

<details>

<summary><strong>ゼロからヒーローまでAWSハッキングを学ぶ</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTE(HackTricks AWS Red Team Expert)</strong></a><strong>!</strong></summary>

* **サイバーセキュリティ企業**で働いていますか? **HackTricksで会社を宣伝**してみたいですか?または、**最新バージョンのPEASSを入手したり、HackTricksをPDFでダウンロード**したいですか?[**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)をチェックしてください!
* [**The PEASS Family**](https://opensea.io/collection/the-peass-family)を発見しましょう。独占的な[NFTs](https://opensea.io/collection/the-peass-family)コレクションです。
* [**公式PEASS&HackTricksスウェグ**](https://peass.creator-spring.com)を手に入れましょう。
* **[💬](https://emojipedia.org/speech-balloon/) [Discordグループ](https://discord.gg/hRep4RUj7f)に参加するか、[telegramグループ](https://t.me/peass)に参加するか、または**Twitter**で**私をフォロー**してください 🐦[**@carlospolopm**](https://twitter.com/hacktricks_live)**。**
* **[hacktricksリポジトリ](https://github.com/carlospolop/hacktricks)と[hacktricks-cloudリポジトリ](https://github.com/carlospolop/hacktricks-cloud)**にPRを提出して、あなたのハッキングトリックを共有してください。

</details>

Last updated