{"id":1042,"cve":"CVE-2024-32879","cve_url":"https:\/\/www.cvedetails.com\/cve\/CVE-2024-32879\/","cwe":"CWE-178","cwe_number":178,"cwe_url":"https:\/\/cwe.mitre.org\/data\/definitions\/178","cvss_score":4.9,"published":"2024-04-24","owasp":"A07 Identification and Authentication Failures","odc":"Function","cdc":"Incorrect Functionality","category":"Authentication, Authorization, and Session Management","subcategory":"Insecure Authentication Mechanisms","scope":"Remote","impact":"Unauthorized Access","summary":"Case-insensitive user IDs in Python Social Auth could cause mismatches.","permalink":"https:\/\/netpack.pt\/vaitp\/vulnerability\/CVE-2024-32879\/","description":"Python Social Auth is a social authentication\/registration mechanism. Prior to version 5.4.1, due to default case-insensitive collation in MySQL or MariaDB databases, third-party authentication user IDs are not case-sensitive and could cause different IDs to match. This issue has been addressed by a fix released in version 5.4.1. An immediate workaround would be to change collation of the affected field.","solution":"Upgrade to Python Social Auth version 5.4.1 or later.","affected_component":"Python Social Auth","fixed_by_upgrading":true,"vulnerable_code":"from social_core.backends.google import GoogleOAuth2\n\nclass CustomGoogleOAuth2(GoogleOAuth2):\n    def get_user_details(self, response):\n        user_id = response['id'].lower()\n        email = response['email']\n        return {'username': user_id, 'email': email}\n\nAUTHENTICATION_BACKENDS = (\n    'path.to.CustomGoogleOAuth2'\n)","patched_code":"from social_core.backends.google import GoogleOAuth2\nimport re\n\nclass CustomGoogleOAuth2(GoogleOAuth2):\n    def get_user_details(self, response):\n        user_id = response.get('id', '').strip().lower()\n        email = response.get('email', '').strip()\n\n        if not user_id or not email:\n            raise ValueError(\"Missing required user information from Google response\")\n\n        if not re.match(r\"[^@]+@[^@]+\\.[^@]+\", email):\n            raise ValueError(\"Invalid email format\")\n\n        return {'username': user_id, 'email': email}\n\nAUTHENTICATION_BACKENDS = (\n    'path.to.CustomGoogleOAuth2',\n)\n","payload_needed":true,"payload":"```json\n{\n  \"id\": \"exampleUser \",\n  \"email\": \"user@example.com\"\n}\n```","payload_status":"available","published_fix":[{"repository":"python-social-auth\/social-app-django","commit_url":"https:\/\/github.com\/python-social-auth\/social-app-django\/commit\/31c3e0c7edb187004d8abbde7e9c4f7ef9098138","commit_subject":"models: make sure uid is compared case-sensitive","units":[{"file":"social_django\/models.py","function":"AbstractUserSocialAuth.get_social_auth"}]}],"references":null}