gin-vue-admin: unauthenticated Go source injection via public auto-code routes (initMenu/initAPI/initDictionary)
What fixes it
- 2.9.2gin-vue-adminGitHub
A fixed version on one release line is not the upgrade target for every line. Check your exact version and any vendor backports.
Description
Impact
Three publicly accessible auto-code endpoints (initMenu, initAPI, and initDictionary) are exposed without authentication or authorization. User-controlled request parameters are interpolated directly into generated Go source code without escaping, allowing an unauthenticated attacker to inject arbitrary Go code into generated files that are subsequently compiled by the application. The same endpoints also allow path traversal through the PlugName parameter, enabling writes outside the repository root.
Additional issues include:
Arbitrary directory deletion via the removePlugin endpoint due to insufficient validation of pluginName. Stored XSS through unrestricted HTML uploads, which can lead to token theft because authentication cookies are not configured with HttpOnly or Secure attributes. Multiple additional unauthenticated endpoints, including policy reload, LLM proxy access, and error log writing.
These vulnerabilities affect all deployments using the vulnerable versions of gin-vue-admin, especially projects exposing the API to untrusted networks.
Patches
The issues have been fixed in the following releases:
v2.9.3 v3.0.1 (or the first patched 3.x release)
Users should upgrade to one of these versions or any later release.
The fixes include:
Moving the auto-code initialization endpoints behind authentication and Casbin authorization. Properly escaping generated Go source (using safe string quoting instead of direct fmt.Sprintf interpolation). Validating plugin names before any filesystem operations. Preventing path traversal in plugin removal. Restricting uploadable file types and improving upload security. Setting secure cookie attributes where applicable. Workarounds
If upgrading is not immediately possible, administrators should:
Disable or remove the public initMenu, initAPI, and initDictionary routes. Place all auto-code endpoints behind authentication and authorization. Restrict access to the API using firewalls or reverse proxy rules so only trusted administrators can reach these endpoints. Disable the plugin upload feature or reject HTML and other executable file types. Validate plugin names against a strict allowlist before performing filesystem operations. Configure authentication cookies with the HttpOnly and Secure attributes.
These mitigations reduce exposure but do not completely eliminate all affected attack paths. Upgrading is strongly recommended.
Text from GitHub Advisory Database
Affected versions 1
- gin-vue-admin<2.9.2GitHub