passman
1 - Challenge code and Descripton
We ae given the project files including backeng js, dockerfile, database queries and ...
- First of all this is DB tables
saved_passwords
table which is for admin user
- We also have graphql in backend which do login,register,save password, ...
Here is register request
And here is the backed graphql section for registration which is Graphql Mutation
Here is login request
And here is the backend graphql code which is also a Graphql Mutation
2 - Solution
- After logging in a JWT is assigned to us which indicates our user.
- Our goal is to get flag which is inside saved_passwords database inside admin notes
- Each user can see his/her only notes not others according to this code which is a
Graphql Query
So we as a non-admin user can not see admins notes which is flag. There are also two other
Graphql Mutations`
AddPhrase : which is for adding note
UpdatePassword: which is for changing password for a user
The UpdatePassword
Mutation looks interesting and as we can see there is no proper authentication to prevent nonadmin users to change other users' password\
Let's look at the UpdatePassword Mutation
schema through graphql introspection query
And here is the UpdatePassword
Mutation
We can see we need two parameters (username,password) which we can change every user's password without proper authorization.\ Here is the graphql query for updating admin's password (I built it based on login mutation which is similar to UpdatePassword)
And here is the response:
It seems we changed admin's password, Let's check it\ Yes, we logged in as admin and now we can see admin's notes inside saved_password table which is actually the flag
And here is the flag:
Authors - Kourosh Rajabzadeh