ImpressCMS / impresscms

A multilingual, extensible, community oriented CMS developed in PHP
https://www.impresscms.org
Other
27 stars 35 forks source link

Patch to fix IDOR vulnerability in userinfo.php #1541

Open emilylwan opened 10 months ago

emilylwan commented 10 months ago

This PR prevents the existing IDOR vulnerability at the endpoint userinfo.php/?uid=. Currently hackers are able to gain access to profiles by manipulating the uid field in the url to retrieve any profile in the database. We prevent that by changing what is received in the url.

Changes were made to the database structure, the user object, and the redirect urls to userinfo.php to support implementing a new hash_uid variable. The hash_uid variable is a randomly generated 64 character long hex string. It is saved into the databases and replaces the uid that is shown in the url of the userinfo.php page to prevent users from gaining access to another user’s profile through guessing the uid and crafting the url. This hash_uid is also used to verify if a current user is the same as the profile user to enable editing access. It also retrieves the user’s profile. These changes help remove the IDOR vulnerability at the endpoint userinfo.php/?uid= by crafting the uid in the url.

skenow commented 9 months ago

I should have said this earlier - thank you!

You have done what we encourage everyone to do -

  1. See something that could be improved
  2. Do something about it - not just for yourself, but for everyone

Another thing that makes this important is that you focused on improving security and protecting user data. That is something we are very committed to.

This is not a small thing, and we'd like more time to review on how best to assimilate this into our code base. We are in a release cycle and this is the branch we use for packaging and releasing.

ImpressCMS is a very user-driven platform and just about everything is linked to a user through their ID. To maintain data integrity, we have to exercise due diligence when changing a key field (a primary, in most cases). Some of the questions we have are about handling changes to existing installations, especially the database changes necessary. Once the release of 2.0 is out, we'll have more time to focus on this.

Again - thank you!