Closed Bug 1761407 Opened 4 years ago Closed 4 years ago

Idor in Image Upload in support.mozilla.org

Categories

(support.mozilla.org :: General, defect)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: roldanbrandon62, Assigned: rjohnson)

References

()

Details

(Keywords: reporter-external, sec-low, wsec-objref, Whiteboard: [reporter-external] [web-bounty-form] [verif?])

Hi. While auditing the code of support.mozilla.org, i found this endpoint

    re_path(
        r"^/image/(?P<model_name>\w+\.\w+)/(?P<object_pk>\d+)$",
        views.up_image_async,
        name="upload.up_image_async",
    ),

This is the up_image_async function

def up_image_async(request, model_name, object_pk):
    """Upload all images in request.FILES."""

    # Verify the model agaist our white-list
    if model_name not in ALLOWED_MODELS:
        message = _("Model not allowed.")
        return HttpResponseBadRequest(json.dumps({"status": "error", "message": message}))

    # Get the model
    m = apps.get_model(*model_name.split("."))

    # Then look up the object by pk
    try:
        obj = m.objects.get(pk=object_pk)
    except ObjectDoesNotExist:
        message = _("Object does not exist.")
        return HttpResponseNotFound(json.dumps({"status": "error", "message": message}))

    try:
        file_info = upload_imageattachment(request, obj)
    except FileTooLargeError as e:
        return HttpResponseBadRequest(json.dumps({"status": "error", "message": e.args[0]}))

    if hasattr(obj, "clear_cached_images"):
        # if the object the image is attached to has a `clear_cached_images` method,
        # like questions and answers do, call it
        obj.clear_cached_images()

    if isinstance(file_info, dict) and "thumbnail_url" in file_info:
        return HttpResponse(json.dumps({"status": "success", "file": file_info}))

    message = _("Invalid or no image received.")
    return HttpResponseBadRequest(
        json.dumps({"status": "error", "message": message, "errors": file_info})
    )

Here, it get the object, with the model we provided, based on its pk in the object_pk argument. The model could be either of these three "questions.Question", "questions.Answer", "auth.User". and call the upload_imageattachment function on the target object.

Since one of the model is auth.User, we can change the image of other users. There are also models like questions.Question and questions.Answer but cant test it since the site is down

Flags: sec-bounty?

I have tested it now and i am wrong in the auth.User object. I am not sure how it works, but the questions.Question and questions.Answer allows us to add an image on anyone's question or answer

Hello,

Thank you for your report.

The team are working on fixing the staging instance. It is still down for me.

I was reading the code when you sent the latest comment.

Do you mean that users can upload an attachment to another user already posted question? or can they upload attachment in a new reply?

Thanks,
Frida

Hello, i mean users can upload an attachment on other users already posted question/answer

Can you please provide steps to reproduce? I can try this when the staging instance is fixed.

Thanks,
Frida

Sure

STEPS TO REPRODUCE

  1. Have two accounts, we will call these two users as user a and user b
  2. As user , make a question
  3. As user b, go to https://support.mozilla.org/en-US/questions/new/ios/form
  4. Upload an image to simulate a image upload request, and intercept it
  5. The endpoint will look like /en-US/upload/image/auth.User/<USERID>, replace it with /en-US/upload/image/questions.Question/<QUESTIONID>, replace QUESTIONID with the id of the question from step 2.
  6. You will see that there is now an image attached to the question of user a

The site seems to be up and running now, will try to reproduce it and also take a video poc about it in a moment

Status: UNCONFIRMED → NEW
Type: task → defect
Component: Other → General
Ever confirmed: true
Product: Websites → support.mozilla.org

Hello,

I was able to reproduce the issue using a POST request to /en-US/upload/image/questions.Question/<question_id> endpoint.

Thanks,
Frida

Cool, thank you

Keywords: wsec-objref

Hi. Any updates on this and all my other reports? It has been 20 days now. Thanks

The engineering team are working through the reported issues, we will update the bugs when we have more information.

Hello Tasos,

Can you please check this issue as well?

Thanks,
Frida

Flags: needinfo?(tasos)

Hi. The lack of action in this report is alarming. Any updates?

Hello Brandon,

I discussed the reports that are open with Tasos and he is addressing them based on priority and severity. We appreciate your patience so far.

Thanks,
Frida

Hello Brandon,

Please refer to my previous comment 13. The SUMO team are doing their best to address security issues, we receive reports from various sources and we prioritize the fixes based on severity.

Please refer to our participation guidelines regarding commenting on bugs, https://bugzilla.mozilla.org/page.cgi?id=etiquette.html.

Thanks,
Frida

Hello, any updates? we are halfway through 4 months now. Also, can i disclose this bug? According to the faq page in https://www.mozilla.org/en-US/security/bug-bounty/faq-webapp/

Bug reporters may open the bug to public view earlier whenever circumstances warrant it (e.g., if you feel your bug report is being completely ignored). However, in the interests of protecting our users, we would appreciate a reasonable amount of time to address the issue before the information is publicly disclosed.

I think 3 months is a reasonable amount of time. At least, that is the average time it took companies to fix bugs.

we prefer to disclose bugs after they are fixed so that we protect our users. The bug is not ignored, we are tracking it internally and the team are addressing the security bugs based on their severity. Based on our policy, medium severity issues have a typical SLA of 6 months and low severity issues are added to the backlog without a specific deadline.

Is there a particular reason why you want to disclose the bug?

Thanks,
Frida

Ryan could you take a look?

Flags: needinfo?(tasos) → needinfo?(rjohnson)

I thought this bug is ignored. It is common in the bug hunting community to let people know bugs that are ignored, to raise awareness instead of malicious people finding the bug, and exploiting it for their own gain. Im glad this bug is not ignored yet

For sure, I'll take a look!

Flags: needinfo?(rjohnson)
Assignee: nobody → rjohnson

Released to prod

Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED

Awesome

Hi. Any updates on the bounty?

Now that the issue is fixed, the bug bounty team will be reviewing your report over the upcoming weeks to make a determination of what if any award Mozilla will be granting for this report. It may take up to 3 weeks but know that we have not forgotten this ticket, we have a tracking system and a review cadence that will ensure that all potentially bounty eligible reports get reviewed and acted on

Flags: sec-bounty? → sec-bounty+

Hello everyone. I am a little disappointed with the bounty amount. Isnt 500$ a little low for this bug? I waited 3 months for this bug and i only got 500$. Also, according to the bounty table, IDOR on core site is around 3000$, 500$ is very far from 3000$. Now lets say 3000$ is the highest you can get with idors, if we plugin this bug in the cvss calculator, that would be around 5.3 (Medium) with CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N . The highest you can get with the cvss calculator is 10, and 5.3 is around half of it, so a fair bounty for this bug should be around 1500$. On my previous idor report, with the same cvss score, i got what we expected which is 1500$ in 1754966 . Please take the chance to reconsider the bounty amount on this bug.

Thanks

Alternatively, we can push the Integrity in the cvss calculator to since this doesnt require user interaction/we can upload files on any/all posts we want, and we can get a cvss score of 7.5 (High). But, we can also settle with the 5.3 (Medium) too.

Keywords: sec-low

This doesn't fall under what we meant by IDOR. This is effectively site vandalism, but technically a missing authorization check. We already have to deal with spammed images, so at scale this let's you hide the account of the spammer by spreading the blame. In a more targeted way an inserted image could be used to attack the reputation of the victim's account, but of course that would be public (reputation attacks have to be by nature) and would get investigated and cleared. The impact seemed minimal. Bug 1754966 is similar, but we judged the impact as "moderate" because missing images would be initially less likely to be noticed, and more work to restore (would have to dig into back-ups).

Group: websites-security
You need to log in before you can comment on or make changes to this bug.