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

Bug: Accessible Swagger Path without Required API Key #37

Open
yusufmeteyilmaz opened this issue May 25, 2023 · 1 comment
Open

Bug: Accessible Swagger Path without Required API Key #37

yusufmeteyilmaz opened this issue May 25, 2023 · 1 comment

Comments

@yusufmeteyilmaz
Copy link

Description:

The current implementation of the API authorization logic checks for the presence of the exact word "swagger" in the request path to determine if an API key is required. However, this check can be easily bypassed by altering the capitalization of the word. For example, accessing "/Swagger/index.html" instead of "/swagger/index.html" allows unauthorized access without providing the required API key.

Example:

Steps to reproduce:

  1. Attempt to access "https://backend.gonullu.io/swagger/index.html" without providing an API key.
  2. You will notice that access is denied, indicating that the API key is required.
  3. Access "https://backend.gonullu.io/Swagger/index.html" (note the altered capitalization).
  4. Observe that access is granted without requiring an API key.

Impact:

Although the current vulnerability may not pose a significant security risk right now, it has the potential to cause future issues if an important file or resource is exposed within the "/swagger/" directory. This could allow unauthorized individuals to access sensitive information or exploit the exposed resources for malicious purposes.

Vulnerable code part:

if strings.Contains(ctx.Path(), "pprof") || strings.Contains(ctx.Path(), "swagger") || restrictedMethod {
			apiKeyNeeded = true
		}

Link: https://github.com/acikkaynak/musahit-harita-backend/blob/3e109cfb09da43b858c62f91fb282ef89fcdcc94/middleware/auth/auth.go
Line: 25

@9ssi7
Copy link
Contributor

9ssi7 commented May 27, 2023

I'm working on it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants