Skip to content

SEC: Server-Side Request Forgery leads to Denial of Service #179

Closed

Description

@vybe

Pentest Finding 3.2.2 — Medium (CVSS 6.7)

CVSS Vector: CVSS:4.0/AV:L/AC:L/AT:N/PR:H/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N

Location: PUT /api/settings/skills_library_url

Impact

An admin user can set the skills library URL to an internal address, forcing the backend to connect to internal services. This exhausts backend resources (connection pools, worker threads), causing DoS and making the application unresponsive.

Steps to Reproduce

# Set URL to internal address
PUT /api/settings/skills_library_url
{"value":"https://127.0.0.1:8000"}

# Trigger sync — backend connects to itself, exhausting threads
POST /api/skills/library/sync
{}
# Observe significantly increased response times across all endpoints

Remediation

  • Implement strict input validation: hostname must explicitly match github.com
  • Deny requests targeting internal network ranges (RFC 1918, loopback, metadata services)
  • Enforce aggressive connection and read timeouts on the HTTP client

References

Source: UnderDefense Web Pentest Report, March 2026

Activity

  1. added
    priority-p1
    security
    pentest
    severity-medium
    on Mar 26, 2026
  2. vybe commented on Mar 27, 2026

    @vybe
    ContributorAuthor

    Fix Implemented

    Root cause: PUT /api/settings/skills_library_url accepted arbitrary URLs without validation. An admin could set the skills library URL to an internal address, and POST /api/skills/library/sync would connect to it, exhausting backend resources.

    Fix: Strict URL validation at two layers:

    1. Write-time validation (routers/settings.py): Rejects invalid URLs when skills_library_url is being saved
    2. Sync-time validation (services/skill_service.py): Defense-in-depth check before git operations

    Validation rules (utils/url_validation.py):

    • HTTPS scheme required
    • Hostname must be exactly github.com or www.github.com
    • Non-http schemes (ftp://, file://) rejected
    • DNS resolution checked against private/loopback/reserved IP ranges
    • Various bypass attempts blocked (@-sign, subdomain, lookalike)

    Tests: 28 unit tests in tests/unit/test_ssrf_skills_library.py

    Files changed:

    • src/backend/utils/url_validation.py — New validation module
    • src/backend/services/skill_service.py — Added validation before git sync
    • src/backend/routers/settings.py — Added validation on settings write
    • tests/unit/test_ssrf_skills_library.py — 28 tests
  3. added
    complexity-low
    on Jun 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    complexity-lowpentestpriority-p1securityseverity-medium

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions