Skip to content

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

@camsim99

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.

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