fossasia / open-event-server

The Open Event Organizer Server to Manage Events https://test-api.eventyay.com
https://api.eventyay.com
GNU General Public License v3.0
2.96k stars 1.89k forks source link

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

Open ZuhairORZaki opened 6 months ago

ZuhairORZaki commented 6 months ago

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 commented 6 months ago

@ZuhairORZaki Could you please assign me this task

github-actions[bot] commented 6 months ago

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 commented 6 months ago

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