From ccdc0fed9e96475d038295e43d9110f7a850f6ac Mon Sep 17 00:00:00 2001 From: shiva108 Date: Tue, 30 Dec 2025 18:04:26 +0100 Subject: [PATCH] docs: Update and clarify case studies, real-world examples, and minor formatting across chapters. --- ...pter_17_01_Fundamentals_and_Architecture.md | 1 - ..._02_API_Authentication_and_Authorization.md | 3 ++- docs/Chapter_17_03_Plugin_Vulnerabilities.md | 6 +++--- ...04_API_Exploitation_and_Function_Calling.md | 6 +++--- ...pter_17_05_Third_Party_Risks_and_Testing.md | 1 - docs/Chapter_17_06_Case_Studies_and_Defense.md | 18 +++++++++--------- 6 files changed, 17 insertions(+), 18 deletions(-) diff --git a/docs/Chapter_17_01_Fundamentals_and_Architecture.md b/docs/Chapter_17_01_Fundamentals_and_Architecture.md index 54e5276..04f721f 100644 --- a/docs/Chapter_17_01_Fundamentals_and_Architecture.md +++ b/docs/Chapter_17_01_Fundamentals_and_Architecture.md @@ -591,4 +591,3 @@ acl.add_to_allowlist('verified_calculator_plugin') ``` --- - diff --git a/docs/Chapter_17_02_API_Authentication_and_Authorization.md b/docs/Chapter_17_02_API_Authentication_and_Authorization.md index 8f8de79..0f79acd 100644 --- a/docs/Chapter_17_02_API_Authentication_and_Authorization.md +++ b/docs/Chapter_17_02_API_Authentication_and_Authorization.md @@ -456,6 +456,7 @@ eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoxMjMsInBlcm1pc3Npb25zIjpbInJ - `jti`: JWT ID (for revocation). 3. **Signature** (Cryptographic hash): + ``` HMACSHA256( base64UrlEncode(header) + "." + base64UrlEncode(payload), @@ -1003,6 +1004,7 @@ def modify_data(user_id, data): - **Over-privileged default roles**: Giving users 'admin' by default. ### 17.3.3 Session Management + #### Secure session handling ```python @@ -1108,4 +1110,3 @@ class SecretScanner: ``` --- - diff --git a/docs/Chapter_17_03_Plugin_Vulnerabilities.md b/docs/Chapter_17_03_Plugin_Vulnerabilities.md index 82c5dff..634922a 100644 --- a/docs/Chapter_17_03_Plugin_Vulnerabilities.md +++ b/docs/Chapter_17_03_Plugin_Vulnerabilities.md @@ -613,9 +613,9 @@ class SecureBankingPlugin: **Real-World Impact:** -- **2010 - Citibank**: Race condition allowed double withdrawals from ATMs. +- **2012 - Citibank**: Race condition allowed double withdrawals from ATMs. - **2016 - E-commerce**: Concurrent coupon use drained promotional budgets. -- **2019 - Crypto Exchange**: Race condition in withdrawal processing led to $40M loss. +- **2019 - Binance**: $41M stolen via coordinated attack exploiting multiple security weaknesses. **Key Takeaway:** @@ -679,6 +679,7 @@ class SecureDatabasePlugin: return self.db.execute(sql) except Exception as e: ``` + # Log detailed error securely logger.error(f"Database error: {str(e)}") # Return generic message to user @@ -747,4 +748,3 @@ class SecureAdminPlugin: ``` --- - diff --git a/docs/Chapter_17_04_API_Exploitation_and_Function_Calling.md b/docs/Chapter_17_04_API_Exploitation_and_Function_Calling.md index 29fe6c7..19526c8 100644 --- a/docs/Chapter_17_04_API_Exploitation_and_Function_Calling.md +++ b/docs/Chapter_17_04_API_Exploitation_and_Function_Calling.md @@ -124,7 +124,7 @@ class APIEnumerator: **Real-World Impact:** -A 2019 audit found that 73% of APIs had undocumented endpoints exposed, and 41% of those had vulnerabilities. That's a huge target. +According to industry security research, a significant percentage of APIs have undocumented endpoints exposed, many with vulnerabilities. This highlights the importance of API enumeration in security testing. #### Parameter fuzzing @@ -400,10 +400,10 @@ Key fixes: **Real-World Impact:** -- **2019 - Facebook**: IDOR exposed private photos of millions. +- **2018 - Facebook**: Bug exposed private photos of 6.8 million users. - **2020 - T-Mobile**: Customer data leaked via account numbers. - **2021 - Clubhouse**: Audio room data scraped via sequential IDs. -- **2022 - Parler**: 70TB of user posts downloaded via IDOR. +- **2021 - Parler**: 70TB of user posts downloaded via IDOR. **Testing for IDOR:** diff --git a/docs/Chapter_17_05_Third_Party_Risks_and_Testing.md b/docs/Chapter_17_05_Third_Party_Risks_and_Testing.md index 92b0b76..ac7357b 100644 --- a/docs/Chapter_17_05_Third_Party_Risks_and_Testing.md +++ b/docs/Chapter_17_05_Third_Party_Risks_and_Testing.md @@ -524,4 +524,3 @@ class AuthzTester: ``` --- - diff --git a/docs/Chapter_17_06_Case_Studies_and_Defense.md b/docs/Chapter_17_06_Case_Studies_and_Defense.md index 893aec6..4e83f7d 100644 --- a/docs/Chapter_17_06_Case_Studies_and_Defense.md +++ b/docs/Chapter_17_06_Case_Studies_and_Defense.md @@ -2,7 +2,7 @@ ### 17.11.1 Real-World Plugin Vulnerabilities -#### Case Study: ChatGPT Plugin RCE +#### Case Study: ChatGPT Plugin RCE (Hypothetical Scenario) ```text Vulnerability: Command Injection in Weather Plugin @@ -30,7 +30,7 @@ Lessons: ### 17.11.2 API Security Breaches -#### Case Study: 10M User Records Leaked +#### Case Study: 10M User Records Leaked (Composite Example) ```text Incident: Mass data exfiltration via IDOR @@ -362,9 +362,9 @@ def check_burst_activity(user_id, time_window_seconds=60): **Real-World Monitoring Benefits:** -- **2018 - GitHub**: Caught token abuse early. -- **2020 - Twitter**: Flagged admin tool abuse. -- **2021 - Twitch**: Scraper caught before full database dump. +- **2022 - GitHub**: OAuth token abuse detected via anomaly monitoring. +- **2020 - Twitter**: Flagged admin tool abuse in July Bitcoin scam. +- **2021 - Twitch**: Breach detected; 125GB leaked (improved monitoring could have caught earlier). **Prerequisites:** @@ -583,7 +583,7 @@ LLM: {"function": "delete_all_data"} 3. **Input Validation**: Check everything, everywhere. 4. **Continuous Monitoring**: Watch for the attacks you didn't prevent. -## 3. Input Validation Everywhere +### Input Validation Everywhere **Validation Rules:** @@ -606,7 +606,7 @@ def validate_email(email): return email ``` -## 4. Continuous Monitoring and Logging +### Continuous Monitoring and Logging **What to Monitor:** @@ -628,7 +628,7 @@ def validate_email(email): --- -## 17.15 Research Landscape +## 17.16 Research Landscape ### Seminal Papers @@ -636,7 +636,7 @@ def validate_email(email): | :---------------------------------------------------------------------------------------------------------------------------- | :--- | :---- | :--------------------------------------------------------------- | | [Greshake et al. "Compromising Real-World LLM-Integrated Applications"](https://arxiv.org/abs/2302.12173) | 2023 | AISec | The seminal paper on Indirect Prompt Injection and plugin risks. | | [Patil et al. "Gorilla: Large Language Model Connected with Massive APIs"](https://arxiv.org/abs/2305.15334) | 2023 | arXiv | Explored fine-tuning models for API calls and parameter risks. | -| [Qin et al. "ToolLLM: Facilitating Large Language Models to Master 16000+ Real-world APIs"](https://arxiv.org/abs/2307.16789) | 2023 | ICLR | Large-scale study of API interaction capabilities. | +| [Qin et al. "ToolLLM: Facilitating Large Language Models to Master 16000+ Real-world APIs"](https://arxiv.org/abs/2307.16789) | 2023 | arXiv | Large-scale study of API interaction capabilities. | | [Li et al. "API-Bank: A Benchmark for Tool-Augmented LLMs"](https://arxiv.org/abs/2304.08244) | 2023 | EMNLP | Established benchmarks for API execution safety. | ### Evolution of Understanding