scada software or swiss cheese software?  by celil unuver

52
SCADA So'ware or Swiss Cheese So'ware? Code Blue 2014 , Tokyo Celil ÜNÜVER, SignalSEC Ltd.

Upload: code-blue

Post on 06-May-2015

705 views

Category:

Technology


0 download

DESCRIPTION

The talk is about SCADA vulnerabilities and exploiting. We will answer some specific questions about SCADA software vulnerabilities with technical details. The questions are; - Why are SCADA applications buggy? - What is the status and impact of the threat? - How do researchers or hackers discover these vulnerabilities? In this talk we will also look at some SCADA vulnerabilities that affects well-known SCADA/HMI vendors, and will show how it's easy to hunt these vulnerabilities via reverse engineering , fuzzing etc. Celil UNUVER Celil Unuver is co-founder & security researcher of SignalSEC Ltd. He is also founder of NOPcon Security Conference. His areas of expertise include Vulnerability Research & Discovery, Exploit Development, Penetration Testing and Reverse Engineering. He has been a speaker at CONFidence, Swiss Cyber Storm, c0c0n, IstSec, Kuwait Info Security Forum. He enjoys hunting bugs and has discovered critical vulnerabilities affect well-known vendors such as Adobe, IBM, Microsoft, Novell etc.

TRANSCRIPT

Page 1: SCADA Software or Swiss Cheese Software?  by Celil UNUVER

SCADA  So'ware  or  Swiss  Cheese  So'ware?  

Code  Blue  2014  ,  Tokyo  Celil  ÜNÜVER,  SignalSEC  Ltd.  

Page 2: SCADA Software or Swiss Cheese Software?  by Celil UNUVER

Agenda  

•  About  me  •  How  it  started?  •  Why    are  SCADA  apps  so  BUGGY?  •  HunGng  SCADA  vulnerabiliGes  •  Analysis  of  the  vulnerabiliGes  

Page 3: SCADA Software or Swiss Cheese Software?  by Celil UNUVER

About  me  

•  Co-­‐founder  and  Researcher  @  SignalSEC  Ltd.  

•  Organizer  of  NOPcon  Hacker  Conference  (Istanbul,Turkey)  

•  Interested  in  vulnerability  research  ,  reversing  •  Hunted  a  lot  of  bugs  affect  Adobe,  IBM,  Microso',  

Facebook,  Novell  ,  SCADA  vendors  etc.  

•  Has  been  a  speaker  at  CONFidence,  Swiss  Cyber  Storm,  c0c0n  etc.  

Page 4: SCADA Software or Swiss Cheese Software?  by Celil UNUVER

How  it  started?  

•  SCADA  systems  are  in  our  daily  life  for  long  years!  

•  There  was  not  too  much  interest  in  SCADA  Security  

Page 5: SCADA Software or Swiss Cheese Software?  by Celil UNUVER

Milestone  

•  Stuxnet  and  Duqu  a^acks  in  2010  –  2011  

•  SCADA  systems  got  a^enGon  of  hackers  and  researchers  a'er  these  a^acks.  

•  CriGcal  systems  ,  fame,  profit  etc..  •  They  are  all  JUICY  target  •  Lots  of  SCADA  systems  are  open  to  INTERNET  

Page 6: SCADA Software or Swiss Cheese Software?  by Celil UNUVER

No  more  stuxnet  •  Sure  ,  all  of  us  know  about  stuxnet!  

Page 7: SCADA Software or Swiss Cheese Software?  by Celil UNUVER

SCADA  Overview  

Page 8: SCADA Software or Swiss Cheese Software?  by Celil UNUVER

ICS  VulnerabiliGes  

•  Hardware/Firmware  VulnerabiliGes:    Vulns  in  PLC  &  RTU  devices  

•  So'ware  VulnerabiliGes:  

       Vulns  in  Control  System  So'ware(HMI)  but  also  affects  PLC/RTU  devices  

Page 9: SCADA Software or Swiss Cheese Software?  by Celil UNUVER

                                     TWO  DOZEN  BUGS  IN  A  FEW  HOURS  

Page 10: SCADA Software or Swiss Cheese Software?  by Celil UNUVER

           Trust  me  ,  it’s  easy!  

Actually,  it’s  really  easy  to  hunt  SCADA  BUGS!!!  

Page 11: SCADA Software or Swiss Cheese Software?  by Celil UNUVER

Why  it’s  easy?  

There  wasn’t  a  real  threat  for  SCADA  soEware  unFll  2010  

So  the  developers  were  not  aware  of  SECURE  

Development  

Page 12: SCADA Software or Swiss Cheese Software?  by Celil UNUVER

HunGng  VulnerabiliGes  

•  Simple  reversing  rocks!  •  1-­‐)  Analyze  the  target  so'ware  (PotentaGal  

inputs;  communicaGon  protocols,  acGvex  etc.)  

•  2-­‐)  Discover  &  trace  the  input  

•  3-­‐)  Hunt  the  bugs.  

Page 13: SCADA Software or Swiss Cheese Software?  by Celil UNUVER

HunGng  VulnerabiliGes  

“You  must  understand  that  there  is  more  than  one  path  to  the  top  of  the  mountain.”  

-­‐  Miyamoto  Musashi  -­‐    

Page 14: SCADA Software or Swiss Cheese Software?  by Celil UNUVER

Case-­‐1:  CoDeSys  Gateway  Vuln  

•   CoDeSys  is  development  environment  for  industrial  control  systems  used  by  lots  of  manufacturers.  

•  Aaron  Portnoy  from  Exodus  discovered  these  vulnerabiliGes.  

•  Status:  Patched  

Page 15: SCADA Software or Swiss Cheese Software?  by Celil UNUVER

Case-­‐1  :  CoDeSys  -­‐  RECON  

•  Listening  PORT  

Page 16: SCADA Software or Swiss Cheese Software?  by Celil UNUVER

Case-­‐1:  CoDeSys  -­‐  Debug  

•  Breakpoint  on  recv()  •  Send  junk  bytes  

•  Breapoint  Access  on  recv’s    ‘buf’  parameter  

Page 17: SCADA Software or Swiss Cheese Software?  by Celil UNUVER

Case-­‐1:  CoDeSys  -­‐  Debug  

•  Comparing  

Page 18: SCADA Software or Swiss Cheese Software?  by Celil UNUVER

Case-­‐1:  CoDeSys  –  Switch  Cases  /  Opcodes  

•  A'er  we  pass  the  comparison  

Page 19: SCADA Software or Swiss Cheese Software?  by Celil UNUVER

Case-­‐1:  CoDeSys  –  Switch  Cases  

•  Let’s  find  the  bugs  

Page 20: SCADA Software or Swiss Cheese Software?  by Celil UNUVER

Case-­‐1:  CoDeSys  –  Delete  File  •  Opcode  :  13  

Page 21: SCADA Software or Swiss Cheese Software?  by Celil UNUVER

Case-­‐1:  CoDeSys  –  Upload  File  •  Opcode:  6  

Page 22: SCADA Software or Swiss Cheese Software?  by Celil UNUVER

Case-­‐1:  RecommendaGon  

•  Actually,  file  remove  /  upload  bugs  are  ‘feature’  of  this  applicaGon  ☺  

•  But  there  is  no  authenGcaGon  for  these  operaGons.  Somebody  can  reverse  the  packet  structure  and  use  these  features  for  evil!    

•  To  solve  this  kind  of  bugs,  developers  should  add  an  “authenGcaGon”  step  before  execuGg  opcodes.    

•  Patched  in  2013  

Page 23: SCADA Software or Swiss Cheese Software?  by Celil UNUVER

 An  InteresGng  Story:  Progea  MOVICON  Vulnerability  –  sGll  0day  

“When  a  patch  doesn’t  patch  anything!”  

•  23  Nov  2013:  I’ve  discovered  some  vulnerabiliGes  on  the  latest  version  of  Progea  MOVICON  HMI  so'ware  

•  24  Nov  2013:  We’ve  published  a  short  analysis  on  Pastebin    •  3  Dec  2013:  ICS-­‐CERT  contacted  us  about  the  post  on  

Pastebin.    They  asked  details  ,  we  sent  informaGon  etc.  

Page 24: SCADA Software or Swiss Cheese Software?  by Celil UNUVER

 An  InteresGng  Story:  Progea  MOVICON  Vulnerability  –  0day  

•  5  Dec  2013:    

•  from  ICS-­‐CERT  to  me;  

Page 25: SCADA Software or Swiss Cheese Software?  by Celil UNUVER

An  InteresGng  Story:  Progea  MOVICON  Vulnerability  –  0day  

•  THEY  SAY  :    The  bugs  you  discovered  are  SIMILAR  to  a  bunch  of  OLDER  BUGS  and  PATCHED  IN  2011.      

•  ICSA-­‐11-­‐056;  

•  My  findings  looks  exactly  same!!!!  But  I  am  able  to  reproduce  on  the  latest  version!!    

Page 26: SCADA Software or Swiss Cheese Software?  by Celil UNUVER

 An  InteresGng  Story:  Progea  MOVICON  Vulnerability  –  0day  

•  These  bugs  are  similar  to  the  bugs  that  we  analyzed  in  Case-­‐1:CoDeSys  

•  There  is  NO  authenGcaGon  to  call  some  funcGons  ,  operaGons  in  the  so'ware.    Somebody  can  reverse  the  packet  structure  and  use  these  features  for  evil!  

•  A"er  a  conversa,on  with  Code  Blue  staff,  we  have  decided  to  mask  some  details  of  this  zero-­‐day  vulnerability.  

Page 27: SCADA Software or Swiss Cheese Software?  by Celil UNUVER

 An  InteresGng  Story:  Progea  MOVICON  Vulnerability  –  0day  

Page 28: SCADA Software or Swiss Cheese Software?  by Celil UNUVER

An  InteresGng  Story:  Progea  MOVICON  Vulnerability  –  0day  

•  Remote  InformaGon  Disclosure:  opcode  [-­‐censored-­‐]  

Page 29: SCADA Software or Swiss Cheese Software?  by Celil UNUVER

An  InteresGng  Story:  Progea  MOVICON  Vulnerability  –  0day  

•  Opcode  [-­‐censored-­‐]    calls    GetVersionExA      API  and  sends  output  to  the  client  

Page 30: SCADA Software or Swiss Cheese Software?  by Celil UNUVER

An  InteresGng  Story:  Progea  MOVICON  Vulnerability  –  0day  

•  Here  is  a  simple  PoC  for  this  bug;  

Page 31: SCADA Software or Swiss Cheese Software?  by Celil UNUVER

An  InteresGng  Story:  Progea  MOVICON  Vulnerability  –  0day  

•  When  we  run  it  and  call  opcode  [-­‐censored-­‐]:  

•  6th  byte  in  printed  data  is  "dwMajorVersion"  which  is  a  return  value  of  GetVersionExA  and  gives  informaGon  about  the  OS.  

•  Status:  PATCHED(!)  in  2011    but  we  are  able  to  exploit  it  in  2014!  

Page 32: SCADA Software or Swiss Cheese Software?  by Celil UNUVER

 An  InteresGng  Story:  Progea  MOVICON  Vulnerability  –  0day  

•  So  what  is  the  problem?  Why  old  bugs  are  sGll  there  !?  •  A'er  comparing  the  older  version  and  the  latest  version  ,  

I  understood  that  actually  vendor  didn’t  patch  anything.  •  Instead  of  fixing  vulnerabiliGes,  they  just  changed  

“opcodes”  of    the  funcGons  in  new  version!  •  Older  version:    Opcode  7  causes  info  disclosure  

vulnerability  by  calling  GetVersionEx  API  •   New  version:    They  just  changed  opcode  “7”  to  “X”  for  

calling  GetversionEx  API    

Page 33: SCADA Software or Swiss Cheese Software?  by Celil UNUVER

 PROGEA,  your  fail  is  unbelievable!  

Page 34: SCADA Software or Swiss Cheese Software?  by Celil UNUVER

Temporary  soluGon  

•  Block  remote  connecGons  to  TCP:10651  

•  If  you  contact  me  in  personal  ,  I  can  share  vulnerability  signatures  that  you  can  use  in  your  IDS/IPS  (snort  etc.)  

Page 35: SCADA Software or Swiss Cheese Software?  by Celil UNUVER

Case-­‐3:  CoDeSys  WebVisu  

•  CodeSys  WebVisu  uses  a  webserver  which  is  usually  open  to  Internet  for  visualizaGon  of  PLC  

•  Discovered  by  me  •  Status:  Patched  

Page 36: SCADA Software or Swiss Cheese Software?  by Celil UNUVER

Case-­‐3:  CoDeSys  Vulnerability  

•  Buffer  overflow  vulnerability  when  parsing  long  h^p  requests  due  to  an  unsafe  funcGon.  

•  It  uses  “vsprinv”  to  print  which  file  is  requested.  

Page 37: SCADA Software or Swiss Cheese Software?  by Celil UNUVER

Case-­‐4:  Schneider  IGSS  Vulnerability  •  Gas  DistrubuFon  in  Europe  

•  Airport  in  Asia  •  Traffic  Control  Center  in  Europe  

Page 38: SCADA Software or Swiss Cheese Software?  by Celil UNUVER

Case-­‐4:  Schneider  IGSS  Vulnerability  •  Discovered  by  me  •  Status:  Patched  •  IGSS    listens  12399  and  12397  ports  in  runGme  •  A  simple  bunch  of  code  causes  to  DoS  

 use  IO::Socket;    $host  =  "localhost";    $port  =  12399;    $port2  =  12397;    $first  =  "\x01\x01\x00\x00";    $second  =  "\x02\x01\x00\x00";  

Page 39: SCADA Software or Swiss Cheese Software?  by Celil UNUVER

Case-­‐5:  Schneider  Electric  Accutech  Heap  Overflow  Vulnerability  

Buffer  overflow  vulnerability  when  parsing  long  h^p  requests  due  to  an  unsafe  funcGon  

Status:  Patched  

Page 40: SCADA Software or Swiss Cheese Software?  by Celil UNUVER

Case-­‐5:  Schneider  Electric  Accutech  Heap  Overflow  Vulnerability  

Page 41: SCADA Software or Swiss Cheese Software?  by Celil UNUVER

Case-­‐3:  Schneider  Electric  Accutech  Heap  Overflow  Vulnerability  

Page 42: SCADA Software or Swiss Cheese Software?  by Celil UNUVER

Case-­‐6:  Pwning  the  Operator  

Page 43: SCADA Software or Swiss Cheese Software?  by Celil UNUVER

Case-­‐6:  Invensys  Wonderware    System  Plavorm  Vulnerability  

•  Discovered  by  me  

•  Status:  Patched  •  Killing  five  birds  with  one  stone  ☺  

Page 44: SCADA Software or Swiss Cheese Software?  by Celil UNUVER

Case-­‐6:  Invensys  Wonderware    System  Plavorm  Vulnerability  

•  An  AcGveX  Buffer  Overflow  vulnerability  

•  Just  found  by  AcGveX  fuzzing...  •  Send  the  exploit  URL  to  HMI  Operator  •  Click  and  pwn  !    

Page 45: SCADA Software or Swiss Cheese Software?  by Celil UNUVER

Case-­‐7:  InduSo'  HMI  Bugs  

Page 46: SCADA Software or Swiss Cheese Software?  by Celil UNUVER

Case-­‐7:  InduSo'  HMI  Bugs  

•  This  is  really  creepy!  •  This  so'ware  doesn’t  check  even  any  “magic”  

value  of  incoming  packets.  There  is  no  custom  packet  structure!  

•  Sending  1  byte  to  TCP:4322    is  enough  to  jump  a  switch  case  

Page 47: SCADA Software or Swiss Cheese Software?  by Celil UNUVER

Case-­‐7:  InduSo'  HMI  Exploit  ☺  

Page 48: SCADA Software or Swiss Cheese Software?  by Celil UNUVER

Finding  Targets  

•  Banner  InformaGon:  “3S_WebServer”  •  Let’s  search  it  on  SHODAN!  ☺  

Page 49: SCADA Software or Swiss Cheese Software?  by Celil UNUVER

CoDeSys  WebServer  on  SHODAN  

Server’s  Banner  :  “3S_WebServer”  Shodan  Results:  151  

Page 50: SCADA Software or Swiss Cheese Software?  by Celil UNUVER

Demo  

•  DEMO  

Page 51: SCADA Software or Swiss Cheese Software?  by Celil UNUVER

   Conclusion  

•  CriGcal  Infrastructures  are  juicy  targets!  •  HackGvists  are  interested  in  SCADA  Hacking  

too.  Not  only  government  intelligence  agencies.  

•  ApplicaFons  are  insecure!  

Page 52: SCADA Software or Swiss Cheese Software?  by Celil UNUVER

D                    Thank  you!  •  Contact:  •  [email protected]  

•  Twicer:  @celilunuver  

•  www.signalsec.com      

•  www.securityarchitect.org