My #hacktrickconf presentation about Joshua Drake's Stagefright vulnerability.
This is the English version of my presentation:
http://www.slideshare.net/oguzhantopgul/androidin-yeni-kabusu-medya-dosyalari-media-files-androids-new-nightmare-52578473
I tried to explain the details of CVE-2015-1538, P0004, Google Stagefright ‘stts’ MP4 Atom Integer Overflow Remote Code Execution vulnerability
My #hacktrickconf presentation about Joshua Drake's Stagefright vulnerability.
This is the English version of my presentation:
http://www.slideshare.net/oguzhantopgul/androidin-yeni-kabusu-medya-dosyalari-media-files-androids-new-nightmare-52578473
I tried to explain the details of CVE-2015-1538, P0004, Google Stagefright ‘stts’ MP4 Atom Integer Overflow Remote Code Execution vulnerability
Python programlama diline şöyle hızlıca bir göz atmak için inceleyebilirsiniz.
Blog : http://www.cihanozhan.com
#python #programming #pythonprogramming #pythonprogramminglanguage #py #makineöğrenmesi #görüntüişleme #computervision #deeplearning #machinelearning #programminglanguages
5651 Kanunun cercevesinde kullanıcıların takip edilenbilmesini sağlayanan teknikler, artıları ve eksileri. (Tracking user in your Network) (Sadece IPv4 için / Only for IPv4, IPv6 için olan diğer sunumu inceleyebilirsiniz.)
Python programlama diline şöyle hızlıca bir göz atmak için inceleyebilirsiniz.
Blog : http://www.cihanozhan.com
#python #programming #pythonprogramming #pythonprogramminglanguage #py #makineöğrenmesi #görüntüişleme #computervision #deeplearning #machinelearning #programminglanguages
5651 Kanunun cercevesinde kullanıcıların takip edilenbilmesini sağlayanan teknikler, artıları ve eksileri. (Tracking user in your Network) (Sadece IPv4 için / Only for IPv4, IPv6 için olan diğer sunumu inceleyebilirsiniz.)
3. STAGEFRIGHT AÇIKLIĞI
3
• Joshua Drake a.k.a @jduck tarafından yapılan bir araştırmanın neticesi
• 2015 BLACKHAT USA konferansında
Stagefright: Scary Code in the Heart of Android*
adlı sunumda anlatıldı.
• Bir çok Android cihaz halen açıklığa karşı korunmuyor.
* https://www.blackhat.com/us-15/briefings.html#stagefright-scary-code-in-the-heart-of-android
4. STAGEFRIGHT
• Android’in Multimedia Framework kütüphanesi
• Tüm ses ve video dosyalarını işler
• Video ve ses dosyalarının metadata’larını çıkartır
• Android 2.0 itibariyle AOSP’ye eklendi
• MEDIA SERVER altında çalışıyor.
4
8. MEDIASERVER
8
mediaserver servisi yüksek yetkilere sahip
mediaserver crash olduktan sonra yeniden başlıyor *
* https://android.googlesource.com/platform/system/core/+/master/init/readme.txt
9. STAGEFRIGHT
9
• libstagefright medya dosyalarını mediaserver servisi altında işliyor
• mediaserver yetkili bir native servis
- Bazı cihazlarda system haklarına bile sahip
• mediaserver crash olduktan sonra otomatik olarak yeniden başlıyor
* https://android.googlesource.com/platform/system/core/+/master/init/readme.txt
10. STAGEFRIGHT AÇIKLIĞI
• Çok farklı atak vektörleri mevcut (11+)
• MMS, Sayfa İçerisine <video> tag’i ile yerleştirme, ZararlıVideo’yu indirme, e-mail içerisinde, Chat
ve mesajlaşma programları ile NFC, Bluetooth, SDCard
• Video oynatma, meta-data parse etme gibi farklı yollarla istismar mümkün
• Binary dosya parser’lar genellikle açıklık barındırıyor
• Farklı dosya tipleri ile açıklığı sömürmek mümkün, MP4, 3GPP, vb.
• Farklı yollarla tetiklenebiliyor
• Ekranı döndürmek, Chat uygulamasını açmak, Galeri’yi açmak vb…
10
12. 12
• CVE-2015-1538, P0006, Google Stagefright ‘stsc’ MP4 Atom Integer Overflow Remote Code Execution
• CVE-2015-1538, P0004, Google Stagefright ‘ctts’ MP4 Atom Integer Overflow Remote Code Execution
• CVE-2015-1538, P0004, Google Stagefright ‘stts’ MP4 Atom Integer Overflow Remote Code Execution
• CVE-2015-1538, P0004, Google Stagefright ‘stss’ MP4 Atom Integer Overflow Remote Code Execution
• CVE-2015-1539, P0007, Google Stagefright ‘esds’ MP4 Atom Integer Underflow Remote Code Execution
• CVE-2015-3827, P0008, Google Stagefright ‘covr’ MP4 Atom Integer Underflow Remote Code Execution
• CVE-2015-3826, P0009, Google Stagefright 3GPP Metadata Buffer Overread
• CVE-2015-3828, P0010, Google Stagefright 3GPP Integer Underflow Remote Code Execution
• CVE-2015-3824, P0011, Google Stagefright ‘tx3g’ MP4 Atom Integer Overflow Remote Code Execution
• CVE-2015-3829, P0012, Google Stagefright ‘covr’ MP4 Atom Integer Overflow Remote Code Execution
13. MPEG-4
• MPEG-4 dosyaları Atom veya Box adı verilen yapı taşlarından oluşur.
13
* http://www.adobe.com/content/dam/Adobe/en/devnet/flv/pdfs/video_file_format_spec_v10.pdf
14. MPEG-4
• Atom tipleri (BoxType) 4 karakterden oluşan bir değerdir (4 Byte):
• Ör: ftyp, moov, trak, covr, esds, mvhd…
• 4 karakterlik bu değer FourCC (Four Character Code) olarak adlandırılır.
14
* http://www.adobe.com/content/dam/Adobe/en/devnet/flv/pdfs/video_file_format_spec_v10.pdf
15. MPEG-4
• MPEG-4 alslında bir container, içerisinde farklı medya formatlarını barındırabiliyor.
• moov atomu kendi altında alt atomlara ayrılıyor
15
ftyp mdatmoov
File Type
encoders
compatibility
Header
Media Data
* http://www.adobe.com/content/dam/Adobe/en/devnet/flv/pdfs/video_file_format_spec_v10.pdf
25. 25
‘STTS’ATOM
INTEGER OVERFLOW
SampleTable.cpp < Android 4.4
Dizi için
bellekte
yer
ayırılıyor
Dizi için bellekte ayrılan alan
mTimeToSampleCount * 2 * sizeof(uint32_t)
mTimeToSampleCount * 2 * 4
29. 29
‘STTS’ATOM
INTEGER OVERFLOW
SampleTable.cpp < Android 4.4
mTimeToSampleCount = 1
mTimeToSample
dizisi için
ayrılan alan
1 * 2 * 4 = 8
Döngü sınırı
mTimeToSampleCount * 2
= 2
Normal şartlarda mTimeToSampleCount < Döngü Sınırı < Dizi boyutu
31. 31
‘STTS’ATOM
INTEGER OVERFLOW
SampleTable.cpp < Android 4.4
mTimeToSampleCount
= 0x40000002
mTimeToSample
dizisi için
ayrılan alan
0x40000002 * 4 *2
= 0x200000010
Döngü sınırı
0x40000002 * 2
= 0x80000004
Olması Gereken: mTimeToSampleCount < Döngü Sınırı < Dizi boyutu ✔
33. 33
‘STTS’ATOM
INTEGER OVERFLOW
… if you multiply two 32-bit integers, you get a
32-bit integer again, losing the upper 32 bits of the
result
mTimeToSampleCount = 0x40000002
mTimeToSample dizisi için ayrılan alan
0x40000002 * 4 *2
= 0x200000010
değil
= 0x00000010
/
* http://www.fefe.de/intof.html
34. 34
‘STTS’ATOM
INTEGER OVERFLOW
… if you multiply two 32-bit integers, you get a
32-bit integer again, losing the upper 32 bits of the
result
mTimeToSampleCount = 0x40000002
mTimeToSample dizisi
için ayrılan alan
Döngü sınırı:
0x40000002 * 2
= 0x00000010
= 0x80000004
Olması Gereken: mTimeToSampleCount < Döngü Sınırı < Dizi boyutu ✗
* http://www.fefe.de/intof.html
43. HANGOUT
OPTIONS
SETTINGS
SMS
NASIL KORUNULUR
• Cihazınızı en güncel sürüme yükseltin (eğer geldiyse)
• MMS auto-fetch özelliğini devre dışı bırakın (Hangouts ve Messages
uygulamaları için)
43
MESSAGES
MORE
SETTINGS
MORE
SETTINGS
MMS
44. GÜNCELLEMELER AÇIKLIĞA
ÇÖZÜM GETİRİYOR MU?
• EXODUS Intelligence aynı fikirde değil
44
• Problem CVE-2015-3824, P0011, Google Stagefright ‘tx3g’ MP4 Atom Integer Overflow Remote Code Execution
açıklığının yaması ile ilgili
* https://blog.exodusintel.com/2015/08/13/stagefright-mission-accomplished/