SlideShare une entreprise Scribd logo
1  sur  65
Télécharger pour lire hors ligne
Burp	
  Plugin	
  Development	
  for	
  
                         Java	
  n00bs	
  
                                                        44Con	
  2012	
  




www.7elements.co.uk	
  |	
  blog.7elements.co.uk	
  |	
  @7elements	
  
/me	
  
•     Marc	
  Wickenden	
  
•     Principal	
  Security	
  Consultant	
  at	
  7	
  Elements	
  
•     Love	
  coding	
  (parJcularly	
  Ruby)	
  
•     @marcwickenden	
  on	
  the	
  TwiOerz	
  
•     Most	
  importantly	
  though…..	
  




www.7elements.co.uk	
  |	
  blog.7elements.co.uk	
  |	
  @7elements	
  
I	
  am	
  a	
  Java	
  n00b	
  
If	
  you	
  already	
  know	
  Java	
  
You’re	
  either:	
  
•  In	
  the	
  wrong	
  room	
  
•  About	
  to	
  be	
  really	
  offended!	
  
Agenda	
  
•    The	
  problem	
  
•    GeZng	
  ready	
  
•    IntroducJon	
  to	
  the	
  Eclipse	
  IDE	
  
•    Burp	
  Extender	
  Hello	
  World!	
  
•    ManipulaJng	
  runJme	
  data	
  
•    Decoding	
  a	
  custom	
  encoding	
  scheme	
  
•    “Shelling	
  out”	
  to	
  other	
  scripts	
  
•    LimitaJons	
  of	
  Burp	
  Extender	
  
•    Really	
  cool	
  Burp	
  plugins	
  already	
  out	
  there	
  to	
  fire	
  
     your	
  imaginaJon	
  
Oh…..and	
  there’ll	
  be	
  cats	
  
The	
  problem	
  
•  Burp	
  Suite	
  is	
  awesome	
  
•  De	
  facto	
  web	
  app	
  tool	
  
•  Open	
  source	
  alternaJves	
  don’t	
  compare	
  
   IMHO	
  
•  Tools	
  available/cohesion/protocol	
  support	
  
•  Burp	
  Extender	
  
The	
  problem	
  
I	
  wrote	
  a	
  plugin	
  

Coding	
  by	
  Google	
  FTW!	
  
How?	
  -­‐	
  Burp	
  Extender	
  
•  “allows	
  third-­‐party	
  developers	
  to	
  extend	
  the	
  
   funcJonality	
  of	
  Burp	
  Suite”	
  
•  “Extensions	
  can	
  read	
  and	
  modify	
  Burp’s	
  
   runJme	
  data	
  and	
  configuraJon”	
  
•  “iniJate	
  key	
  acJons”	
  
•  “extend	
  Burp’s	
  user	
  interface”	
  

                                  hOp://portswigger.net/burp/extender/	
  
Burp	
  Extender	
  
•  Achieves	
  this	
  via	
  6	
  interfaces:	
  
    •    IBurpExtender	
  
    •    IBurpExtenderCallbacks	
  
    •    IHOpRequestResponse	
  
    •    IScanIssue	
  
    •    IScanQueueItem	
  
    •    IMenuItemHander	
  
Java	
  101	
  
•    Java	
  source	
  is	
  compiled	
  to	
  bytecode	
  (class	
  file)	
  
•    Runs	
  on	
  Java	
  Virtual	
  Machine	
  (JVM)	
  
•    Class-­‐based	
  
•    OO	
  
•    Write	
  once,	
  run	
  anywhere	
  (WORA)	
  
•    Two	
  distribuJons:	
  JRE	
  and	
  JDK	
  
Java	
  101	
  conJnued…	
  
•  Usual	
  OO	
  stuff	
  applies:	
  objects,	
  classes,	
  
   methods,	
  properJes/variables	
  
•  Lines	
  end	
  with	
  ;	
  
Java	
  101	
  conJnued…	
  
•  Source	
  files	
  must	
  be	
  named	
  amer	
  the	
  public	
  
   class	
  they	
  contain	
  
•  public	
  keyword	
  denotes	
  method	
  can	
  be	
  called	
  
   from	
  code	
  in	
  other	
  classes	
  or	
  outside	
  class	
  
   hierarchy	
  
Java	
  101	
  conJnued…	
  
•  class	
  hierarchy	
  defined	
  by	
  directory	
  structure:	
  
•  uk.co.sevenelements.HelloWorld	
  =	
  uk/co/
   sevenelements/HelloWorld.class	
  
•  JAR	
  file	
  is	
  essenJally	
  ZIP	
  file	
  of	
  classes/
   directories	
  
Java	
  101	
  conJnued…	
  
•  void	
  keyword	
  indicates	
  method	
  will	
  not	
  return	
  
   data	
  to	
  the	
  caller	
  
•  main	
  method	
  called	
  by	
  Java	
  launcher	
  to	
  pass	
  
   control	
  to	
  the	
  program	
  
•  main	
  must	
  accept	
  array	
  of	
  String	
  objects	
  (args)	
  
Java	
  101	
  conJnued…	
  
•  Java	
  loads	
  class	
  (specified	
  on	
  CLI	
  or	
  in	
  JAR	
  
   META-­‐INF/MANIFEST.MF)	
  and	
  starts	
  public	
  
   sta0c	
  void	
  main	
  method	
  




•  You’ve	
  seen	
  this	
  already	
  with	
  Burp:	
  
    •  java	
  –jar	
  burpsuite_pro_v1.4.12.jar	
  
Enough	
  101	
  
Let’s	
  write	
  some	
  codez	
  
First	
  we	
  need	
  some	
  tools	
  
•  Eclipse	
  IDE	
  –	
  de	
  facto	
  free	
  dev	
  tool	
  for	
  Java	
  
•  Not	
  necessarily	
  the	
  best	
  or	
  easiest	
  thing	
  to	
  use	
  
•  AlternaJves	
  to	
  consider:	
  
    •    Jet	
  Brains	
  IntelliJ	
  (my	
  personal	
  favourite)	
  
    •    NetBeans	
  (never	
  used)	
  
    •    Jcreator	
  (again,	
  never	
  used)	
  
    •    Terminal/vim/javac	
  <	
  MOAR	
  L33T	
  
Download	
  Eclipse	
  Classic	
  

  Or	
  install	
  from	
  your	
  USB	
  drive	
  
Eclipse	
  4.2	
  Classic	
  
•  hOp://www.eclipse.org/downloads/sums.php?file=/eclipse/downloads/
   drops4/R-­‐4.2-­‐201206081400/eclipse-­‐SDK-­‐4.2-­‐win32-­‐
   x86_64.zip&type=sha1	
  

•  6f4e6834c95e9573cbc1fc46adab4e39da6b4b6d	
  	
  
•  eclipse-­‐SDK-­‐4.2-­‐win32-­‐x86_64.zip	
  

•  hOp://www.eclipse.org/downloads/sums.php?file=/eclipse/downloads/
   drops4/R-­‐4.2-­‐201206081400/eclipse-­‐SDK-­‐4.2-­‐win32.zip&type=sha1	
  

•  68b1eb33596dddaac9ac71473cd1b35f51af8df7	
  	
  
•  eclipse-­‐SDK-­‐4.2-­‐win32.zip	
  
Java	
  JDK	
  
•  Used	
  to	
  be	
  bundled	
  with	
  Eclipse	
  
•  Due	
  to	
  licensing	
  (I	
  think)	
  this	
  is	
  no	
  longer	
  the	
  
   case	
  
•  Grab	
  from	
  Sun	
  Oracle’s	
  website:	
  
•  hOp://download.oracle.com/otn-­‐pub/java/jdk/7u7-­‐b11/jdk-­‐7u7-­‐windows-­‐
   x64.exe?AuthParam=1347522941_2b61ee3cd1f38a0abd1be312c3990fe5	
  	
  
Welcome	
  to	
  Eclipse	
  
Create	
  a	
  Java	
  Project	
  
•    File	
  >	
  New	
  >	
  Java	
  Project	
  
•    Project	
  Name:	
  Burp	
  Hello	
  World!	
  
•    Leave	
  everything	
  else	
  as	
  default	
  
•    Click	
  Next	
  
Java	
  SeZngs	
  
•  Click	
  on	
  Libraries	
  tab	
  
•  Add	
  External	
  JARs	
  
•  Select	
  your	
  burpsuite.jar	
  




•  Click	
  Finish	
  
Create	
  a	
  new	
  package	
  
•  File	
  >	
  New	
  >	
  Package	
  
•  Enter	
  burp	
  as	
  the	
  name	
  
•  Click	
  Finish	
  
Create	
  a	
  new	
  file	
  
•    Right-­‐click	
  burp	
  package	
  >	
  New	
  >	
  File	
  
•    Accept	
  the	
  default	
  locaJon	
  of	
  src	
  
•    Enter	
  BurpExtender.java	
  as	
  the	
  filename	
  
•    Click	
  Finish	
  
We’re	
  ready	
  to	
  type	
  
Loading	
  external	
  classes	
  
•  We	
  need	
  to	
  tell	
  Java	
  about	
  external	
  classes	
  
    •    Ruby	
  has	
  require	
  
    •    PHP	
  has	
  include	
  or	
  require	
  
    •    Perl	
  has	
  require	
  
    •    C	
  has	
  include	
  
    •    Java	
  uses	
  import	
  
Where	
  is	
  Burp?	
  
•  We	
  added	
  external	
  JARs	
  in	
  Eclipse	
  
•  Only	
  helps	
  at	
  compilaJon	
  
•  Need	
  to	
  tell	
  our	
  code	
  about	
  classes	
  
    •  import	
  burp.*;	
  
IBurpExtender	
  
•  Available	
  at	
  
   hOp://portswigger.net/burp/extender/burp/IBurpExtender.html	
  


    •  “	
  ImplementaJons	
  must	
  be	
  called	
  BurpExtender,	
  
       in	
  the	
  package	
  burp,	
  must	
  be	
  declared	
  public,	
  and	
  
       must	
  provide	
  a	
  default	
  (public,	
  no-­‐argument)	
  
       constructor”	
  
In	
  other	
  words	
  
public	
  class	
  BurpExtender	
  
{	
  
      	
  	
  
}	
  

•  Remember,	
  Java	
  makes	
  you	
  name	
  files	
  amer	
  
   the	
  class	
  so	
  that’s	
  why	
  we	
  named	
  it	
  
   BurpExtender.java	
  
Add	
  this	
  
package	
  burp;	
  


import	
  burp.*;	
  


public	
  class	
  BurpExtender	
  
{	
  
	
  	
  	
  	
  public	
  void	
  processHOpMessage(	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  String	
  toolName,	
  	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  boolean	
  messageIsRequest,	
  	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  IHOpRequestResponse	
  messageInfo)	
  throws	
  ExcepJon	
  
	
  	
  	
  	
  {	
  
	
  	
  	
  	
                                    	
  System.out.println("Hello	
  World!");	
  
	
  	
  	
  	
  }	
  
Run	
  the	
  program	
  
•  Run	
  >	
  Run	
  
•  First	
  Jme	
  we	
  do	
  this	
  it’ll	
  ask	
  what	
  to	
  run	
  as	
  
•  Select	
  Java	
  Applica0on	
  
Select	
  Java	
  ApplicaJon	
  
•  Under	
  Matching	
  items	
  select	
  StartBurp	
  –	
  burp	
  
•  Click	
  OK	
  
Burp	
  runs	
  
•  Check	
  Alerts	
  tab	
  
•  View	
  registraJon	
  of	
  BurpExtender	
  class	
  
Console	
  output	
  
•  The	
  console	
  window	
  shows	
  output	
  from	
  the	
  
   applicaJon	
  
•  Note	
  the	
  “Hello	
  World!”s	
  
CongratulaJons	
  
What’s	
  happening?	
  
•  Why	
  is	
  it	
  spamming	
  “Hello	
  World!”	
  to	
  the	
  
   console?	
  
•  We	
  defined	
  processHOpMessage()	
  
•  hOp://portswigger.net/burp/extender/burp/
   IBurpExtender.html	
  
    •  “This	
  method	
  is	
  invoked	
  whenever	
  any	
  of	
  Burp's	
  
       tools	
  makes	
  an	
  HTTP	
  request	
  or	
  receives	
  a	
  
       response”	
  
Burp	
  Suite	
  Flow	
  
RepeatAmerMeClient.exe	
  




       processProxyMessage	
  




        processHOpMessage	
  


                                      Burp	
  Suite	
  


hOp://wc•ox/RepeaterService.svc	
  
We’ve	
  got	
  to	
  do	
  a	
  few	
  things	
  
•    Split	
  the	
  HTTP	
  Headers	
  from	
  FI	
  body	
  
•    Decode	
  FI	
  body	
  
•    Display	
  in	
  Burp	
  
•    Re-­‐encode	
  modified	
  version	
  
•    Append	
  to	
  headers	
  
•    Send	
  to	
  web	
  server	
  
•    Then	
  the	
  same	
  in	
  reverse	
  
•  Right-­‐click	
  Project	
  >	
  Build	
  Path	
  >	
  Add	
  External	
  
   Archives	
  
•  Select	
  FastInfoset.jar	
  
•  Note	
  that	
  imports	
  are	
  now	
  yellow	
  
Decoding	
  the	
  FasJnfoset	
  to	
  
            console	
  
First:	
  we	
  get	
  it	
  wrong	
  
•  Burp	
  returns	
  message	
  body	
  as	
  byte[]	
  
•  Hmm,	
  bytes	
  are	
  hard,	
  let’s	
  convert	
  to	
  String	
  
•  Split	
  on	
  rnrn	
  
Then	
  we	
  do	
  it	
  right	
  
•  FasJnfoset	
  is	
  a	
  binary	
  encoding	
  
•  Don’t	
  try	
  and	
  convert	
  it	
  to	
  a	
  String	
  
•  Now	
  things	
  work	
  
Decoding	
  FasJnfoset	
  through	
  
              Proxy	
  
We’re	
  nearly	
  there……	
  
Running	
  outside	
  of	
  Eclipse	
  
•  Plugin	
  is	
  working	
  nicely,	
  now	
  what?	
  
•  Export	
  to	
  JAR	
  
•  Command	
  line	
  to	
  run	
  is:	
  

•  java	
  –jar	
  yourjar.jar;burp_pro_v1.4.12.jar	
  burp.startBurp	
  
LimitaJons	
  
•  We	
  haven’t	
  coded	
  to	
  handle/decode	
  the	
  
   response	
  
•  Just	
  do	
  the	
  same	
  in	
  reverse	
  
•  processHOpMessage	
  fires	
  before	
  
   processProxyMessage	
  so	
  we	
  can’t	
  alter	
  then	
  
   re-­‐encode	
  message	
  
•  SoluJon:	
  chain	
  two	
  Burp	
  instances	
  together	
  
AOribuJon	
  
•  All	
  lolcatz	
  courtesy	
  of	
  lolcats.com	
  
•  No	
  cats	
  were	
  harming	
  in	
  the	
  making	
  of	
  this	
  
   workshop	
  
•  Though	
  some	
  keyboards	
  were….	
  
QuesJons	
  
                                                                          	
  
	
  



                                                                     ?	
  

www.7elements.co.uk	
  |	
  blog.7elements.co.uk	
  |	
  @7elements	
  
www.7elements.co.uk	
  |	
  blog.7elements.co.uk	
  |	
  @7elements	
  

Contenu connexe

Tendances

Java 7 Whats New(), Whats Next() from Oredev
Java 7 Whats New(), Whats Next() from OredevJava 7 Whats New(), Whats Next() from Oredev
Java 7 Whats New(), Whats Next() from OredevMattias Karlsson
 
Java byte code & virtual machine
Java byte code & virtual machineJava byte code & virtual machine
Java byte code & virtual machineLaxman Puri
 
Polyglot Plugin Programming
Polyglot Plugin ProgrammingPolyglot Plugin Programming
Polyglot Plugin ProgrammingAtlassian
 
Steelcon 2014 - Process Injection with Python
Steelcon 2014 - Process Injection with PythonSteelcon 2014 - Process Injection with Python
Steelcon 2014 - Process Injection with Pythoninfodox
 
Java, Ruby & Rails
Java, Ruby & RailsJava, Ruby & Rails
Java, Ruby & RailsPeter Lind
 
Virtual Bolt Workshop - March 16, 2020
Virtual Bolt Workshop - March 16, 2020Virtual Bolt Workshop - March 16, 2020
Virtual Bolt Workshop - March 16, 2020Puppet
 
Modern Java Workshop
Modern Java WorkshopModern Java Workshop
Modern Java WorkshopSimon Ritter
 
Alive and Well with Java 8
Alive and Well with Java 8Alive and Well with Java 8
Alive and Well with Java 8Adam Pelsoczi
 
Migrating to Java 11
Migrating to Java 11Migrating to Java 11
Migrating to Java 11Arto Santala
 
Ahead-Of-Time Compilation of Java Applications
Ahead-Of-Time Compilation of Java ApplicationsAhead-Of-Time Compilation of Java Applications
Ahead-Of-Time Compilation of Java ApplicationsNikita Lipsky
 
How to implement a simple dalvik virtual machine
How to implement a simple dalvik virtual machineHow to implement a simple dalvik virtual machine
How to implement a simple dalvik virtual machineChun-Yu Wang
 
Introduction to Groovy Monkey
Introduction to Groovy MonkeyIntroduction to Groovy Monkey
Introduction to Groovy Monkeyjervin
 
Create *real* modular Java applications - a brief introduction -
Create *real* modular Java applications - a brief introduction -Create *real* modular Java applications - a brief introduction -
Create *real* modular Java applications - a brief introduction -Jeffrey Groneberg
 
Modern Java Concurrency
Modern Java ConcurrencyModern Java Concurrency
Modern Java ConcurrencyBen Evans
 
A peek into Python's Metaclass and Bytecode from a Smalltalk User
A peek into Python's Metaclass and Bytecode from a Smalltalk UserA peek into Python's Metaclass and Bytecode from a Smalltalk User
A peek into Python's Metaclass and Bytecode from a Smalltalk UserKoan-Sin Tan
 
Java Bytecode For Discriminating Developers - GeeCON 2011
Java Bytecode For Discriminating Developers - GeeCON 2011Java Bytecode For Discriminating Developers - GeeCON 2011
Java Bytecode For Discriminating Developers - GeeCON 2011Anton Arhipov
 
Xopus Application Framework
Xopus Application FrameworkXopus Application Framework
Xopus Application FrameworkJady Yang
 

Tendances (19)

Java 7 Whats New(), Whats Next() from Oredev
Java 7 Whats New(), Whats Next() from OredevJava 7 Whats New(), Whats Next() from Oredev
Java 7 Whats New(), Whats Next() from Oredev
 
Java byte code & virtual machine
Java byte code & virtual machineJava byte code & virtual machine
Java byte code & virtual machine
 
Java platform
Java platformJava platform
Java platform
 
Polyglot Plugin Programming
Polyglot Plugin ProgrammingPolyglot Plugin Programming
Polyglot Plugin Programming
 
Steelcon 2014 - Process Injection with Python
Steelcon 2014 - Process Injection with PythonSteelcon 2014 - Process Injection with Python
Steelcon 2014 - Process Injection with Python
 
Java, Ruby & Rails
Java, Ruby & RailsJava, Ruby & Rails
Java, Ruby & Rails
 
Virtual Bolt Workshop - March 16, 2020
Virtual Bolt Workshop - March 16, 2020Virtual Bolt Workshop - March 16, 2020
Virtual Bolt Workshop - March 16, 2020
 
Modern Java Workshop
Modern Java WorkshopModern Java Workshop
Modern Java Workshop
 
Alive and Well with Java 8
Alive and Well with Java 8Alive and Well with Java 8
Alive and Well with Java 8
 
Migrating to Java 11
Migrating to Java 11Migrating to Java 11
Migrating to Java 11
 
Ahead-Of-Time Compilation of Java Applications
Ahead-Of-Time Compilation of Java ApplicationsAhead-Of-Time Compilation of Java Applications
Ahead-Of-Time Compilation of Java Applications
 
How to implement a simple dalvik virtual machine
How to implement a simple dalvik virtual machineHow to implement a simple dalvik virtual machine
How to implement a simple dalvik virtual machine
 
Introduction to Groovy Monkey
Introduction to Groovy MonkeyIntroduction to Groovy Monkey
Introduction to Groovy Monkey
 
Create *real* modular Java applications - a brief introduction -
Create *real* modular Java applications - a brief introduction -Create *real* modular Java applications - a brief introduction -
Create *real* modular Java applications - a brief introduction -
 
Django in the Real World
Django in the Real WorldDjango in the Real World
Django in the Real World
 
Modern Java Concurrency
Modern Java ConcurrencyModern Java Concurrency
Modern Java Concurrency
 
A peek into Python's Metaclass and Bytecode from a Smalltalk User
A peek into Python's Metaclass and Bytecode from a Smalltalk UserA peek into Python's Metaclass and Bytecode from a Smalltalk User
A peek into Python's Metaclass and Bytecode from a Smalltalk User
 
Java Bytecode For Discriminating Developers - GeeCON 2011
Java Bytecode For Discriminating Developers - GeeCON 2011Java Bytecode For Discriminating Developers - GeeCON 2011
Java Bytecode For Discriminating Developers - GeeCON 2011
 
Xopus Application Framework
Xopus Application FrameworkXopus Application Framework
Xopus Application Framework
 

Similaire à Burp Plugin Development for Java n00bs - 44CON 2012

Burp plugin development for java n00bs (44 con)
Burp plugin development for java n00bs (44 con)Burp plugin development for java n00bs (44 con)
Burp plugin development for java n00bs (44 con)Marc Wickenden
 
Introduction to java
Introduction to javaIntroduction to java
Introduction to javaattiqrocket
 
Packaging perl (LPW2010)
Packaging perl (LPW2010)Packaging perl (LPW2010)
Packaging perl (LPW2010)p3castro
 
JavaOne 2011 - JVM Bytecode for Dummies
JavaOne 2011 - JVM Bytecode for DummiesJavaOne 2011 - JVM Bytecode for Dummies
JavaOne 2011 - JVM Bytecode for DummiesCharles Nutter
 
Fundamentals of java --- version 2
Fundamentals of java --- version 2Fundamentals of java --- version 2
Fundamentals of java --- version 2Uday Sharma
 
Introduction to the intermediate Python - v1.1
Introduction to the intermediate Python - v1.1Introduction to the intermediate Python - v1.1
Introduction to the intermediate Python - v1.1Andrei KUCHARAVY
 
Getting Started with Go
Getting Started with GoGetting Started with Go
Getting Started with GoSteven Francia
 
basic core java up to operator
basic core java up to operatorbasic core java up to operator
basic core java up to operatorkamal kotecha
 
[HES2013] Virtually secure, analysis to remote root 0day on an industry leadi...
[HES2013] Virtually secure, analysis to remote root 0day on an industry leadi...[HES2013] Virtually secure, analysis to remote root 0day on an industry leadi...
[HES2013] Virtually secure, analysis to remote root 0day on an industry leadi...Hackito Ergo Sum
 
GOTO Night with Charles Nutter Slides
GOTO Night with Charles Nutter SlidesGOTO Night with Charles Nutter Slides
GOTO Night with Charles Nutter SlidesAlexandra Masterson
 
Expert JavaScript Programming
Expert JavaScript ProgrammingExpert JavaScript Programming
Expert JavaScript ProgrammingYoshiki Shibukawa
 
Beyond JVM - YOW! Brisbane 2013
Beyond JVM - YOW! Brisbane 2013Beyond JVM - YOW! Brisbane 2013
Beyond JVM - YOW! Brisbane 2013Charles Nutter
 
Package manages and Puppet - PuppetConf 2015
Package manages and Puppet - PuppetConf 2015Package manages and Puppet - PuppetConf 2015
Package manages and Puppet - PuppetConf 2015ice799
 
The State of Managed Runtimes 2013, by Attila Szegedi
The State of Managed Runtimes 2013, by Attila SzegediThe State of Managed Runtimes 2013, by Attila Szegedi
The State of Managed Runtimes 2013, by Attila SzegediZeroTurnaround
 

Similaire à Burp Plugin Development for Java n00bs - 44CON 2012 (20)

Burp plugin development for java n00bs (44 con)
Burp plugin development for java n00bs (44 con)Burp plugin development for java n00bs (44 con)
Burp plugin development for java n00bs (44 con)
 
Lesson1 intro
Lesson1 introLesson1 intro
Lesson1 intro
 
Lesson1 intro
Lesson1 introLesson1 intro
Lesson1 intro
 
Introduction to java
Introduction to javaIntroduction to java
Introduction to java
 
Presentation on java
Presentation  on  javaPresentation  on  java
Presentation on java
 
Packaging perl (LPW2010)
Packaging perl (LPW2010)Packaging perl (LPW2010)
Packaging perl (LPW2010)
 
JavaOne 2011 - JVM Bytecode for Dummies
JavaOne 2011 - JVM Bytecode for DummiesJavaOne 2011 - JVM Bytecode for Dummies
JavaOne 2011 - JVM Bytecode for Dummies
 
Fundamentals of java --- version 2
Fundamentals of java --- version 2Fundamentals of java --- version 2
Fundamentals of java --- version 2
 
Introduction to the intermediate Python - v1.1
Introduction to the intermediate Python - v1.1Introduction to the intermediate Python - v1.1
Introduction to the intermediate Python - v1.1
 
Getting Started with Go
Getting Started with GoGetting Started with Go
Getting Started with Go
 
Java goes wild, lesson 1
Java goes wild, lesson 1Java goes wild, lesson 1
Java goes wild, lesson 1
 
basic core java up to operator
basic core java up to operatorbasic core java up to operator
basic core java up to operator
 
[HES2013] Virtually secure, analysis to remote root 0day on an industry leadi...
[HES2013] Virtually secure, analysis to remote root 0day on an industry leadi...[HES2013] Virtually secure, analysis to remote root 0day on an industry leadi...
[HES2013] Virtually secure, analysis to remote root 0day on an industry leadi...
 
GOTO Night with Charles Nutter Slides
GOTO Night with Charles Nutter SlidesGOTO Night with Charles Nutter Slides
GOTO Night with Charles Nutter Slides
 
Expert JavaScript Programming
Expert JavaScript ProgrammingExpert JavaScript Programming
Expert JavaScript Programming
 
Beyond JVM - YOW! Brisbane 2013
Beyond JVM - YOW! Brisbane 2013Beyond JVM - YOW! Brisbane 2013
Beyond JVM - YOW! Brisbane 2013
 
Package manages and Puppet - PuppetConf 2015
Package manages and Puppet - PuppetConf 2015Package manages and Puppet - PuppetConf 2015
Package manages and Puppet - PuppetConf 2015
 
The State of Managed Runtimes 2013, by Attila Szegedi
The State of Managed Runtimes 2013, by Attila SzegediThe State of Managed Runtimes 2013, by Attila Szegedi
The State of Managed Runtimes 2013, by Attila Szegedi
 
CDI In Real Life
CDI In Real LifeCDI In Real Life
CDI In Real Life
 
CS8392 OOP
CS8392 OOPCS8392 OOP
CS8392 OOP
 

Plus de 44CON

They're All Scorpions - Successful SecOps in a Hostile Workplace - Pete Herzo...
They're All Scorpions - Successful SecOps in a Hostile Workplace - Pete Herzo...They're All Scorpions - Successful SecOps in a Hostile Workplace - Pete Herzo...
They're All Scorpions - Successful SecOps in a Hostile Workplace - Pete Herzo...44CON
 
How to Explain Post-Quantum Cryptography to a Middle School Student - Klaus S...
How to Explain Post-Quantum Cryptography to a Middle School Student - Klaus S...How to Explain Post-Quantum Cryptography to a Middle School Student - Klaus S...
How to Explain Post-Quantum Cryptography to a Middle School Student - Klaus S...44CON
 
Using SmartNICs to Provide Better Data Center Security - Jack Matheson - 44CO...
Using SmartNICs to Provide Better Data Center Security - Jack Matheson - 44CO...Using SmartNICs to Provide Better Data Center Security - Jack Matheson - 44CO...
Using SmartNICs to Provide Better Data Center Security - Jack Matheson - 44CO...44CON
 
JARVIS never saw it coming: Hacking machine learning (ML) in speech, text and...
JARVIS never saw it coming: Hacking machine learning (ML) in speech, text and...JARVIS never saw it coming: Hacking machine learning (ML) in speech, text and...
JARVIS never saw it coming: Hacking machine learning (ML) in speech, text and...44CON
 
Reverse Engineering and Bug Hunting on KMDF Drivers - Enrique Nissim - 44CON ...
Reverse Engineering and Bug Hunting on KMDF Drivers - Enrique Nissim - 44CON ...Reverse Engineering and Bug Hunting on KMDF Drivers - Enrique Nissim - 44CON ...
Reverse Engineering and Bug Hunting on KMDF Drivers - Enrique Nissim - 44CON ...44CON
 
The UK's Code of Practice for Security in Consumer IoT Products and Services ...
The UK's Code of Practice for Security in Consumer IoT Products and Services ...The UK's Code of Practice for Security in Consumer IoT Products and Services ...
The UK's Code of Practice for Security in Consumer IoT Products and Services ...44CON
 
Weak analogies make poor realities – are we sitting on a Security Debt Crisis...
Weak analogies make poor realities – are we sitting on a Security Debt Crisis...Weak analogies make poor realities – are we sitting on a Security Debt Crisis...
Weak analogies make poor realities – are we sitting on a Security Debt Crisis...44CON
 
Pwning the 44CON Nerf Tank
Pwning the 44CON Nerf TankPwning the 44CON Nerf Tank
Pwning the 44CON Nerf Tank44CON
 
Security module for php7 – Killing bugclasses and virtual-patching the rest! ...
Security module for php7 – Killing bugclasses and virtual-patching the rest! ...Security module for php7 – Killing bugclasses and virtual-patching the rest! ...
Security module for php7 – Killing bugclasses and virtual-patching the rest! ...44CON
 
44CON London 2015 - Stegosploit - Drive-by Browser Exploits using only Images
44CON London 2015 - Stegosploit - Drive-by Browser Exploits using only Images44CON London 2015 - Stegosploit - Drive-by Browser Exploits using only Images
44CON London 2015 - Stegosploit - Drive-by Browser Exploits using only Images44CON
 
44CON London 2015 - Is there an EFI monster inside your apple?
44CON London 2015 - Is there an EFI monster inside your apple?44CON London 2015 - Is there an EFI monster inside your apple?
44CON London 2015 - Is there an EFI monster inside your apple?44CON
 
44CON London 2015 - Indicators of Compromise: From malware analysis to eradic...
44CON London 2015 - Indicators of Compromise: From malware analysis to eradic...44CON London 2015 - Indicators of Compromise: From malware analysis to eradic...
44CON London 2015 - Indicators of Compromise: From malware analysis to eradic...44CON
 
44CON London 2015 - How to drive a malware analyst crazy
44CON London 2015 - How to drive a malware analyst crazy44CON London 2015 - How to drive a malware analyst crazy
44CON London 2015 - How to drive a malware analyst crazy44CON
 
44CON London 2015 - 15-Minute Linux Incident Response Live Analysis
44CON London 2015 - 15-Minute Linux Incident Response Live Analysis44CON London 2015 - 15-Minute Linux Incident Response Live Analysis
44CON London 2015 - 15-Minute Linux Incident Response Live Analysis44CON
 
44CON London 2015 - Going AUTH the Rails on a Crazy Train
44CON London 2015 - Going AUTH the Rails on a Crazy Train44CON London 2015 - Going AUTH the Rails on a Crazy Train
44CON London 2015 - Going AUTH the Rails on a Crazy Train44CON
 
44CON London 2015 - Software Defined Networking (SDN) Security
44CON London 2015 - Software Defined Networking (SDN) Security44CON London 2015 - Software Defined Networking (SDN) Security
44CON London 2015 - Software Defined Networking (SDN) Security44CON
 
44CON London 2015 - DDoS mitigation EPIC FAIL collection
44CON London 2015 - DDoS mitigation EPIC FAIL collection44CON London 2015 - DDoS mitigation EPIC FAIL collection
44CON London 2015 - DDoS mitigation EPIC FAIL collection44CON
 
44CON London 2015 - Hunting Asynchronous Vulnerabilities
44CON London 2015 - Hunting Asynchronous Vulnerabilities44CON London 2015 - Hunting Asynchronous Vulnerabilities
44CON London 2015 - Hunting Asynchronous Vulnerabilities44CON
 
44CON London 2015 - Reverse engineering and exploiting font rasterizers: the ...
44CON London 2015 - Reverse engineering and exploiting font rasterizers: the ...44CON London 2015 - Reverse engineering and exploiting font rasterizers: the ...
44CON London 2015 - Reverse engineering and exploiting font rasterizers: the ...44CON
 
44CON London 2015 - Jtagsploitation: 5 wires, 5 ways to root
44CON London 2015 - Jtagsploitation: 5 wires, 5 ways to root44CON London 2015 - Jtagsploitation: 5 wires, 5 ways to root
44CON London 2015 - Jtagsploitation: 5 wires, 5 ways to root44CON
 

Plus de 44CON (20)

They're All Scorpions - Successful SecOps in a Hostile Workplace - Pete Herzo...
They're All Scorpions - Successful SecOps in a Hostile Workplace - Pete Herzo...They're All Scorpions - Successful SecOps in a Hostile Workplace - Pete Herzo...
They're All Scorpions - Successful SecOps in a Hostile Workplace - Pete Herzo...
 
How to Explain Post-Quantum Cryptography to a Middle School Student - Klaus S...
How to Explain Post-Quantum Cryptography to a Middle School Student - Klaus S...How to Explain Post-Quantum Cryptography to a Middle School Student - Klaus S...
How to Explain Post-Quantum Cryptography to a Middle School Student - Klaus S...
 
Using SmartNICs to Provide Better Data Center Security - Jack Matheson - 44CO...
Using SmartNICs to Provide Better Data Center Security - Jack Matheson - 44CO...Using SmartNICs to Provide Better Data Center Security - Jack Matheson - 44CO...
Using SmartNICs to Provide Better Data Center Security - Jack Matheson - 44CO...
 
JARVIS never saw it coming: Hacking machine learning (ML) in speech, text and...
JARVIS never saw it coming: Hacking machine learning (ML) in speech, text and...JARVIS never saw it coming: Hacking machine learning (ML) in speech, text and...
JARVIS never saw it coming: Hacking machine learning (ML) in speech, text and...
 
Reverse Engineering and Bug Hunting on KMDF Drivers - Enrique Nissim - 44CON ...
Reverse Engineering and Bug Hunting on KMDF Drivers - Enrique Nissim - 44CON ...Reverse Engineering and Bug Hunting on KMDF Drivers - Enrique Nissim - 44CON ...
Reverse Engineering and Bug Hunting on KMDF Drivers - Enrique Nissim - 44CON ...
 
The UK's Code of Practice for Security in Consumer IoT Products and Services ...
The UK's Code of Practice for Security in Consumer IoT Products and Services ...The UK's Code of Practice for Security in Consumer IoT Products and Services ...
The UK's Code of Practice for Security in Consumer IoT Products and Services ...
 
Weak analogies make poor realities – are we sitting on a Security Debt Crisis...
Weak analogies make poor realities – are we sitting on a Security Debt Crisis...Weak analogies make poor realities – are we sitting on a Security Debt Crisis...
Weak analogies make poor realities – are we sitting on a Security Debt Crisis...
 
Pwning the 44CON Nerf Tank
Pwning the 44CON Nerf TankPwning the 44CON Nerf Tank
Pwning the 44CON Nerf Tank
 
Security module for php7 – Killing bugclasses and virtual-patching the rest! ...
Security module for php7 – Killing bugclasses and virtual-patching the rest! ...Security module for php7 – Killing bugclasses and virtual-patching the rest! ...
Security module for php7 – Killing bugclasses and virtual-patching the rest! ...
 
44CON London 2015 - Stegosploit - Drive-by Browser Exploits using only Images
44CON London 2015 - Stegosploit - Drive-by Browser Exploits using only Images44CON London 2015 - Stegosploit - Drive-by Browser Exploits using only Images
44CON London 2015 - Stegosploit - Drive-by Browser Exploits using only Images
 
44CON London 2015 - Is there an EFI monster inside your apple?
44CON London 2015 - Is there an EFI monster inside your apple?44CON London 2015 - Is there an EFI monster inside your apple?
44CON London 2015 - Is there an EFI monster inside your apple?
 
44CON London 2015 - Indicators of Compromise: From malware analysis to eradic...
44CON London 2015 - Indicators of Compromise: From malware analysis to eradic...44CON London 2015 - Indicators of Compromise: From malware analysis to eradic...
44CON London 2015 - Indicators of Compromise: From malware analysis to eradic...
 
44CON London 2015 - How to drive a malware analyst crazy
44CON London 2015 - How to drive a malware analyst crazy44CON London 2015 - How to drive a malware analyst crazy
44CON London 2015 - How to drive a malware analyst crazy
 
44CON London 2015 - 15-Minute Linux Incident Response Live Analysis
44CON London 2015 - 15-Minute Linux Incident Response Live Analysis44CON London 2015 - 15-Minute Linux Incident Response Live Analysis
44CON London 2015 - 15-Minute Linux Incident Response Live Analysis
 
44CON London 2015 - Going AUTH the Rails on a Crazy Train
44CON London 2015 - Going AUTH the Rails on a Crazy Train44CON London 2015 - Going AUTH the Rails on a Crazy Train
44CON London 2015 - Going AUTH the Rails on a Crazy Train
 
44CON London 2015 - Software Defined Networking (SDN) Security
44CON London 2015 - Software Defined Networking (SDN) Security44CON London 2015 - Software Defined Networking (SDN) Security
44CON London 2015 - Software Defined Networking (SDN) Security
 
44CON London 2015 - DDoS mitigation EPIC FAIL collection
44CON London 2015 - DDoS mitigation EPIC FAIL collection44CON London 2015 - DDoS mitigation EPIC FAIL collection
44CON London 2015 - DDoS mitigation EPIC FAIL collection
 
44CON London 2015 - Hunting Asynchronous Vulnerabilities
44CON London 2015 - Hunting Asynchronous Vulnerabilities44CON London 2015 - Hunting Asynchronous Vulnerabilities
44CON London 2015 - Hunting Asynchronous Vulnerabilities
 
44CON London 2015 - Reverse engineering and exploiting font rasterizers: the ...
44CON London 2015 - Reverse engineering and exploiting font rasterizers: the ...44CON London 2015 - Reverse engineering and exploiting font rasterizers: the ...
44CON London 2015 - Reverse engineering and exploiting font rasterizers: the ...
 
44CON London 2015 - Jtagsploitation: 5 wires, 5 ways to root
44CON London 2015 - Jtagsploitation: 5 wires, 5 ways to root44CON London 2015 - Jtagsploitation: 5 wires, 5 ways to root
44CON London 2015 - Jtagsploitation: 5 wires, 5 ways to root
 

Burp Plugin Development for Java n00bs - 44CON 2012

  • 1. Burp  Plugin  Development  for   Java  n00bs   44Con  2012   www.7elements.co.uk  |  blog.7elements.co.uk  |  @7elements  
  • 2. /me   •  Marc  Wickenden   •  Principal  Security  Consultant  at  7  Elements   •  Love  coding  (parJcularly  Ruby)   •  @marcwickenden  on  the  TwiOerz   •  Most  importantly  though…..   www.7elements.co.uk  |  blog.7elements.co.uk  |  @7elements  
  • 3. I  am  a  Java  n00b  
  • 4. If  you  already  know  Java   You’re  either:   •  In  the  wrong  room   •  About  to  be  really  offended!  
  • 5. Agenda   •  The  problem   •  GeZng  ready   •  IntroducJon  to  the  Eclipse  IDE   •  Burp  Extender  Hello  World!   •  ManipulaJng  runJme  data   •  Decoding  a  custom  encoding  scheme   •  “Shelling  out”  to  other  scripts   •  LimitaJons  of  Burp  Extender   •  Really  cool  Burp  plugins  already  out  there  to  fire   your  imaginaJon  
  • 7.
  • 8. The  problem   •  Burp  Suite  is  awesome   •  De  facto  web  app  tool   •  Open  source  alternaJves  don’t  compare   IMHO   •  Tools  available/cohesion/protocol  support   •  Burp  Extender  
  • 10. I  wrote  a  plugin   Coding  by  Google  FTW!  
  • 11. How?  -­‐  Burp  Extender   •  “allows  third-­‐party  developers  to  extend  the   funcJonality  of  Burp  Suite”   •  “Extensions  can  read  and  modify  Burp’s   runJme  data  and  configuraJon”   •  “iniJate  key  acJons”   •  “extend  Burp’s  user  interface”   hOp://portswigger.net/burp/extender/  
  • 12. Burp  Extender   •  Achieves  this  via  6  interfaces:   •  IBurpExtender   •  IBurpExtenderCallbacks   •  IHOpRequestResponse   •  IScanIssue   •  IScanQueueItem   •  IMenuItemHander  
  • 13. Java  101   •  Java  source  is  compiled  to  bytecode  (class  file)   •  Runs  on  Java  Virtual  Machine  (JVM)   •  Class-­‐based   •  OO   •  Write  once,  run  anywhere  (WORA)   •  Two  distribuJons:  JRE  and  JDK  
  • 14. Java  101  conJnued…   •  Usual  OO  stuff  applies:  objects,  classes,   methods,  properJes/variables   •  Lines  end  with  ;  
  • 15. Java  101  conJnued…   •  Source  files  must  be  named  amer  the  public   class  they  contain   •  public  keyword  denotes  method  can  be  called   from  code  in  other  classes  or  outside  class   hierarchy  
  • 16. Java  101  conJnued…   •  class  hierarchy  defined  by  directory  structure:   •  uk.co.sevenelements.HelloWorld  =  uk/co/ sevenelements/HelloWorld.class   •  JAR  file  is  essenJally  ZIP  file  of  classes/ directories  
  • 17. Java  101  conJnued…   •  void  keyword  indicates  method  will  not  return   data  to  the  caller   •  main  method  called  by  Java  launcher  to  pass   control  to  the  program   •  main  must  accept  array  of  String  objects  (args)  
  • 18. Java  101  conJnued…   •  Java  loads  class  (specified  on  CLI  or  in  JAR   META-­‐INF/MANIFEST.MF)  and  starts  public   sta0c  void  main  method   •  You’ve  seen  this  already  with  Burp:   •  java  –jar  burpsuite_pro_v1.4.12.jar  
  • 20.
  • 22. First  we  need  some  tools   •  Eclipse  IDE  –  de  facto  free  dev  tool  for  Java   •  Not  necessarily  the  best  or  easiest  thing  to  use   •  AlternaJves  to  consider:   •  Jet  Brains  IntelliJ  (my  personal  favourite)   •  NetBeans  (never  used)   •  Jcreator  (again,  never  used)   •  Terminal/vim/javac  <  MOAR  L33T  
  • 23. Download  Eclipse  Classic   Or  install  from  your  USB  drive  
  • 24. Eclipse  4.2  Classic   •  hOp://www.eclipse.org/downloads/sums.php?file=/eclipse/downloads/ drops4/R-­‐4.2-­‐201206081400/eclipse-­‐SDK-­‐4.2-­‐win32-­‐ x86_64.zip&type=sha1   •  6f4e6834c95e9573cbc1fc46adab4e39da6b4b6d     •  eclipse-­‐SDK-­‐4.2-­‐win32-­‐x86_64.zip   •  hOp://www.eclipse.org/downloads/sums.php?file=/eclipse/downloads/ drops4/R-­‐4.2-­‐201206081400/eclipse-­‐SDK-­‐4.2-­‐win32.zip&type=sha1   •  68b1eb33596dddaac9ac71473cd1b35f51af8df7     •  eclipse-­‐SDK-­‐4.2-­‐win32.zip  
  • 25. Java  JDK   •  Used  to  be  bundled  with  Eclipse   •  Due  to  licensing  (I  think)  this  is  no  longer  the   case   •  Grab  from  Sun  Oracle’s  website:   •  hOp://download.oracle.com/otn-­‐pub/java/jdk/7u7-­‐b11/jdk-­‐7u7-­‐windows-­‐ x64.exe?AuthParam=1347522941_2b61ee3cd1f38a0abd1be312c3990fe5    
  • 27. Create  a  Java  Project   •  File  >  New  >  Java  Project   •  Project  Name:  Burp  Hello  World!   •  Leave  everything  else  as  default   •  Click  Next  
  • 28.
  • 29. Java  SeZngs   •  Click  on  Libraries  tab   •  Add  External  JARs   •  Select  your  burpsuite.jar   •  Click  Finish  
  • 30. Create  a  new  package   •  File  >  New  >  Package   •  Enter  burp  as  the  name   •  Click  Finish  
  • 31. Create  a  new  file   •  Right-­‐click  burp  package  >  New  >  File   •  Accept  the  default  locaJon  of  src   •  Enter  BurpExtender.java  as  the  filename   •  Click  Finish  
  • 32.
  • 33. We’re  ready  to  type  
  • 34. Loading  external  classes   •  We  need  to  tell  Java  about  external  classes   •  Ruby  has  require   •  PHP  has  include  or  require   •  Perl  has  require   •  C  has  include   •  Java  uses  import  
  • 35. Where  is  Burp?   •  We  added  external  JARs  in  Eclipse   •  Only  helps  at  compilaJon   •  Need  to  tell  our  code  about  classes   •  import  burp.*;  
  • 36. IBurpExtender   •  Available  at   hOp://portswigger.net/burp/extender/burp/IBurpExtender.html   •  “  ImplementaJons  must  be  called  BurpExtender,   in  the  package  burp,  must  be  declared  public,  and   must  provide  a  default  (public,  no-­‐argument)   constructor”  
  • 37. In  other  words   public  class  BurpExtender   {       }   •  Remember,  Java  makes  you  name  files  amer   the  class  so  that’s  why  we  named  it   BurpExtender.java  
  • 38. Add  this   package  burp;   import  burp.*;   public  class  BurpExtender   {          public  void  processHOpMessage(                          String  toolName,                            boolean  messageIsRequest,                            IHOpRequestResponse  messageInfo)  throws  ExcepJon          {            System.out.println("Hello  World!");          }  
  • 39. Run  the  program   •  Run  >  Run   •  First  Jme  we  do  this  it’ll  ask  what  to  run  as   •  Select  Java  Applica0on  
  • 40. Select  Java  ApplicaJon   •  Under  Matching  items  select  StartBurp  –  burp   •  Click  OK  
  • 41. Burp  runs   •  Check  Alerts  tab   •  View  registraJon  of  BurpExtender  class  
  • 42. Console  output   •  The  console  window  shows  output  from  the   applicaJon   •  Note  the  “Hello  World!”s  
  • 44.
  • 45. What’s  happening?   •  Why  is  it  spamming  “Hello  World!”  to  the   console?   •  We  defined  processHOpMessage()   •  hOp://portswigger.net/burp/extender/burp/ IBurpExtender.html   •  “This  method  is  invoked  whenever  any  of  Burp's   tools  makes  an  HTTP  request  or  receives  a   response”  
  • 47. RepeatAmerMeClient.exe   processProxyMessage   processHOpMessage   Burp  Suite   hOp://wc•ox/RepeaterService.svc  
  • 48.
  • 49. We’ve  got  to  do  a  few  things   •  Split  the  HTTP  Headers  from  FI  body   •  Decode  FI  body   •  Display  in  Burp   •  Re-­‐encode  modified  version   •  Append  to  headers   •  Send  to  web  server   •  Then  the  same  in  reverse  
  • 50.
  • 51. •  Right-­‐click  Project  >  Build  Path  >  Add  External   Archives   •  Select  FastInfoset.jar   •  Note  that  imports  are  now  yellow  
  • 52. Decoding  the  FasJnfoset  to   console  
  • 53. First:  we  get  it  wrong   •  Burp  returns  message  body  as  byte[]   •  Hmm,  bytes  are  hard,  let’s  convert  to  String   •  Split  on  rnrn  
  • 54.
  • 55. Then  we  do  it  right   •  FasJnfoset  is  a  binary  encoding   •  Don’t  try  and  convert  it  to  a  String   •  Now  things  work  
  • 56.
  • 58.
  • 60.
  • 61. Running  outside  of  Eclipse   •  Plugin  is  working  nicely,  now  what?   •  Export  to  JAR   •  Command  line  to  run  is:   •  java  –jar  yourjar.jar;burp_pro_v1.4.12.jar  burp.startBurp  
  • 62. LimitaJons   •  We  haven’t  coded  to  handle/decode  the   response   •  Just  do  the  same  in  reverse   •  processHOpMessage  fires  before   processProxyMessage  so  we  can’t  alter  then   re-­‐encode  message   •  SoluJon:  chain  two  Burp  instances  together  
  • 63. AOribuJon   •  All  lolcatz  courtesy  of  lolcats.com   •  No  cats  were  harming  in  the  making  of  this   workshop   •  Though  some  keyboards  were….  
  • 64. QuesJons       ?   www.7elements.co.uk  |  blog.7elements.co.uk  |  @7elements