Skip to content

Latest commit

 

History

History
99 lines (81 loc) · 7.1 KB

File metadata and controls

99 lines (81 loc) · 7.1 KB

Attack Tree Analysis for typicode/json-server

Objective: Unauthorized Data Access/Modification OR Arbitrary Code Execution on Server

Attack Tree Visualization

                                 +-------------------------------------------------+
                                 |  Attacker's Goal: Unauthorized Data Access/Modification  |
                                 |  OR Arbitrary Code Execution on Server          |
                                 +-------------------------------------------------+
                                                    |
      +----------------------------------------------------------------------------+
      |                                                                            |

+-------------------------+ +---------------------+ | 1. Abuse of | | 2. Exploitation of | | Default Routes/Features [HIGH-RISK] | | Vulnerable | | | | Dependencies | +-------------------------+ +---------------------+ | | +---------+---------+ +-------------+-------------+ | 1.a. | 1.b. | | 2.a. | 2.b. | | Access | Modify | | Known CVE | 0-day in | | /db | Data | | in a | a used | | (Read) | via | | json- | dependency | | [CRITICAL]| Default| | server | (e.g., | | | Routes | | dep. | Express | | | (POST, | | [HIGH-RISK]| middleware)| | | PUT, | | | [CRITICAL] | | | PATCH, | | | | | | DELETE)| | | | | |[CRITICAL]| | | | +---------+---------+ +-------------+-------------+ | +-------------+ | 2.d | | RCE via | | Vulnerable| | Dependency| | [CRITICAL] | +-------------+

This is a high-risk area because json-server's default behavior, if not explicitly secured, exposes significant vulnerabilities. The ease of exploitation makes these attacks very likely.

  • Description: Directly accessing the /db endpoint provides the attacker with the entire JSON database content. This is a complete data breach.
  • Likelihood: High (if /db is exposed)
  • Impact: Very High (full data exposure)
  • Effort: Very Low (typing a URL)
  • Skill Level: Novice
  • Detection Difficulty: Medium (appears in logs, but may be missed without active monitoring)
  • Mitigation: Disable the /db route entirely in production. Serve data only through the API routes.
  • Description: Using standard HTTP methods (POST, PUT, PATCH, DELETE) on the default resource routes (e.g., /posts, /comments), an attacker can create, update, or delete data without any authentication or authorization.
  • Likelihood: High (if routes are unprotected)
  • Impact: High (data corruption, deletion, unauthorized creation)
  • Effort: Low (using standard HTTP methods)
  • Skill Level: Novice
  • Detection Difficulty: Medium (appears in logs, but unauthorized changes may be missed without active monitoring)
  • Mitigation: Implement robust authentication and authorization middleware to protect all routes that modify data.

This category covers attacks that leverage vulnerabilities within json-server itself or, more commonly, its dependencies (like Express.js).

  • Description: Exploiting a publicly known vulnerability (CVE) in one of json-server's dependencies. Exploit code is often readily available.
  • Likelihood: Medium (depends on dependency versions and patching)
  • Impact: Medium to Very High (depends on the specific CVE)
  • Effort: Low to Medium (exploit code may be public)
  • Skill Level: Intermediate to Advanced (depends on exploit complexity)
  • Detection Difficulty: Medium to Hard (requires vulnerability scanning and IDS)
  • Mitigation: Keep all dependencies updated to the latest versions. Use dependency scanning tools (e.g., npm audit, yarn audit).
  • Description: Exploiting a previously unknown vulnerability (a "zero-day") in a dependency. This is much less likely but extremely dangerous.
  • Likelihood: Very Low
  • Impact: Very High (could lead to RCE or complete compromise)
  • Effort: Very High (requires discovering and exploiting the vulnerability)
  • Skill Level: Expert
  • Detection Difficulty: Very Hard (zero-days are unknown by definition)
  • Mitigation: Have a robust incident response plan. Monitor security advisories. Consider using a Web Application Firewall (WAF).
  • Description: A vulnerability in dependency that allows Remote Code Execution.
  • Likelihood: Low
  • Impact: Very High (complete system compromise)
  • Effort: Medium to High
  • Skill Level: Advanced to Expert
  • Detection Difficulty: Hard
  • Mitigation: Keep all dependencies updated. Use a WAF. Implement strong server security practices.