Java Unsafe Local File Access
Description
Detects when Android WebView implementations are configured to allow unsafe access to local files on the device filesystem. This creates a security risk where malicious web content loaded in the WebView could potentially access sensitive local files or exploit file-based vulnerabilities.
Detection Strategy
• Check if Android WebView is imported in the source code
• Look for WebView configuration method calls that control file access (like setAllowFileAccess)
• Verify if these methods are called with parameters that enable unrestricted file access
• Flag cases where file access is enabled without proper restrictions or security checks
Vulnerable code example
import android.webkit.WebView;
import android.webkit.WebSettings;
public class VulnerableWebView {
public void configureWebView() {
WebView webView = new WebView(context);
WebSettings settings = webView.getSettings();
...✅ Secure code example
import android.webkit.WebView;
import android.webkit.WebSettings;
public class SecureWebView {
public void configureWebView() {
WebView webView = new WebView(context);
WebSettings settings = webView.getSettings();
...Search for vulnerabilities in your apps for free with Fluid Attacks' automated security testing! Start your 21-day free trial and discover the benefits of the Continuous Hacking Essential plan. If you prefer the Advanced plan, which includes the expertise of Fluid Attacks' hacking team, fill out this contact form.