How Many Million BIOSes Would you Like to Infect?     Corey  Kallenberg  &  Xeno  Kovah   About  us   • We  do  digital  voodoo   • Newly  independent  as  of  January  2015   • The  only  company  focused  primarily  on  PC   firmware  security   2   This  talk  has  2  main  points   • Because  almost  no  one  applies  BIOS  patches,   almost  every  BIOS  in  the  wild  is  affected  by  at   least  one  vulnerability,  and  can  be  infected   • The  high  amount  of  code  reuse  across  UEFI   BIOSes  means  that  BIOS  infecPon  is   automatable  and  reliable   3   What’s  past  is  prologue   • Some  (mostly-­‐mulP-­‐vendor)  BIOS   vulnerabiliPes  disclosed  since  2012:   • CERT  VU#127284[0],  912156[1](“Ruy  Lopez”),   255726[1](“The  Sicilian”),  758382[2]  (“Setup   bug”),  291102[4]  (“Charizard”),  552286[5] (“King  &  Queen’s  Gambit”),  533140[6]   (“noname”),  766164[7]  (“Speed  Racer”),   976132[8]  (“Venamis”),  577140[9](“Snorlax”)   • And  a  bunch  from  others  that  didn’t  get  VU#s   4   NOT-­‐SMM   SMM   5   Incursions  (VU#631788)   • In  2008  ITL  disclosed  an  SMM  vulnerability  where  on  some  Intel   motherboards  SMM  code  called  through  non-­‐SMRAM  funcPon   pointer  table   – Low  hanging  fruit  SMM  vulnerability!   • How  prevalent  are  low  hanging  fruit  SMM  vulnerabiliPes  today?   hlp://invisiblethingslab.com/resources/bh09usa/Alacking%20Intel%20BIOS.pdf   • But  how  do  you  hit  what  you  cannot  see?   • OpPon  1:  Reprogram  firmware  to  disable  SMRAM   protecPon   – Disable  TSEG   – Disable  SMRRs   • OpPon  2:  Use  the  power  of  the  dark  side   • We  did  a  lille  RE  work  to  determine  which  SMM   code  we  could  invoke  from  the  OS  by  wriPng  to  port   0xB2   • In  this  case,  funcPon  0xDB05EDCC  within  SMM  can   be  reached  by  wriPng  0x61  to  port  0xB2   • Almost  every  UEFI  system  we  surveyed  used  this   format  to  record  reachable  SMM  code   • We  found  a  lot  of  these  vulnerabiliPes   • They  were  so  easy  to  find,  we  could  write  a  ~300  line   IDAPython  script  that  found  so  many  I  stopped  counPng   and  (some)  vendors  stopped  emailing  me  back   • You’re  the  next  contestant  on…  Is  it  vulnerable???   • Hint:  Hexrays  detects  the  external  memory  accesses   and  colors  them  red.   – When  you  see  red,  bad!   Looking  at  Acer  in  IDA   22   Vendor  Response   • Many  vendors  didn’t  reply  to  our  emails  and/ or  claimed  they  weren’t  vulnerable   – They  are  vulnerable   • Dell  responded  and  is  pushing  patches  for  all   of  our  disclosures   • Lenovo  also  responded  and  is  releasing   patches   What’s  possible  once  you’ve  broken   into  BIOS/SMM?   24   LightEater   Hello  my  friends.   Welcome  to  my  home   in  the  Deep  Dark   25   • Tails  says  that  because  it  runs  independent  of  the   operaPng  system,  if  you  have  previously  been   compromised  by  sotware  means  (not  physical   access),  you  should  be  safe…   • Exploit  delivered  remotely  on  target  Windows  10  system.   – No  physical  access  is  necessary   – All  you  need  is  a  remote  cmd.exe  with  admin  access   • Exploit  bypasses  BIOS  flash  protecPon  and  reprograms  the   porPon  of  the  flash  associated  with  System  Management  Mode   • Malware  that  was  delivered  remotely  to  the  main  OS  (Windows   10)  waits  in  the  background  and  runs  in  System  Management   Mode   • It  waits  for  your  secrets  to  be  revealed   • If  you  are  pracPcing  OPSEC,  perhaps  you  have  a  private   email  and  private  key  that  you  only  access  from  the   “secure”  Tails  so  to  avoid  having  confidenPal   communicaPons  compromised   • Using  this  style  of  OPSEC,  the  password  for  your  key   should  never  be  entered  on  your  normal  operaPng   system  (Win10  in  this  case).   • Since  we  are  in  Tails,  we  are  okay  though…   • Hence  all  of  your  confidenPal  communicaPons   should  remain  shielded  from  any  malware  that  was   delivered  to  your  Win10  installaPon   • Using  our  malware,  this  isn’t  the  case…   • Runs  independent  of  any  operaPng  system  you  put  on  the   plavorm   • Has  access  to  all  of  memory   • Can  steal  all  of  your  secrets  no  maler  what  “secure   operaPng  system”  you  are  using   • Tails  also  alempts  to  erase  memory  to   scrub  any  residual  secrets  that  may  be   exposed  to  the  main  operaPng  system   • Our  malware  sPll  has  access  to  it,  as  we  store  the  secrets  to  non-­‐ volaPle  storage  so  we  can  exfil  at  earliest  convenience   – So  even  if  you  were  to  use  Tails  in  offline  mode,  to  try  to  avoid   exfiltraPon  of  secrets,  you  can  sPll  be  owned   • Time  to  rethink  this…   All  fall  before  a  LightEater   • The  US  Air  Force  made  the  “Lightweight  Portable  Security”  (LPS)   Live  CD1  with  much  the  same  purpose  as  Tails:   • “LPS  differs  from  tradiPonal  operaPng  systems  in  that  it  isn't   conPnually  patched.  LPS  is  designed  to  run  from  read-­‐only  media   and  without  any  persistent  storage.  Any  malware  that  might  infect   a  computer  can  only  run  within  that  session.”   • “LPS-­‐Public  turns  an  untrusted  system  (such  as  a  home  computer)   into  a  trusted  network  client.  No  trace  of  work  ac7vity  (or  malware)   can  be  wri  BDS  transiPon   • DxeMain.c    //    //  Transfer  control  to  the  BDS  Architectural  Protocol    //    gBds-­‐>Entry  (gBds);   • Equivalent  exact   assembly  found  in  6   separate  vendors’   BIOSes     4C  8B  1D  8A  AF  00  00      mov          r11,  cs:gBDS   49  8B  CB                                                    mov          rcx,  r11   41  FF  13                                                      call        qword  ptr  [r11]   Yara  rule  =  {4C  8B  1D  [4]  49  8B  CB  41  FF  13}       56   (yes,  I  know,  I  obviously  should  technically  make  it  register-­‐independent,  but  I  don’t  care  because  it  worked  well  enough  as  you’ll  see  in  a  second  :P)   (when  you  make  your  signatures,  you  can  make  them  as  uber1337  as  you  want  :P)   Analysis  targets   • • Created  YARA  signatures  from  what  the  code  looked  like  on  9  systems   Key  for  next  slides:  “1,1,2”  =  “PEI_TO_DXEIPL  variant  1,  DXEIPL_TO_DXE   variant  1,  and  DXE_TO_BDS  variant  2  matched  for  this  system”   “PEI_TO_DXEIPL.rule”   4  variants   “DXEIPL_TO_DXE.rule”   3  variants   DXE  IPL   PEIM   “DXE_TO_BDS.rule”   3  variants   PEI  Core   DXE  Core   BDS   57   Some  Analysis  Results   • Teddy  Reed  graciously  provided  the  data  set   from  his  2014  Infiltrate  talk1   • 2158  BIOS  images  spidered  from  Lenovo,  HP,   Dell,  Gigabyte,  &  Asrock’s  websites   – Haven’t  counted  how  many  individual  models  yet   • Signature  scanning  results:   – PEI_TO_DXEIPL:  3  misses  (1  model)   – DXEIPL_TO_DXE:  0  misses   – DXE_TO_BDS:  4  misses  (2  models)   1“AnalyPcs,  and  Scalability,  and  UEFI  ExploitaPon  (Oh  My)”  –  Teddy  Reed   hlp://prosauce.org/storage/slides/Infiltrate2014-­‐AnalyPcs-­‐Scalability-­‐UEFI-­‐ExploitaPon.pdf   58   For  reading  at  your  leisure   (from  Teddy  Reed’s  data  set)   (2158  images,  7  misses)   Lenovo  (442  images)   -­‐  PEI_TO_DXEIPL:  0  misses   -­‐  DXEIPL_TO_DXE:  0  misses   -­‐  DXE_TO_BDS:  2  misses   HP  (388  images)   -­‐  PEI_TO_DXEIPL:  0  misses   -­‐  DXEIPL_TO_DXE:  0  misses   -­‐  DXE_TO_BDS:  0  misses   Dell  (381  images)   -­‐  PEI_TO_DXEIPL:  3  misses   -­‐  DXEIPL_TO_DXE:  0  misses   -­‐  DXE_TO_BDS:  2  misses   Gigabyte  (347  images)   -­‐  PEI_TO_DXEIPL:  0  misses   -­‐  DXEIPL_TO_DXE:  0  misses   -­‐  DXE_TO_BDS:  0  misses   Asrock  (596  images)   -­‐  PEI_TO_DXEIPL:  0  misses   -­‐  DXEIPL_TO_DXE:  0  misses   -­‐  DXE_TO_BDS:  0  misses   59   For  reading  at  your  leisure   (from  a  completely  different  LegbaCore  data  set)   (1003  images,  5  misses)   Lenovo  (213  images)   -­‐  PEI_TO_DXEIPL:  0  misses   -­‐  DXEIPL_TO_DXE:  0  misses   -­‐  DXE_TO_BDS:  0  misses   HP  (401  images)   -­‐  PEI_TO_DXEIPL:  0  misses   -­‐  DXEIPL_TO_DXE:  0  misses   -­‐  DXE_TO_BDS:  0  misses   Dell  (348  images)   -­‐  PEI_TO_DXEIPL:  0  misses   -­‐  DXEIPL_TO_DXE:  0  misses   -­‐  DXE_TO_BDS:  0  misses   LG  (13  images)   -­‐  PEI_TO_DXEIPL:  0  misses   -­‐  DXEIPL_TO_DXE:  0  misses   -­‐  DXE_TO_BDS:  1  misses   Asus  (13  images)   -­‐  PEI_TO_DXEIPL:  2  misses   -­‐  DXEIPL_TO_DXE:  0  misses   -­‐  DXE_TO_BDS:  2  misses   Acer  (15  images)   -­‐  PEI_TO_DXEIPL:  0  misses   -­‐  DXEIPL_TO_DXE:  0  misses   -­‐  DXE_TO_BDS:  0  misses   60   HP  Example   1,1,2   1,1,2   1,1,2   1,1,2   1,1,2   1,1,2   3,1,3   3,1,3   1,1,2   1,1,2   1,1,2   1,1,2   61   ExtrapolaPon  to  millions   From  hlps://www.gartner.com/newsroom/id/2960125   62   ExtrapolaPon  to  millions   • So  if  almost  no  one  applies  BIOS  vulnerability   patches…   • And  if  my  Pny  set  of  signatures  can  reliably   find  hook  points  and  disable  sanity  checks  in   the  machines  HP  is  currently  selling…   • And  if  HP  shipped  ~15M  PCs  in  Q4  2014…   • Then  we  would  understand  that  millions  of   these  BIOSes  could  be  reliably  infected,  yes?   63   Aspire  S7-­‐392   2,2,1   TravelMate  P255   2,2,1   Veriton  M4630G   2,2,1   TravelMate  B113   2,2,1   TravelMate  P455   2,2,1   Veriton  X2630G     2,2,1   Acer   TravelMate  P245   2,2,1   TravelMate  P645   2,2,1   Veriton  M2631   2,2,1   Veriton  Z26600G   2,2,1   Veriton  Z4810G   2,2,1   Veriton  N4630G   2,2,1   64   ASUSPRO  ADVANCED   B53S   miss,2,1   ASUSPRO  ESSENTIAL   P53E   miss,2,1   ESC2000  G2   2,2,1   BU201   2,2,1   Asus   B451JA   2,2,1   PU551JH   P751JA   2,2,1   2,2,1   ESC4000  G2   TS500-­‐E8-­‐PS4   2,2,1   4,2,miss   B400A   2,2,1   P55VA   2,2,1   RS500-­‐E8-­‐RS4   4,2,miss   65   PC  Gram  13Z940   2,1,1   Ultra  PC  15U530   2,1,1   Tab  Book  10T550   4,1,miss   PC  Gram  14Z950   4,1,3   Ultra  PC  15U340   4,1,1   Tab  Book  11T740   2,1,1   LG   PC  Gram  15Z950   Ultra  PC  14U530   4,1,3   2,1,1   15N540   22V240   2,1,1   A75CV   2,2,1   4,1,1   A75PS   2,2,1   It  was  about  this  Pme  I  got  really  Pred  of  making  these  slides  and  manually  downloading  BIOSes  ;)   A  lille  good  news  before  we  go   • Were  working  with  vendors  like  Dell  to  do   security  assessments  to  find  and  fix  issues   before  they  ship  on  new  systems.  Lenovo  and   others  are  also  on  the  list.   67   A  lille  good  news  before  we  go   • We’re  also  working  with  Intel  to  try  to  create  the   first  commercial-­‐grade  SMM  isolaPon   • Intel  has  the  ability  for  their  hardware   virtualizaPon  to  jail  SMM   • We  will  then  work  with  BIOS  vendors  to   incorporate  the  technology  into  shipping  systems   • End  result  will  be  that  even  if  alackers  break  into   SMM,  they  can’t  read/write  arbitrary  memory   – And  we  could  detect  alackers  through   measurements.   68   Conclusions   69   This  talk  has  2  main  points   • Because  almost  no  one  applies  BIOS  patches,   almost  every  BIOS  in  the  wild  is  affected  by  at   least  one  vulnerability,  and  can  be  infected   • The  high  amount  of  code  reuse  across  UEFI   BIOSes  means  that  BIOS  infecPon  is   automatable  and  reliable   70   What  we  showed   • All  systems  we  have  looked  at  contain  Incursion   vulnerabiliPes  that  allow  breaking  in  to  SMM   • Incursion  vulnerabiliPes  can  be  found  programaPcally   • The  LightEater  SMM  alacker  can  perform  any  a