Ведущий: Дан Корецкий
Миллионы устройств на Android содержат уязвимости, которые дают права суперпользователя. Докладчик расскажет о технических причинах проблем безопасности (коллизии хеш-функций, злоупотребление межпроцессорным взаимодействием, ошибки работы с сертификатами приложений). Продемонстрирует атаку на «живое» устройство и предоставит рекомендации для снижения риска. Слушатели узнают, почему нельзя полностью устранить уязвимости. Докладчик также поведает историю о том, как были обнаружены атаки в Google Play.
2. 2
Поведенческий анализ угроз
• Анализировать угрозы по их поведению
• Собирать похожие угрозы, чтобы находить неизвестные атаки
3. 3
• Анализировать угрозы по их поведению
• Собирать похожие угрозы, чтобы находить неизвестные атаки
mRATS
mobile
Remote
Access
Trojans
• Используются
злоумышленниками в
нацеленных атаках
• Обеспечивают
неразрешенный и
скрытый доступ к
мобильным
устройствам
Поведенческий анализ угроз
9. 9
ANDROID PERMISSION MODEL 101
Андроид современная операционка
• Песочница
̶ Каждое приложение исполняется с отдельным
системным пользователем
̶ Базируется на Linux user IDs и на group IDs.
• Разрешение
̶ Должно быть дано чтобы был доступ к ресурсу
̶ Объявляется в AndroidManifest.xml
̶ Пользователь проверяет при установке
̶ Подход ‘Бери все или ничего’*
* Есть изменения в версии Marshmallow
10. 10
Некоторые разрешения считаются привилегированными
Permissions Action
READ_FRAME_BUFFER
ACCESS_SURFACE_FLINGER
Screen access
INJECT_EVENTS User Input Control
GRANTED ONLY TO PRIVILEGED SYSTEMS APPS
Apps signed with the OEM’s certificate
OR
ROM Pre-installed apps located under /system/priv-app
ANDROID PERMISSION MODEL 101
11. 11
Некоторые разрешения считаются привилегированными
Permissions Action
READ_FRAME_BUFFER
ACCESS_SURFACE_FLINGER
Screen access
INJECT_EVENTS User Input Control
Дается только системным приложениям
Приложениям, подписанным сертификатом производителя
ИЛИ
Предустановленным приложениям находящимся в
/system/priv-app
ANDROID PERMISSION MODEL 101
12. 12
mRST РАЗРЕШЕНИЯ
• Интернет
• Сетевая информация устройства
• Опрос установленных приложений
• Доступ к памяти устройства
• Перехват экрана
• Ввод данных
17. 17
mRST архитектура
• Подписанный производителем
• Привилегированные
разрешения
• Экспортируемый сервис
• Без доступа пользователю
Главное Приложение
• Подписано разработ. mRST
• Без особенных разрешений
• Интернет
• Доступ пользователю
Binder
Агент
18. 18
mRST архитектура
• Подписанный производителем
• Привилегированные
разрешения
• Экспортируемый сервис
• Без доступа пользователю
Главное Приложение
• Подписано разработ. mRST
• Без особенных разрешений
• интернет
• Доступ пользователю
Binder
Механизм
аутентикации?
Агент
19. 19
Что нам известно?
• Агент подписывается производителем
̶ Предустановлен или получен из Google Play
̶ Функция дается экспортируемым сервисом
̶ Любое приложение может подключиться через Binder (IPC)
̶ Агент должен сам проверить подлинность приложения
• Код аутентификации ПРИДУМЫВАЕТСЯ ЗАНОВО каждым
разработчиком!
27. 27
RFC 2459
Internet X.509 Public Key Infrastructure
4.1.2.2 Серийный номер
Серийный номер является числом
приписанным СА каждому сертификату. Оно
ДОЛЖНО быть уникальным в каждом
сертификате, предоставленном тем же СА
(т.е. Имя издателя и серийный номер
должно уникально идентифицировать
сертификат)
34. • Samsung & LG лидирующие устройства имеют
предустановленный агент
̶ LG G4, G3, G2 and G Pro 2
̶ Samsung Galaxy S5 and S4 (некоторые версии)
• Невидимый пользователю (нет launcher icon)
• Нельзя даже убрать
RSUPPORT
35. 35
RSUPPORT CODE
Агент сравнивает hash code сертификата подключающегося
приложения к постоянным числам
Высчитывается hashCode
Сравнивается к
нескольким хешам,
если равен одному из
них, продолжай
38. 38
HA HA HASHCODE!
Arrays.hashCode function on the
certificate
32-bit signed integer
32 bit
= всего 232
~= 4
миллиарда
возможностей
Можно взломать!
39. 39
HA HA HA HASHCODE!
Executes the Arrays.hashCode
function on the certificate
32-bit signed integer
32 bit
= Only 232
~= 4 billion
Possibilities!
java default Arrays.hashCode() function
НЕ ЯВЛЯЕТСЯ криптографической hash
фунскцией, она обращаемая!
Один
бит!
40. 40
Уязвимость
• Подписанный производителем
• Привилегированные
разрешения
• Экспортируемый сервис
• Без доступа пользователю
Главное ЛЮБОЕ
(спец.) Приложение
Binder
Слабый Механизм
аутентификации
Агент
41. 41
Уязвимость
• Злоумышленник подключается к предустановленному
агенту в системе
(или дает пользователю установить агента из Play
Store)
• Пишет приложение которое не требует никаких
разрешений
• Обходит ИБ ограничения АНДРОИД
42. 42
• Получает доступ к экрану и вводу данных
пользователя
“свободные разрешения” позволяют злоумышленнику
• Установить еще вредоносные ПО
• Менять критичную информацию пользователя
• Следить за поведением пользователя (даже внутри
безопасных контейнеров!)
Уязвимость
47. 47
ВЫВОД
• Нет эффективного способа устранить проблему
перечисленные агенты живут дальше
Сотни миллионов устройств
АНДРОИД уязвимы
48. 48
• Нет эффективного способа устранить проблему
перечисленные агенты живут дальше
Мысли вслух…
• Гугл доверили производителям и операторам (делегируя
ответственность неограниченно)
• Производители доверили разработчикам mRST
• Не ограниченно mRSTs
ВЫВОД
Сотни миллионов устройств
АНДРОИД уязвимы
49. 49
• Сотни приложений используют те же механизмы и hash
функции, чтобы проверять сертификаты
• Некоторые из них так обновляют свою версию – андроид
защищает их от их ошибки (нельзя сертификат поменять
существующему приложению)
• А что если package name другой? Некоторые и это не
проверяют – установят злоумышленника без вопросов
• Тут и АНДРОИД не поможет – речь идет об отдельном
приложении
• Ищем дальше похожие проблемы в приложениях
• Google в отчете ‘2015 ИБ в Андроид’ не упомянули
приложение, которое было в Google Play
А дальше?
50. 50
mRST PLUGIN
Еще пример (бонус)
• Манипулирование логикой основного приложения
для того чтобы взять под свой контроль приложение,
подписанное производителем
53. 53
CnC REDIRECTION
Приложение позволяет менять сервер СМСкой
Одна из команд меняет
суб-домен сервера
<xxx>.cncdomain.com
Суб-домен может быть изменен без
аутентификации
54. 54
CnC REDIRECTION
Приложение позволяет менять сервер СМСкой
Одна из команд меняет
суб-домен сервера
<xxx>.cncdomain.com
Суб-домен может быть изменен без
аутентификации
Приложение не очищает текст суб-домена
как следует
Можно добавить '/' -
www.evil.com/.cncdomain.com
55. • Злоумышленник присылает
СМСку, которая меняет
сервер на злой сервер
• Получает полный доступ к
устройству одной СМСкой
вообще без пользователя!
УЯЗВИМОСТЬ CnC REDIRECTION
*** removed from slide:
Exfiltrate information (location, surround recording, contacts, photos, screen capture, etc..)
********
“Empowers support advisors to assume complete control over mobile devices and PCs from afar..”
Support advisors can provide support as if they are holding the device in their hands regardless of its location
Mobile Carries / Device Manufactures – Remote support for customers. Smartphones aren’t that “Smart”
*** removed from slide:
Exfiltrate information (location, surround recording, contacts, photos, screen capture, etc..)
********
“Empowers support advisors to assume complete control over mobile devices and PCs from afar..”
Support advisors can provide support as if they are holding the device in their hands regardless of its location
Mobile Carries / Device Manufactures – Remote support for customers. Smartphones aren’t that “Smart”
Add more on why we need to use MRTS
Part of EMM Suites Core Capabilities: “Remote view and control for troubleshooting”1
“Empowers support advisors to assume complete control over mobile devices and PCs from afar..”
Support advisors can provide support as if they are holding the device in their hands regardless of its location
Mobile Carries / Device Manufactures – Remote support for customers. Smartphones aren’t that “Smart”
**** original text that was cut up:
Must be obtained to access a resource
User can view permissions upon app installation
Granted on installation and cannot be changed during runtime
Given by the ‘Take it or leave it’ approach
******
As modern OS every app is in a sandbox and need to get permissions in order to access to system resources and other apps
Declared in the AndroidManifest.xml
Take it or leave – until Android M the user doesn’t have a choice.
Simplified permissions – the google play store doesn’t show them all.
Screen Access – in later version does not consider as privileged anymore, but can still needed for earlier versions.
Screen Access – in later version does not consider as privileged anymore, but can still needed for earlier versions.
Get any kind of data from the device that will assist in troubleshooting
Advanced techniques – get a remote screen as the user and preform actions
They need the privileged permission to provide full remote support experience
Get any kind of data from the device that will assist in troubleshooting
Advanced techniques – get a remote screen as the user and preform actions
They need the privileged permission to provide full remote support experience
Each OEM compile and signs the ROM with different private keys
OEMs can sign applications with their certificate allowing them access to system permissions.
Even apps that are installed from the Play Store.
Mobile carries can place apps under /system/priv-app when creating the ROM
Vendors has collaborated with OEMs in order to get a widest distribution possible.
Some also collaborated just with mobile carriers.
Each OEM compile and signs the ROM with different private keys
OEMs can sign applications with their certificate allowing them access to system permissions.
Even apps that are installed from the Play Store.
Mobile carries can place apps under /system/priv-app when creating the ROM
Vendors has collaborated with OEMs in order to get a widest distribution possible.
Some also collaborated just with mobile carriers.
*** removed from slide:
Can gain privileged permissions
Google Play Store
Pre-installed on the device
The code to validate the main app identity is re-invented by each vendor!
Tens of Millions of them
An attacker can leverage this issues -
Find a plugin that fails to validate the remote’s app identity correctly
Create an app which will use the external apk to
Get screenshots of the device
Simulate user clicks
Profit!
main app with a plugin
Called by TeamViewer addon
Plugin is responsible for supplying screen capture and user click simulation
Plugins are signed by all leading vendors
We are talking on xxxxxx devices
main app with a plugin
Called by TeamViewer addon
Plugin is responsible for supplying screen capture and user click simulation
Plugins are signed by all leading vendors
We are talking on xxxxxx devices
Obtains the serial number from the signature (Certificate object)
Compares it to a hardcoded serial number
Obtains the serial number from the signature (Certificate object)
Compares it to a hardcoded serial number
Obtains the serial number from the signature (Certificate object)
Compares it to a hardcoded serial number
Serial number is decided by the CA.
Don’t get confused, we’re talking about android’’s certificates – not SSL!
Serial as same as the hardcoded one.
Now we just need to create a malicious app and sign with the certificate.
After we sign it – it can by pass the plugin’s verification mechanism
G2
G3
G4
G Pro 2
Galaxy S4
Galaxy S5
Galaxy Round
Galaxy Note Edge
G2
G3
G4
G Pro 2
Galaxy S4
Galaxy S5
Galaxy Round
Galaxy Note Edge
The hashCode variable It is vulnerable to a collision attack
The hashCode variable It is vulnerable to a collision attack
The hashCode variable It is vulnerable to a collision attack
The hashCode variable It is vulnerable to a collision attack
*** removed:
Hundred of millions of Android devices will remain vulnerable
Android’s eco-system is flawed
Permissions
Vendors can’t get system permissions
But, OEMs can
Meaning, Google moved the responsibility to the OEMs
Who signs vulnerable apps with an OEM certificate
OEMs cannot revoke vulnerable apps
Ten of millions are vulnerable
*** removed:
Hundred of millions of Android devices will remain vulnerable
Android’s eco-system is flawed
Permissions
Vendors can’t get system permissions
But, OEMs can
Meaning, Google moved the responsibility to the OEMs
Who signs vulnerable apps with an OEM certificate
OEMs cannot revoke vulnerable apps
Ten of millions are vulnerable
*** removed:
Hundred of millions of Android devices will remain vulnerable
Android’s eco-system is flawed
Permissions
Vendors can’t get system permissions
But, OEMs can
Meaning, Google moved the responsibility to the OEMs
Who signs vulnerable apps with an OEM certificate
OEMs cannot revoke vulnerable apps
Ten of millions are vulnerable
If that wasn’t enough , we also wanted to check if the main app that has all the BL can also pose a threat
*** removed:
The main app allows changing settings through an SMS message
One of the commands can modify the subdomain of the CnC server <xxx>.cncdomain.com
The subdomain can be altered without requiring any form of authentication
The app does not sanitize the subdomain properlyEnables the addition of the '/' character to the subdomain
This effectively allows an attacker to alter the CnC to any domain, including domains completely unrelated to .comuntiake.com
*** removed:
The main app allows changing settings through an SMS message
One of the commands can modify the subdomain of the CnC server <xxx>.cncdomain.com
The subdomain can be altered without requiring any form of authentication
The app does not sanitize the subdomain properlyEnables the addition of the '/' character to the subdomain
This effectively allows an attacker to alter the CnC to any domain, including domains completely unrelated to .comuntiake.com
*** removed:
The main app allows changing settings through an SMS message
One of the commands can modify the subdomain of the CnC server <xxx>.cncdomain.com
The subdomain can be altered without requiring any form of authentication
The app does not sanitize the subdomain properlyEnables the addition of the '/' character to the subdomain
This effectively allows an attacker to alter the CnC to any domain, including domains completely unrelated to .comuntiake.com
*** removed:
The main app allows changing settings through an SMS message
One of the commands can modify the subdomain of the CnC server <xxx>.cncdomain.com
The subdomain can be altered without requiring any form of authentication
The app does not sanitize the subdomain properlyEnables the addition of the '/' character to the subdomain
This effectively allows an attacker to alter the CnC to any domain, including domains completely unrelated to .comuntiake.com