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

Potential Log Injection in file app/api/auth.py #9120

Open
ZuhairORZaki opened this issue Feb 26, 2024 · 3 comments
Open

Potential Log Injection in file app/api/auth.py #9120

ZuhairORZaki opened this issue Feb 26, 2024 · 3 comments

Comments

@ZuhairORZaki
Copy link

Reporting a vulnerability found by iCR

While triaging your project, our bug fixing tool generated the following message:

In file: auth.py, there is a method that stores user-provided data into logs without validating the data. This allows an attacker to corrupt the log file structure.

--- app/api/auth.py

+++ app/api/auth.py

@@ -320,6 +320,17 @@

     try:

         user = User.query.filter_by(email=email).one()

     except NoResultFound:

+        '''

+        ***************** OpenRefactory Warning *****************

+        Possible Log injection!

+        Path:

+        	File: auth.py, Line: 315

+        		email = request.json['data']['email']

+        		Variable email is assigned a tainted value.

+        	File: auth.py, Line: 323

+        		logging.info('User with email: ' + email + ' not found.')

+        		Tainted information is used in a sink.

+        '''

         logging.info('User with email: ' + email + ' not found.')

         raise UnprocessableEntityError(

             {'source': ''}, 'User with email: ' + email + ' not found.'

The method resend_verification_email handles POST requests sent to path /resend-verification-email. It reads the email field of request JSON data and includes it in a log message without validating. So it's possible to inject false log entries by assigning email values containing inappropriate characters e.g. \n. If this logged data is used for later analysis this could be a problem.

CLA Requirements:

This section is only relevant if your project requires contributors to sign a Contributor License Agreement (CLA) for external contributions.

All contributed commits are already automatically signed off.

The meaning of a signoff depends on the project, but it typically certifies that committer has the rights to submit this work under the same license and agrees to a Developer Certificate of Origin (see https://developercertificate.org/ for more information).

Sponsorship and Support:

This work is done by the security researchers from OpenRefactory and is supported by the Open Source Security Foundation (OpenSSF): Project Alpha-Omega. Alpha-Omega is a project partnering with open source software project maintainers to systematically find new, as-yet-undiscovered vulnerabilities in open source code - and get them fixed - to improve global software supply chain security.

The bug is found by running the iCR tool by OpenRefactory, Inc. and then manually triaging the results.

@mdehsan873
Copy link

@ZuhairORZaki Could you please assign me this task

Copy link

github-actions bot commented Mar 5, 2024

We don't assign issues to external contributors. Please comment that you're working on the issue after checking that no one else is, and then send a pull request for it. Thank You!

@ZuhairORZaki
Copy link
Author

Hi @mdehsan873
I can't assign but if you would like to work on this issue then please feel free to do so.

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

Successfully merging a pull request may close this issue.

2 participants