I wish I were familiar with stuffs you used for back end, then could read and understand code to find out potential errors, security issues, etc. to report in more details.
But the bugs I found so far
First it’s about the createpoll gateway, as I checked the calls, this gateway accepts a JSON as input/parameter as following:
{
"question": "ABC",
"options": [{
"optionBody": "A",
"votes": 0
}, {
"optionBody": "B",
"votes": 0
}, {
"optionBody": "C",
"votes": 0
}, {
"optionBody": "ABC",
"votes": 0
}]
}
I just could override the votes value with something like 2000 and perform the query(check this), I’m not sure if it’s a bug! but if poll should starts from zero, you may not accept default poll state.
Same I could create a poll without any items (options:[]), you may confirm using this link
I then created another account(sample1), and created a poll(5b3cb7bbc9fbe50004665d59)
now another bad security bug
I could remove the poll I created with sample1 account, using another account(sample
) by invoking the deletepoll
and pass the id of poll sampl1 created. This is bad.
Now bugs about the updatePolls
The first thing I could do, is updating a pool state. let say a poll has 2000 votes for each index, it’s possible to override it by the bug exist in updatePolls
The bug is, instead you ask the server to add one to X index of Y poll, you just ask to update the poll state! This is not logical, please fix.
The bug let me to perform something like following:
{
"voteNumbers": 0,
"type": "public",
"_id": "<<target id>>",
"options": [{
"_id": "<<index id 0>>",
"optionBody": "A",
"votes": 29
}, {
"_id": "<<index id 1>>",
"optionBody": "B",
"votes": 29
}, {
"_id": "<<index id 2>>",
"optionBody": "C",
"votes": 29
}, {
"_id": "<<index id 3>>",
"optionBody": "ABC",
"votes": 29
}],
"question": "ABC",
"createdBy": "sample",
"postTime": "2018-07-04T11:52:14.694Z",
"__v": 0
}
I just could override the index labels using optionBody
.
It seems your server just accept the JSOn from client, and just push it on backend database? no any checking on input data? No any check about permission? This is a very bad practice pal, please change your way coding the backend!
I won’t go more in detail since I just realized the server comes with lack of data checking, but my last check was about performing a bad-format data to check if it fails or not, so I just performed a bad request as following:
{
"voteNumbers": 0,
"type": "public",
"_id": "<<target id>>",
"options": [{
"_id": "<<index id 0>>",
"optionBody": "A",
"votes": 2362463463473464327457436378458658634634782356232346
}, {
"_id": "<<index id 1>>",
"optionBody": "B",
"votes": 29
}, {
"_id": "<<index id 2>>",
"optionBody": "C",
"votes": "BAD_DATA"
}, {
"_id": "<<index id 3>>",
"optionBody": "ABC",
"votes": 29
}],
"question": "ABC",
"createdBy": "sample",
"postTime": "2018-07-04T11:52:14.694Z",
"__v": 0
}
please considering the BAD_DATA
which is not a valid, or a the first vote number value which is very huge, hopefully, both could not make crash for server.
I suggest you take the security issues really serious, just one script could make serious issues for you, and it may not happen first the first day you deploy, but it could be happened 2 year later where you have dedicated and important data, so that will be real trouble for you.
Keep goin on great work, happy programming.