Spot the bug
This exported Activity has a serious bug. Which line?
class ShareActivity : android.app.Activity() {override fun onCreate(savedInstanceState: android.os.Bundle?) {super.onCreate(savedInstanceState)val next = intent.getParcelableExtra("next", android.content.Intent::class.java)if (next != null) startActivity(next)finish()}}
Hint 1 of 1
Who controls the extras of an exported Activity?
Choose an answer, then open Show answer below to check it.
Show answer
- Answer: line 5
if (next != null) startActivity(next)
Line 5 launches an intent supplied by another app with this app's identity. An attacker could use it to open your private, non-exported Activities. Validate the target or don't forward intents at all.