Beego is a popular open-source, high-performance web framework for the Go programming language. Recently, a vulnerability numbered as CVE-2022-31259 has been discovered in the route lookup process of Beego versions 1.12.4 and 2.x through 2..2. This flaw allows potential attackers to bypass access controls to exploit the system. In this post, we will delve into the details of this vulnerability, including the code snippet, links to original references, and exploit specifics.

Vulnerability Details

The vulnerability lies in the route lookup process of Beego, where certain URLs don't get processed as expected. If a route is configured with "/p1/p2/:name," attackers can easily bypass access control by appending ".xml" in various parts of the URL (e.g., p1.xml instead of p1). By exploiting this weakness, they can gain unauthorized access to sensitive information and functionalities within the application.

Given the vulnerable route configuration

    beego.Router("/p1/p2/:name", &controllers.MainController{})

Attackers can use different URLs to exploit this vulnerability. For example, they can change the URL from to:

By doing so, they would bypass the intended access control in place and gain unauthorized access to the targeted route.

Original References

1. The original discussion about the vulnerability can be found on Beego's GitHub page, where developers have reported it and shared their insights:

2. The detailed report and analysis of the vulnerability, as well as a full list of affected versions, are provided by the researchers at the National Vulnerability Database:

3. More information about Beego, its features, and the latest updates can be found on the official website:


To fix this vulnerability, it is recommended to update the affected versions of Beego to the latest patched version. The developers have released the following updates to address this issue:

- Beego v1.12.5 and above for 1.x release:
- Beego v2..3 and above for 2.x release:

Users and operators are encouraged to upgrade their Beego installations as soon as possible to prevent unauthorized access and potential exploitation due to this vulnerability.


CVE-2022-31259 is a critical vulnerability that allows attackers to bypass access control in the Beego route lookup process. By understanding the nature of this exploit, developers can take preventive measures to ensure the security and integrity of their applications. Upgrading to the latest patched version of Beego is the recommended solution to protect against this vulnerability and maintain a secure environment.


Published on: 05/21/2022 19:15:00 UTC
Last modified on: 06/02/2022 19:02:00 UTC