This is the crAPI challenge solutions page. Go through the challenges page to get an idea about which vulnerabilities exist in crAPI.
It is assumed that the container crapi-web is running in port 8888.
Verify the ports of the container by running the following command : docker ps
- Login to the application from http://localhost:8888/login
- From the Dashboard, choose Add a Vehicle and add the vehicle by providing the VIN and pincode received in Mailhog mailbox after Signup or by reinitiating from Dashboard page.
- After the vehicle details are verified successful, the vehicle will get added and then be populated in the Dashboard page.
- Observe the request sent when we click Refresh Location. It can be seen that the endpoint is in the format
/identity/api/v2/vehicle/<vehicleid>/location
. - Sensitive information like latitude and longitude are provided back in the response for the endpoint. Send the request to Repeater for later purpose.
- Click Community in the navbar to visit http://localhost:8888/forum
- It can be observed that the forum posts are populated based on the response from
/community/api/v2/community/posts/recent
endpoint. On further analysing the response, it can be seen thatvehicleid
is also received back corresponding to the author of each post. - Edit the vehicleid in the request sent to Repeater in Step 5 with the
vehicleid
received from endpoint/community/api/v2/community/posts/recent
. - Upon sending the request, sensitive details like latitude, longitude and full name are received in the response.
The above challenge was completed using Burp Suite Community Edition.
- Login to the application from http://localhost:8888/login
- After adding a vehicle, we will have an option to send service request to mechanic by using the Contact Mechanic option.
- Observe the request sent after the Send Service Request. In the response of
/workshop/api/merchant/contact_mechanic
, we will be able to find the hidden API endpoint inreport_link
. - Go to the link present as value in
report_link
. - Change the value of report_id in the request and send it to access mechanic reports of other users.
- Login to the application from http://localhost:8888/login
- Click Shop in the navbar to visit http://localhost:8888/shop
- There is an initial available balance of $100. Try to order the Seat item for $10 from the shop by using the Buy button and observe the request sent.
- On observing the POST request
/workshop/api/shop/orders
, it can be observed thatcredit
has been reduced by $10 and the current available balance is $90. - With this knowledge, we can try to send the captured POST request
/workshop/api/shop/orders
to Repeater. - Try to change the value of
quantity
in the request body to a negative value and send the request. It can be observed that the available balance has now increased and the order has been placed. - We can verify that the order has been placed by going to the Past Orders section and thus completing the challenge.
The above challenge was completed using Burp Suite Community Edition.
It is recommended to complete Challenge 8 - Get an item for free before attempting this challenge.
- Login to the application from http://localhost:8888/login
- Click Shop in the navbar to visit http://localhost:8888/shop
- There is an initial available balance of $100. Try to order the Seat item for $10 from the shop by using the Buy button and observe the request sent.
- On observing the POST request
/workshop/api/shop/orders
, it can be observed thatcredit
has been reduced by $10 and the current available balance is $90. - With this knowledge, we can try to send the captured POST request
/workshop/api/shop/orders
to Repeater. - Try to change the value of
quantity
in the request body to a negative value and send the request. It can be observed that the available balance has now increased and the order has been placed. - Inorder to increase the balance by $1000 or more, provide an appropriate value in the ‘quantity’ (ie: -100 or less) and send the request. It can be observed that the available balance has now increased by $1000 or more.
The above challenge was completed using Burp Suite Community Edition.
Challenge 11 - Make crAPI send an HTTP call to https://www.google.com and return the HTTP response.
Challenge 13 - Find a way to redeem a coupon that you have already claimed by modifying the database
- JWT Algorithm Confusion Vulnerability
- crAPI uses RS256 JWT Algorithm by default
- Public Key to verify JWT is available at http://localhost:8888/.well-known/jwks.json
- Convert the public key to base64 encoded form and use it as a secret to create a JWT in HS256 Algorithm
- This JWT will be accepted as a valid JWT Token by crAPI
- Invalid Signature Vulnerability
- User Dashboard API is not validating JWT signature
- Create a JWT with
sub
header set to a different user's email - With the above JWT you will be able to extract user data from user dashboard API endpoint
- JKU Misuse Vulnerability
- crAPI will verify JWT token with any public key that is pointed to by the
jku
JWT header - Create your own public/private key pair and sign a JWT in RS256 Algorithm
- Host the public key somewhere in JWK format
- Pass the public key URL in
jku
header of the JWT with appropriatekid
header - This JWT will be accepted as a valid JWT Token by crAPI
- crAPI will verify JWT token with any public key that is pointed to by the
- KID Path Traversal Vulnerability
- Set the
kid
header of JWT to../../../../../../dev/null
- Create a custom JWT in HS256 algorithm with secret as
AA==
AA==
is the Base64 encoded form of Hex null byte00
- This JWT will be accepted as a valid JWT Token by crAPI
- Set the