aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBaptiste Jonglez <git@bitsofnetworks.org>2020-07-17 17:43:33 +0200
committerzorun <github@bitsofnetworks.org>2020-07-26 19:21:16 +0200
commit8d77cf5d5646e1d2d8ded13f0660638f57e98471 (patch)
tree10de6ca2868d3e14c6038080cb9959422313f89e
parent040d76af83411fb58ab400dc4eac909191a3e5fa (diff)
downloadihatemoney-mirror-8d77cf5d5646e1d2d8ded13f0660638f57e98471.zip
ihatemoney-mirror-8d77cf5d5646e1d2d8ded13f0660638f57e98471.tar.gz
ihatemoney-mirror-8d77cf5d5646e1d2d8ded13f0660638f57e98471.tar.bz2
Fix unauthorized access and modification of project data (CVE-2020-15120)
An authenticated member of one project can modify and delete members of another project, without knowledge of this other project's private code. This can be further exploited to access all bills of another project without knowledge of this other project's private code. With the default configuration, anybody is allowed to create a new project. An attacker can create a new project and then use it to become authenticated and exploit this flaw. As such, the exposure is similar to an unauthenticated attack, because it is trivial to become authenticated. This issue was caused by a wrong database queries in PersonQuery. For more details, see https://github.com/spiral-project/ihatemoney/security/advisories/GHSA-67j9-c52g-w2q9
-rw-r--r--ihatemoney/models.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/ihatemoney/models.py b/ihatemoney/models.py
index fe7b519..5691c75 100644
--- a/ihatemoney/models.py
+++ b/ihatemoney/models.py
@@ -380,7 +380,7 @@ class Person(db.Model):
def get_by_name(self, name, project):
return (
Person.query.filter(Person.name == name)
- .filter(Project.id == project.id)
+ .filter(Person.project_id == project.id)
.one()
)
@@ -389,7 +389,7 @@ class Person(db.Model):
project = g.project
return (
Person.query.filter(Person.id == id)
- .filter(Project.id == project.id)
+ .filter(Person.project_id == project.id)
.one()
)