Skip to content

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

Open
@ZuhairORZaki

Description

@ZuhairORZaki

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions