Skip to content

Potential DOS of Mobile Applications because of no null check in ImageRequest.java [bug] #2540

@knadt

Description

@knadt

#2501 # Description

I have encountered multiple android applications that crash and sometimes become unusable (Denial of Service) for the user, when the application accepts markdown. to trigger this exploit a malicious user would send command ![Picture Title](file://127.0.0.1/doesnotexist.jpg) to a user in a chat. When the message gets rendered on the users phone the application cashes for and sometimes continues to crash until the exploit is removed. In some applications that allows chats, the chat might open after reopening the application cause a Denial of Service on the valid user. Sometimes it is not possible to remove the malicious markdown. I believe the code south be validated and check for a null value and caught if found.

Reproduction

on line 393 of ImageRequest.java there is a missing null check. By utilizing the below code, the application crashes with the below error.

Uncaught Error: Attempt to invoke virtual method 
'int java.lang.String.lastIndexOf(int)' on a null object reference

Therefore if an application passes user-supplied data to the getSize() method an error will be thrown.

import React from 'react';
const imageSize = Image.getSize('file:',_=>{} );

snack.expo.io source code

The getSize method is not the only part affected. If any React Native call that invokes com.facebook.impagepipeline.request ImageRequest

Solution

Implement a null check here

Additional Information

  • Fresco version: 2.3.0
  • Lastest commit: bd50311
  • Platform version: React Native 0.63

Metadata

Metadata

Assignees

Labels

needs-detailsThis issue or PR is currently not actionable as it misses details (e.g. for reproducing the problem)stale

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions