Summary
Authorization Bypass in I hate money
Workarounds
To limit the impact, it is possible to disable public project creation by setting ALLOW_PUBLIC_PROJECT_CREATION = False in the configuration (see documentation). Existing users will still be able to exploit the flaw, but this will prevent an external attacker from creating a new project.
For more information
Person.query.get() and Person.query.get_by_name() were mistakenly running a database join on the Project table without constraining the result.
As a result, Person.query.get(42, "projectfoo") would return the Person with id=42, even if it is not associated to the project "projectfoo". The only condition is that "projectfoo" must exist.
This flaw can be exploited in several places:
API: PUT requests to
/api/projects/<project>/members/<personID>will succeed even though<personID>is not a member of<project>.This allows an authenticated attacker to alter the state of a member (name, weight, activated) in any project. In addition, the altered member will no longer be associated with its original project but will be associated to the attacker project instead, breaking many features of IHateMoney. For instance, bills referencing the altered member will no longer be visible in the original project.
This causes an additional information disclosure and loss of integrity on bills: the attacker will now be able to see, edit and delete bills belonging to the altered member, because IHateMoney now believes that these bills are associated to the attacker project through the altered member.
For instance, assume that
Person(id=42)is a member of project "targetProject", and that the attacker has access to another project "attackerProject" with the private code "attackerPassword". The attacker can modifyPerson(id=42)with this command:$ curl -X PUT -d "name=Pwn3d&activated=1" --basic -u attackerProject:attackerPassword http://$SERVER/api/projects/attackerProject/members/42
The attacker can now see, edit and delete bills paid by
Person(id=42)by simply browsing to http://$SERVER/attackerProject/Editing a member through the web interface at
/<project>/members/<personID>/editwill succeed even though<personID>is not a member of<project>.This is very similar to the PUT exploit. Reusing the same example, the attacker needs to login to its "attackerProject" project with the private code "attackerPassword". It can then alter the state of
Person(id=42)by accessing the edit form at the following URL:http://$SERVER/attackerProject/members/42/edit
Again, as a result of the alteration, the altered member will become associated to the project "attackerProject", resulting in the same information disclosure and loss of integrity on bills.
API: DELETE requests to
/api/projects/<project>/members/<personID>will similarly allow to delete the member<personID>even if it belongs to a different project than<project>.$ curl -X DELETE --basic -u attackerProject:attackerPassword http://$SERVER/api/projects/attackerProject/members/42
The impact is less serious than with PUT, because DELETE only deactivates a member (it does not really delete it).
All these exploits require authentication: an attacker needs to know a valid project name and its associated "private code". Once this requirement is fullfilled, the attacker can exploit this flaw to alter the state of members in any other project, without needing to know the target project name or its private code.
Person.query.get_by_name() suffers from the same issue as Person.query.get(). It has an additional issue: if multiple Person objects with the same name exist (this is possible if they are associated to different projects), get_by_name() will crash with MultipleResultsFound because of the call to one().
However, since Person.query.get_by_name() is currently not used anywhere in IHateMoney, the bug affecting this function has no impact and is not exploitable.
Impact
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.
The application does not correctly enforce access controls, allowing a principal to access resources or operations beyond their granted permissions. Typical impact: unauthorized data access or execution of privileged operations.
CVE-2020-15120 has a CVSS score of 4.9 (Medium). The vector is network-reachable, high privileges required, and no user interaction. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (4.1.5); upgrading removes the vulnerable code path.
Affected versions
Security releases
Kodem intelligence
Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.
Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.
Already deployed Kodem?
See it in your environmentNew to Kodem? Get a demo →Remediation advice
ihatemoney/models.py | 4 ++--
1 file 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()
)
Frequently Asked Questions
- What is CVE-2020-15120? CVE-2020-15120 is a medium-severity incorrect authorization vulnerability in ihatemoney (pip), affecting versions < 4.1.5. It is fixed in 4.1.5. The application does not correctly enforce access controls, allowing a principal to access resources or operations beyond their granted permissions.
- How severe is CVE-2020-15120? CVE-2020-15120 has a CVSS score of 4.9 (Medium). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
- Which versions of ihatemoney are affected by CVE-2020-15120? ihatemoney (pip) versions < 4.1.5 is affected.
- Is there a fix for CVE-2020-15120? Yes. CVE-2020-15120 is fixed in 4.1.5. Upgrade to this version or later.
- Is CVE-2020-15120 exploitable, and should I be worried? Whether CVE-2020-15120 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
- What actually determines whether CVE-2020-15120 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
- How do I fix CVE-2020-15120? Upgrade
ihatemoneyto 4.1.5 or later.