Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improper Output Neutralization for Logs in the routes go #1

Closed
gtqbhksl opened this issue Aug 19, 2024 · 1 comment · Fixed by #2
Closed

Improper Output Neutralization for Logs in the routes go #1

gtqbhksl opened this issue Aug 19, 2024 · 1 comment · Fixed by #2
Assignees
Labels
bug Something isn't working

Comments

@gtqbhksl
Copy link

	r.NoRoute(func(c *gin.Context) {
		fmt.Printf("%s doesn't exists, redirect on /\n", c.Request.URL.Path)
		c.Redirect(http.StatusMovedPermanently, "/")
	})

Flaw reason: in the internal/app/routes/routes go file of 53 line, using the FMT. Printf to print log, the log content contains the user to provide the value of (c.R equest. URL. The Path). This means that an attacker can execute arbitrary code in the log by controlling the URL path to inject malicious code or special characters
Or cause other security risks. This is known as a log injection attack.

Vulnerability POC: An attacker can attempt to inject malicious code into the log by including a specific string or snippet of code in the URL path. For example, if an application does not properly handle or escape special characters in a URL path, an attacker could exploit this vulnerability to execute arbitrary code or leak sensitive information.

@dengmengmian dengmengmian self-assigned this Aug 20, 2024
@dengmengmian dengmengmian added bug Something isn't working wontfix This will not be worked on and removed wontfix This will not be worked on labels Aug 20, 2024
@dengmengmian
Copy link
Member

Thank you for bringing this to our attention. We have addressed the issue with the NoRoute handler in our Gin application. The vulnerability related to log injection has been fixed. We have updated our logging mechanism to properly escape any special characters and user-provided values to prevent arbitrary code execution or sensitive information leakage in the logs. We appreciate your efforts in helping us maintain a secure application.

@dengmengmian dengmengmian linked a pull request Aug 20, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants