Skip to content

[Android] Remove the ability to set engine shell arguments via Intent extras #180686

Closed

Description

@camsim99

As part of the work we are doing to better secure FlutterActivity and FlutterFragment against attacks via setting engine flags via Intent extras, we are removing the ability to set engine flags on Android via Intents entirely. See below for details.

The problem this solves

As described in #172553, malicious actors can take advantage of the Intent extras mechanism for setting engine flags on Android by using flag vulnerabilities to run malicious code. For example, attackers could specify a malicious path for the --aot-shared-library-name= flag that allows for the running of native C code; see go/flutter-fragment-flag-security-analysis for analysis of this specific case. Though not all engine flags are open to this vulnerability, this design pattern is dangerous and gives leeway to security vulnerabilities to Flutter Android apps, especially those in release mode (production).

The solution

In order to combat this, we are removing support for setting flags via Intents entirely, which means that flags can no longer be set dynamically. Instead, Flutter developers will have to used one of the following more secure mechanisms:

  • Statically in the manifest (AndroidManifest.xml)
  • Via the command line

Steps involved in removing Intent support

Outstanding concerns

We recognize that adding the ability to set engine flags via the manifest may add additional startup time to apps due to the newly introduced parsing of the manifest, but ultimately, we think that the security benefit of preventing attacks via running arbitrary code outweigh that extra startup time.

Part of #172553.

Activity

  1. self-assigned this
    on Jan 8, 2026
  2. added
    platform-androidAndroid applications specifically
    toolAffects the "flutter" command-line tool. See also t: labels.
    engineflutter/engine related. See also e: labels.
    P1High-priority issues at the top of the work list
    team-androidOwned by Android platform team
    triaged-androidTriaged by Android platform team
    on Jan 8, 2026
  3. camsim99 commented on Feb 5, 2026

    @camsim99
    ContributorAuthor

    Discussed this offline but wanted to paste here an opposing argument to this work in debug mode so we remember why the decision to move forward with work on this issue:

    Opposing argument to doing this in debug mode

    We should allow arguments to be set via Intent in debug mode because otherwise, we are breaking the debug workflow using ADB of installing a pre-built APK to a device for testing over and over while changing the flags but not rebuilding the APK itself (which flutter run requires).

    Why I think we should also do this in debug mode

    I am concerned about breaking the workflow but given this same workflow can be done using flutter run --use-application-binary=<path/to/app.apk>, I would only be ok breaking it if the workflow is not common. This is because otherwise, we would have to leave the path of setting flags via Intents in the code which is definitively less secure than take it out completely as I planned.

    Ultimately, I’m deciding to move forward with removing the Intent path entirely because I do not see proof that this workflow is common. I took a chance to go through all issues mentioning the launching Flutter apps via ADB workflow and did some Google searching, and I found that the primary use case by far for the workflow is testing deep links, which my work really would not impact.

  4. camsim99 commented on Aug 3, 2026

    @camsim99
    ContributorAuthor

    Closing in favor of #190461. See that issues for details on the pivot!

  5. github-actions commented on Aug 17, 2026

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  6. locked as resolved and limited conversation to collaborators on Aug 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P1High-priority issues at the top of the work listengineflutter/engine related. See also e: labels.platform-androidAndroid applications specificallyteam-androidOwned by Android platform teamtoolAffects the "flutter" command-line tool. See also t: labels.triaged-androidTriaged by Android platform team

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions