bytedance / appshark

Appshark is a static taint analysis platform to scan vulnerabilities in an Android app.
Apache License 2.0
1.49k stars 165 forks source link

不支持ARouter路由框架导致断链 #73

Open firmianay opened 6 months ago

firmianay commented 6 months ago

是在一个漏洞案例里发现的,任意URL加载,即导出组件从外部获取Intent,并传入loadUrl()

攻击链:LoginActivity(导出) -> HomeActivity(非导出) -> ARouter(跳转) -> DemoWebActivity(非导出)

private void jumpByRouters(String url) {
      DemoWebBuilder.from()
              .setWebUrl(url)
              .start();
public DemoWebBuilder setWebUrl(String mWebUrl) {
    mBundle.putString(WebViewConst.BUNDLE_KEY.WEB_URL, mWebUrl);
    return this;
}

public void start() {
    if (mBundle != null) {
          ARouter.getInstance().build(WebViewConst.ROUTER_KEY.WEB_ACTIVITY).withTransition(R.anim.fade_in,
              R.anim.fade_out).with(mBundle).navigation();
    }
}

没办法通过路由WebViewConst.ROUTER_KEY.WEB_ACTIVITY进行关联,导致断链:

@Route(path = WebViewConst.ROUTER_KEY.WEB_ACTIVITY)
public class DemoWebActivity extends SimpleActivity implements WebHandlerDelegate.WebJsBridgeListener, WebEventBusDelegate.WebEventListener {
    private void initView() {
        mUrl = getIntent().getStringExtra(WebViewConst.BUNDLE_KEY.WEB_URL);
        loadUrl(mUrl);
    }
nkbai commented 6 months ago

跨activity怎么关联呢?这个一直没有好办法,可以一起讨论一下。

@Route(path = WebViewConst.ROUTER_KEY.WEB_ACTIVITY)
public class DemoWebActivity extends SimpleActivity implements WebHandlerDelegate.WebJsBridgeListener, WebEventBusDelegate.WebEventListener {
    private void initView() {
        mUrl = getIntent().getStringExtra(WebViewConst.BUNDLE_KEY.WEB_URL);
        loadUrl(mUrl);
    }

就看这个片段,这个不是典型的uxss?

firmianay commented 6 months ago

跨activity我们是通过关联多个规则扫描结果来解决,这里主要是断在ARouter路由这里,单看DemoWebActivity的话,因为是非导出组件,在处理结果的时候就忽略了