SlideShare a Scribd company logo
1 of 169
Download to read offline
Defense	
  by	
  Numb3r5	
  
	
  
Making	
  problems	
  for	
  script	
  k1dd13s	
  
and	
  scanner	
  monkeys	
  
@ChrisJohnRiley	
  
“THE	
  WISEST	
  MAN,	
  IS	
  HE	
  
WHO	
  KNOWS,	
  THAT	
  HE	
  
KNOWS	
  NOTHING”	
  
	
  
	
  
SOCRATES:	
  APOLOGY,	
  21D	
  
This	
  talk	
  contains:	
  
	
  - Numbers
- Bad Jokes
- Traces of peanuts
- Did I mention numbers?
	
  	
  
TL	
  ;DR	
  
Goals	
  for	
  this	
  talk	
  
Describe	
  the	
  
defensive	
  uses	
  of	
  
HTTP	
  status	
  codes	
  
1)  What	
  
2)  Why	
  
3)  How	
  
4)  Goals	
  
5)  Bringing	
  it	
  together	
  
6)  Review	
  
#1	
  
]	
  [	
  WHAT ?
HTTP	
  STATUS	
  CODES	
  
Seems	
  like	
  such	
  a	
  	
  
Small	
  detail	
  
…	
  small	
  detail,	
  
big	
  impact	
  
HTTP	
  Status	
  Codes	
  
§  Majority	
  part	
  of	
  RFC	
  2616	
  (HTTP/1.1)	
  
§  5	
  main	
  classes	
  of	
  response	
  
§  1XX	
  informaOonal	
  
§  2XX	
  success	
  
§  3XX	
  redirecOon	
  
§  4XX	
  client	
  error	
  
§  5XX	
  server	
  error	
  
HTTP	
  Status	
  Codes	
  
§  Proposed	
  RFC*	
  for	
  7XX	
  codes	
  
§  Examples:	
  
§  701	
  Meh	
  
§  719	
  I	
  am	
  not	
  a	
  teapot	
  
§  721	
  Known	
  unknowns	
  
§  722	
  Unknown	
  unknowns	
  
§  732	
  Fucking	
  Unic☐de	
  
*	
  h]ps://github.com/joho/7XX-­‐rfc	
  
BASICS	
  
AKA:	
  THE	
  BORING	
  THEORY	
  BIT	
  
#1.1	
  
1XX	
  Informaeonal	
  
§  Indicates	
  response	
  received	
  
§  Processing	
  is	
  not	
  yet	
  completed	
  
§  100	
  Conenue	
  
§  101	
  Switching	
  Protocols	
  
§  102	
  Processing	
  (WebDAV	
  RFC	
  2518)	
  
2XX	
  Success	
  
§  Indicates	
  response	
  received	
  
§  Processed	
  and	
  understood	
  
§  200	
  OK	
  
§  201	
  Created	
  
§  202	
  Accepted	
  
§  203	
  Non-­‐Authoritaeve	
  Informaeon	
  
§  204	
  No	
  Content	
  
2XX	
  Success	
  (cont.)	
  
§  205	
  Reset	
  Content	
  
§  206	
  Pareal	
  Content	
  
§  207	
  Mule-­‐Status	
  (WebDAV	
  RFC	
  4918)	
  
Codes	
  not	
  supported	
  by	
  Apache	
  
§  208	
  Already	
  Reported	
  
§  226	
  IM	
  Used	
  
§  250	
  Low	
  on	
  Storage	
  Space	
  
3XX	
  Redireceon	
  
§  Aceon	
  required	
  to	
  complete	
  request	
  
§  300	
  Muleple	
  Choices	
  
§  301	
  Moved	
  Permanently	
  
§  302	
  Found	
  (Moved	
  Temporarily)	
  
§  303	
  See	
  Other	
  
§  304	
  Not	
  Modified	
  
3XX	
  Redireceon	
  (cont.)	
  
§  305	
  Use	
  Proxy	
  
§  306	
  Switch	
  Proxy	
  (unused)	
  
§  307	
  Temporary	
  Redirect	
  
Codes	
  not	
  supported	
  by	
  Apache	
  
§  308	
  Permanent	
  Redirect	
  
4XX	
  Client	
  Error	
  
§  Client	
  caused	
  an	
  error	
  
§  400	
  Bad	
  Request	
  
§  401	
  Unauthorized	
  
§  402	
  Payment	
  Required	
  
§  403	
  Forbidden	
  
§  404	
  Not	
  Found	
  
§  405	
  Method	
  Not	
  Allowed	
  
4XX	
  Client	
  Error	
  (cont.)	
  
§  406	
  Not	
  Accessible	
  
§  407	
  Proxy	
  Authenecaeon	
  Required	
  
§  408	
  Request	
  Timeout	
  
§  409	
  Conflict	
  
§  410	
  Gone	
  
§  411	
  Length	
  Required	
  
4XX	
  Client	
  Error	
  (cont.)	
  
§  412	
  Precondieon	
  Failed	
  
§  413	
  Request	
  Enety	
  Too	
  Large	
  
§  414	
  Request-­‐URI	
  Too	
  Long	
  
§  415	
  Unsupported	
  Media	
  Type	
  
§  416	
  Request	
  Range	
  Not	
  Saesfiable	
  
§  417	
  Expectaeon	
  Failed	
  
§  418	
  I’m	
  a	
  Teapot	
  (IETF	
  April	
  Fools	
  RFC	
  2324)	
  
4XX	
  Client	
  Error	
  (cont.)	
  
§  419	
  /	
  420	
  /	
  421	
  Unused	
  
§  422	
  Unprocessable	
  Enety	
  (RFC	
  4918)	
  
§  423	
  Locked	
  (RFC	
  4918)	
  
§  424	
  Failed	
  Dependency	
  (RFC	
  4918)	
  
§  425	
  No	
  Code	
  /	
  Unordered	
  Colleceon	
  
§  426	
  Upgrade	
  Required	
  (RFC	
  2817)	
  
4XX	
  Client	
  Error	
  (cont.)	
  
Codes	
  not	
  supported	
  by	
  Apache	
  
§  428	
  Precondieon	
  Required	
  
§  429	
  Too	
  Many	
  Requests	
  
§  431	
  Request	
  Header	
  Fields	
  Too	
  Large	
  
§  444	
  No	
  Response	
  (NGINX)	
  
§  449	
  Retry	
  With	
  (Microsoo)	
  
§  450	
  Blocked	
  by	
  Win.	
  Parental	
  Controls	
  
§  451	
  Unavailable	
  For	
  Legal	
  Reasons	
  
§  494	
  Request	
  Header	
  Too	
  Large	
  (NGINX)	
  
§  495	
  Cert	
  Error	
  (NGINX)	
  
§  496	
  No	
  Cert	
  (NGINX)	
  
§  497	
  HTTP	
  to	
  HTTPS	
  (NGINX)	
  
§  499	
  Client	
  Closed	
  Request	
  (NGINX)	
  
5XX	
  Server	
  Error	
  
§  Server	
  error	
  occurred	
  
§  500	
  Internal	
  Server	
  Error	
  
§  501	
  Not	
  Implemented	
  
§  502	
  Bad	
  Gateway	
  
§  503	
  Service	
  Unavailable	
  
§  504	
  Gateway	
  Timeout	
  
§  505	
  HTTP	
  Version	
  Not	
  supported	
  
5XX	
  Server	
  Error	
  (cont.)	
  
§  506	
  Variant	
  Also	
  Negoeates	
  (RFC	
  2295)	
  
§  507	
  Insufficient	
  Storage	
  (WebDAV	
  RFC	
  4918)	
  
§  508	
  Loop	
  Detected	
  (WebDAV	
  RFC	
  5842)	
  
§  509	
  Bandwidth	
  Limit	
  Exceeded	
  (apache	
  ext.)	
  	
  
§  510	
  Not	
  Extended	
  (RFC	
  2274)	
  
Codes	
  not	
  supported	
  by	
  Apache	
  
§  511	
  Network	
  Authenecaeon	
  Required	
  (RFC	
  6585)	
  
§  550	
  Permission	
  Denied	
  
§  598	
  Network	
  Read	
  Timeout	
  Error	
  (Microsoo	
  Proxy)	
  
§  599	
  Network	
  Conneceon	
  Timeout	
  Error	
  (Microsoo	
  Proxy)	
  
OMG	
  Enough	
  with	
  
the	
  numb3rs	
  
already!!!!	
  
#2	
  
]	
  [	
  WHY?
It	
  started	
  as	
  a	
  simple	
  idea…	
  
?	
  
?	
  
?	
  
…	
  and	
  started	
  to	
  think	
  
SCREW	
  WITH	
  
SCANNERS	
  
…	
  AND	
  SCRIPT	
  
K1DD13S	
  
THAT	
  SOUNDS	
  
LIKE	
  FUN!	
  
@thegrugq	
  26	
  Feb	
  2013	
  
@thegrugq	
  26	
  Feb	
  2013	
  
INCREASE	
  
ATTACKER	
  COSTS	
  
$	
  $	
  
$	
  
WASTE	
  
ATTACKER	
  TIME	
  
-­‐  When	
  the	
  tables	
  turn	
  (2004)	
  	
  
-­‐  Roelof	
  Temmingh,	
  Haroon	
  Meer,	
  Charl	
  van	
  der	
  Walt	
  
-­‐  h]p://slideshare.net/sensepost/strikeback	
  
-­‐  Stopping	
  Automated	
  A]ack	
  Tools	
  (2006)	
  
-­‐  Gunter	
  Ollmann	
  
-­‐  h]p://www.technicalinfo.net/papers/
StoppingAutomatedA]ackTools.html	
  	
  
Prior	
  Art	
  
-­‐  mod-­‐security	
  mailing	
  list	
  (2006)	
  	
  
-­‐  Status	
  Code	
  503	
  together	
  w/	
  Retry-­‐Aoer	
  header	
  
-­‐  Ryan	
  BarneW	
  
-­‐  h]p://bb10.com/apache-­‐mod-­‐security-­‐user/
2006-­‐12/msg00042.html	
  
Prior	
  Art	
  
SecFilterDefaultAceon	
  "deny,log,status:503"	
  
SecFilter	
  ".*"	
  
Header	
  set	
  Retry-­‐Aoer	
  "120"	
  
#3	
  
]	
  [	
  HOW?
BROWSERS	
  HAVE	
  
TO	
  BE	
  FLEXIBLE	
  
THIS	
  LEADS	
  TO	
  
INTERPRETATION	
  
…	
  which	
  leads	
  to	
  the	
  dark-­‐side	
  
RFCS…	
  	
  
THEY’RE	
  MORE	
  OF	
  A	
  
GUIDELINE	
  REALLY	
  
WHAT COULD POSSIBLY GO
WRONG!
TESTING	
  
THE	
  HOW	
  OF	
  THE	
  THING!	
  
#3.1	
  
§  Restricted	
  research	
  to	
  the	
  big	
  3	
  
§  Internet	
  Explorer	
  
§  Chrome	
  /	
  Chromium	
  
§  Firefox	
  
NO…	
  SAFARI	
  ISN’T	
  
IN	
  THE	
  TOP	
  10	
  3	
  
OPERA	
  JUMPED…	
  
…or	
  was	
  it	
  pushed?	
  
LYNX	
  
THE	
  UNREALISTIC	
  OPTION	
  
§  MITMproxy	
  /	
  MITMdump	
  
§  Python-­‐based	
  
§  Simple	
  to	
  setup	
  proxy	
  /	
  reverse	
  proxy	
  
§  Script-­‐based	
  aceons	
  
§  PHP	
  
§  Ability	
  to	
  set	
  response	
  code	
  
§  Must	
  be	
  at	
  the	
  top	
  of	
  the	
  PHP	
  code	
  
§  Can	
  be	
  added	
  to	
  php.ini	
  
§  auto-­‐prepend-­‐file	
  =	
  /full/path	
  
§  Limited	
  by	
  web-­‐server	
  (apache)	
  
#	
  set	
  response	
  code	
  
Header($_server[“SERVER_PROTOCOL”].	
  ”	
  $status_code”);	
  
§  Teseng	
  browsers	
  automaecally	
  
§  Created	
  PHP	
  file	
  to	
  set	
  status	
  code	
  
§  h]p://c22.cc/POC/respcode.php?code=XXX	
  
BROWSERS	
  
…	
  AND	
  THEIR	
  STATUS	
  CODE	
  HABITS	
  
#3.2	
  
Miss
Browsers	
  handle	
  
most	
  things	
  just	
  like	
  
they	
  handle	
  a	
  
200	
  OK?	
  
YEP…	
  MOSTLY	
  
§  HTML	
  Responses	
  
§  Almost	
  all	
  response	
  codes	
  are	
  rendered	
  
by	
  the	
  browser	
  correctly	
  
§  iFrames	
  
§  Some	
  special	
  cases	
  for	
  IE,	
  but	
  other	
  
browsers	
  handle	
  this	
  the	
  same	
  as	
  HTML	
  
	
  
§  JavaScript/CSS	
  
§  Limited	
  accepted	
  status	
  codes	
  
§  Limited	
  3XX	
  support	
  
§  Chrome	
  is	
  the	
  excepeon	
  here	
  
§  No	
  support	
  for	
  4XX/5XX	
  codes	
  
So	
  we	
  know	
  
what	
  browsers	
  
interpret	
  
differently	
  
What	
  do	
  
browsers	
  have	
  
in	
  common?	
  
§  1XX	
  code	
  handling	
  
§  Retries	
  
§  Confusion	
  
§  Chrome	
  /	
  IE6	
  try	
  to	
  download	
  the	
  page!	
  
§  Fun	
  on	
  Android…	
  (never	
  ending	
  download)	
  
§  Times	
  outs	
  (eventually)	
  
§  204	
  No	
  Content	
  
§  Um,	
  no	
  content!	
  
§  304	
  Not	
  Modified	
  
§  Again,	
  no	
  content	
  returned	
  
WHAT	
  ABOUT	
  
HEADERS?	
  
#3.3	
  
Just	
  because	
  the	
  RFC	
  says	
  
a	
  specific	
  status	
  code	
  
must	
  have	
  an	
  associated	
  
header…	
  
…doesn’t	
  mean	
  
it	
  HAS	
  to	
  
§  Redireceon	
  codes	
  (301-­‐304,	
  307)	
  
§  No	
  Locaeon	
  header,	
  no	
  redirect	
  
§  401	
  Unauthorized	
  
§  No	
  WWW-­‐Authenecate	
  header,	
  no	
  
authenecaeon	
  prompt	
  
§  407	
  Proxy	
  Authenecaeon	
  Required	
  
§  No	
  Proxy-­‐Authenecate	
  header,	
  no	
  prompt	
  
Just	
  because	
  the	
  RFC	
  says	
  
a	
  specific	
  status	
  code	
  
shouldn’t	
  have	
  an	
  
associated	
  header…	
  
	
  
…doesn’t	
  mean	
  
it	
  can’t	
  
§  300	
  Muleple	
  Choices	
  w/	
  Locaeon	
  Header	
  
§  Firefox	
  /	
  IE6	
  follows	
  the	
  redirect	
  
§  Chrome	
  doesn’t	
  
§  More	
  research	
  needed	
  in	
  this	
  direceon	
  
§  Most	
  headers	
  are	
  unintereseng	
  /	
  ignored	
  
EACH	
  BROWSER	
  
HANDLES	
  THINGS	
  A	
  
LITTLE	
  DIFFERENTLY	
  
I	
  WONDER	
  WHAT	
  
WE	
  CAN	
  DO	
  
WITH	
  THAT!	
  
#4	
  
]	
  [	
  GOALS
§  Each	
  browser	
  handles	
  things	
  differently	
  
§  Use	
  known	
  condieons	
  
§  Handled	
  codes	
  
§  Unhandled	
  codes	
  
§  Browser	
  weirdness	
  
BROWSER	
  
FINGERPRINTING	
  
#4.1	
  
§  Doesn’t	
  load	
  JavaScript	
  returned	
  with	
  a	
  300	
  
‘Muleple	
  Choices’	
  status	
  code	
  
§  Other	
  browsers	
  tested	
  DO	
  (IE/Chrome)	
  
	
  
§  Request	
  JavaScript	
  from	
  server	
  
§  Response	
  Status:	
  300	
  Muleple	
  Choices	
  
§  If	
  JavaScript	
  doesn’t	
  run	
  in	
  the	
  browser	
  
§  Firefox	
  
Firefox	
  
§  Loads	
  JavaScript	
  returned	
  with	
  a	
  307	
  
‘Temporary	
  Redirect’	
  status	
  code	
  
§  Other	
  browsers	
  tested	
  DON’T	
  (IE/FF)	
  
§  Request	
  JavaScript	
  from	
  server	
  
§  Response	
  Status:	
  307	
  Temporary	
  Redirect	
  
§  If	
  JavaScript	
  runs	
  in	
  the	
  browser	
  
§  Chrome	
  
Chrome	
  	
  
§  Loads	
  JavaScript	
  returned	
  with	
  a	
  205	
  ‘Reset	
  
Content’	
  status	
  code	
  
§  Other	
  browsers	
  tested	
  DON’T	
  (FF/Chrome)	
  
§  Request	
  JavaScript	
  from	
  server	
  
§  Response	
  Status:	
  205	
  Reset	
  Content	
  
§  If	
  JavaScript	
  runs	
  in	
  the	
  browser	
  
§  Internet	
  Explorer	
  
Internet	
  Explorer 	
  	
  
BROWSER	
  
FINGERPRINTING	
  
DEMO	
  
§  Other	
  opeons	
  to	
  fingerprint	
  browsers	
  
§  300	
  Redirect	
  (Chrome)	
  
§  305	
  /	
  306	
  JavaScript	
  (Firefox)	
  
§  400	
  iFrame	
  (Internet	
  Explorer)	
  
§  …	
  
	
  
POC	
  Script	
  à	
  h]p://c22.cc/POC/fingerprint.html	
  
USER-­‐AGENTS	
  
CAN	
  BE	
  
SPOOFED	
  
BROWSER	
  
TRAITS	
  CAN’T	
  
PROXY	
  
DETECTION	
  
#4.2	
  
§  Chrome	
  handles	
  proxy	
  config	
  differently	
  
§  407	
  status	
  code	
  isn’t	
  rendered	
  	
  
§  Unless	
  an	
  HTTP	
  proxy	
  is	
  set!	
  
§  Allows	
  us	
  to	
  detect	
  if	
  an	
  HTTP	
  proxy	
  is	
  set	
  
§  Just	
  not	
  which	
  proxy	
  
§  Can	
  only	
  detect	
  HTTP	
  proxies	
  ;(	
  
Chrome	
  Proxy	
  Deteceon	
  
§  Request	
  page	
  from	
  server	
  
§  Response	
  Status:	
  407	
  Proxy	
  Authenecaeon	
  
§  w/o	
  Proxy-­‐Authenecate	
  header	
  
§  If	
  Chrome	
  responds	
  HTTP	
  proxy	
  is	
  set	
  
Chrome	
  Proxy	
  Deteceon	
  
§  Privoxy	
  3.0.20	
  (CVE-­‐2013-­‐2503)	
  
§  407	
  Proxy	
  Authenecaeon	
  Required	
  
§  w/	
  Proxy-­‐Authenecate	
  header	
  
§  User	
  prompted	
  for	
  user/pass	
  
§  Prompt	
  appears	
  to	
  be	
  from	
  Privoxy	
  
§  Privoxy	
  passes	
  user/pass	
  to	
  remote	
  site	
  
§  Profit???	
  
Side-­‐Effect:	
  Owning	
  Proxies	
  
§  Not	
  just	
  Privoxy	
  that’s	
  effected	
  
§  Any	
  transparent	
  proxy	
  
§  e.g.	
  Burp,	
  ZAP,	
  …	
  
§  Not	
  really	
  a	
  vuln	
  for	
  most	
  
§  Works	
  as	
  designed!	
  
Side-­‐Effect:	
  Owning	
  Proxies	
  
#5	
  
]	
  [	
  BRINGINGITALL
TOGETHER
What	
  we	
  have	
  
§  Status	
  codes	
  all	
  browsers	
  treat	
  as	
  content	
  
§  Status	
  codes	
  all	
  browsers	
  can’t	
  handle	
  
§  1XX,	
  etc..	
  
§  Lots	
  of	
  browser	
  quirks	
  
What	
  can	
  we	
  do	
  
§  F*ck	
  with	
  things	
  
§  Screw	
  with	
  scanner	
  monkeys	
  
§  Make	
  RFC	
  lovers	
  cry	
  into	
  their	
  beer	
  
§  Break	
  things	
  in	
  general	
  
Let’s	
  try	
  to…	
  
§  Use	
  what	
  we’ve	
  discovered	
  to…	
  
§  Break	
  spidering	
  tools	
  
§  Cause	
  false	
  posieves	
  /	
  negaeves	
  
§  Slow	
  down	
  a]ackers	
  
§  The	
  fun	
  way!	
  
§  Blocking	
  successful	
  exploitaeon	
  
BREAKING	
  
SPIDERS	
  
#5.1	
  
Simplisec	
  view	
  
of	
  spiders	
  
§  Access	
  target	
  URL	
  
§  Read	
  links	
  /	
  funceons	
  
§  Test	
  them	
  out	
  
§  If	
  true:	
  conenue	
  
§  What	
  is	
  TRUE?	
  
§  What	
  happens	
  if:	
  
§  Every	
  response	
  is	
  
§  200	
  OK	
  
§  404	
  Not	
  Found	
  
§  500	
  Internal	
  Server	
  Error	
  
200	
  OK	
  
§  IF	
  200	
  ==	
  True:	
  
§  Problems!	
  
§  Never-­‐ending	
  spider	
  
404	
  Not	
  Found	
  
§  IF	
  404	
  ==	
  False:	
  
§  What	
  website?	
  
500	
  Internal	
  Server	
  Error	
  
§  Skipfish	
  !=	
  happy	
  fish	
  
False	
  
Posieves	
  /
Negaeves	
  
#5.2	
  
§  Most	
  scanners	
  use	
  status	
  codes	
  
§  At	
  least	
  to	
  some	
  extent	
  
§  Inieal	
  match	
  (prior	
  to	
  more	
  costly	
  regex)	
  
§  Speed	
  up	
  deteceon	
  
§  Easy	
  solueon	
  
§  What	
  happens	
  if:	
  
§  Every	
  response	
  is	
  
§  200	
  OK	
  
§  404	
  Not	
  Found	
  
§  500	
  Internal	
  Server	
  Error	
  
§  raNd0M*	
  
*	
  Using	
  codes	
  that	
  are	
  accepted	
  by	
  all	
  browsers	
  as	
  content	
  	
  
Vulnerability	
  Baseline	
  
§  w3af	
  
§  Informaeon	
  Points	
  à	
  79	
  
§  Vulnerabiliees	
  à	
  65	
  
§  Shells	
  à	
  0	
  shells	
  L	
  
§  Scan	
  eme	
  à	
  1h37m23s	
  
Every	
  response	
  200	
  OK	
  
§  No	
  change	
  in	
  discoveries	
  
§  All	
  points	
  discovered	
  -­‐	
  per	
  baseline	
  
§  79	
  Informaeon	
  Points	
  
§  65	
  Vulnerabiliees	
  
§  0	
  Shells	
  
§  Scan	
  eme	
  à	
  9h56m55s	
  
§  Lots	
  more	
  to	
  check	
  ;)	
  
Every	
  response	
  404	
  Not	
  Found	
  
§  Less	
  to	
  scan	
  ==	
  Less	
  to	
  find	
  
§  False	
  negaeves	
  
§  44	
  Informaeon	
  Points	
  (-­‐35)	
  
§  37	
  Vulnerabiliees	
  (-­‐28)	
  	
  
§  Scan	
  eme	
  à	
  7m13s	
  
§  Much	
  quicker	
  scan	
  
§  Less	
  paths	
  traversed	
  
Every	
  response	
  500	
  
§  Server	
  Error	
  ==	
  OMG	
  VULN	
  SANDWICH!	
  
§  False	
  posieves+++	
  
§  9540	
  Informaeon	
  points	
  (+9461)	
  
§  9526	
  Vulnerabiliees	
  (+9461)	
  	
  
Random	
  Status	
  Codes	
  
§  Muleple	
  test	
  runs	
  
§  All	
  tests	
  produced	
  False	
  posieves++	
  
§  avg.	
  619	
  Informaeon	
  points	
  (+540)	
  
§  avg.	
  550	
  Vulnerabiliees	
  (+485)	
  	
  
§  Avg.	
  scan	
  eme	
  à	
  11m37s	
  
§  Ooen	
  much	
  quicker	
  scans	
  
§  Lots	
  of	
  variaeon	
  in	
  scan	
  emes	
  
Random	
  Status	
  Codes	
  
§  Skipfish	
  +	
  $random_status	
  =	
  chaos	
  
§  False	
  Posieves	
  +	
  False	
  Negaeves	
  
§  Scan	
  jobs	
  killed	
  (due	
  to	
  lack	
  of	
  scanner	
  resources)	
  
§  Scan	
  emes	
  
§  1st	
  scan	
  eme	
  à	
  10h3m35s	
  
§  2nd	
  scan	
  eme	
  à	
  0h0m4s	
  
§  3rd	
  scan	
  eme	
  à	
  16h47m41s	
  
Slowing	
  
a]ackers	
  
down!	
  
#5.3	
  
What	
  does	
  
your	
  WAF	
  
really	
  do?	
  
§  OMG	
  A]ack	
  
§  Block	
  /	
  Return	
  error	
  
§  403,	
  500,	
  …	
  
§  Profit???	
  
Why?	
  
Remember	
  that	
  list	
  
of	
  status	
  codes	
  
browsers	
  don’t	
  
handle	
  well?	
  
Yeah	
  well,	
  scanners	
  
don’t	
  usually	
  handle	
  
them	
  well	
  either!	
  
Especially	
  the	
  
1XX	
  codes	
  
§  Remember	
  LaBrea	
  tarpit?	
  
§  Tim	
  Liston	
  2001	
  *	
  
§  Designed	
  to	
  slow	
  spread	
  of	
  Code	
  Red	
  
§  Slows	
  down	
  scans	
  /	
  a]ackers	
  
*	
  h]p://labrea.sourceforge.net	
  
How	
  about	
  an	
  
HTTP	
  Tarpit!	
  
HTTP	
  Tarpit	
  Scenario	
  
§  WAF	
  detects	
  scan	
  /	
  a]ack	
  
§  Adds	
  source	
  IP	
  to	
  “naughty”	
  list	
  
§  Rewrite	
  all	
  responses	
  from	
  the	
  server	
  
§  100|101|102	
  status	
  codes	
  only	
  (random)	
  
§  204|304	
  might	
  also	
  be	
  useful	
  (no	
  content)	
  
Let’s	
  do	
  
some	
  
science!*	
  
*	
  Science	
  not	
  included	
  
vs.	
  the	
  HTTP	
  TARPIT	
  
NIKTO	
  
Baseline	
   HTTP	
  Tarpit	
  
Scan	
  eme	
  
2m	
  18s	
  
Findings	
  
18	
  
14h	
  33m	
  2s	
  
10	
  
vs.	
  the	
  HTTP	
  TARPIT	
  
W3AF	
  
Baseline	
   HTTP	
  Tarpit	
  
Scan	
  eme	
  
1h	
  37m	
  23s	
  
Findings	
  
65	
  
18m	
  10s	
  
0	
  
vs.	
  the	
  HTTP	
  TARPIT	
  
SKIPFISH	
  
Baseline	
   HTTP	
  Tarpit	
  
Scan	
  eme	
  
18m	
  10s	
  
Findings	
  
Low:	
  2519	
  
Med:	
  2522	
  
High:	
  12	
  
Low:	
  
Med:	
  	
  
High:	
  
05s	
  
0	
  
0	
  
3	
  
vs.	
  the	
  HTTP	
  TARPIT	
  
ACUNETIX	
  
Baseline	
   HTTP	
  Tarpit	
  
Scan	
  eme	
  
1h	
  19m	
  
Findings	
  
Info:	
  1104	
  
Low:	
  30	
  
Med:	
  32	
  
High:	
  24	
  
Info:	
  
Low:	
  
Med:	
  	
  
High:	
  
33m	
  
3	
  
3	
  
1	
  
0	
  
HTTP	
  Tarpit	
  Results	
  
§  HTTP	
  Tarpit	
  Results	
  *	
  
§  Slow	
  down	
  scans	
  
§  Nikto:	
  340x	
  as	
  long	
  
§  Others	
  give	
  up	
  quicker	
  ;)	
  
§  Unreliable	
  /	
  aborted	
  scans	
  
§  Up	
  to	
  100%	
  less	
  findings	
  
*	
  Not	
  scienefically	
  sound	
  ;)	
  
Blocking	
  
successful	
  
exploitae0n	
  
#5.4	
  
We’ve	
  made	
  it	
  
hard	
  to	
  find	
  the	
  
vulnerabiliees	
  
We’ve	
  made	
  it	
  
Ome	
  consuming	
  
for	
  a]ackers	
  
Now	
  let’s	
  stop	
  the	
  
sk1dd13s	
  using	
  
Metasploit	
  to	
  pop	
  
$hells	
  
Q:	
  How	
  ooen	
  does	
  Metasploit	
  reference	
  
status	
  codes?	
  
	
  
	
  rgrep	
  -­‐E	
  'res[p|ponse]?.code'	
  *	
  
à	
  958	
  *	
  
*	
  Not	
  scienefically	
  sound	
  ;)	
  
rgrep	
  -­‐E	
  'res[p|ponse]?.code'	
  *	
  
Lots	
  of	
  
dependency	
  on	
  
status	
  codes*	
  
*	
  yep,	
  even	
  the	
  stuff	
  I	
  wrote	
  
  	
  if	
  (res.code	
  <	
  200	
  or	
  res.code	
  >=	
  300)	
  
	
   	
   	
  case	
  res.code	
  
	
   	
   	
  when	
  401	
  
	
   	
   	
   	
  print_warning("Warning:	
  The	
  web	
  site	
  
	
   	
   	
   	
  asked	
  for	
  authentication:	
  #{res.headers	
  
	
   	
   	
   	
  ['WWW-­‐Authenticate']	
  ||	
  res.headers 	
  	
  
	
   	
   	
   	
  ['Authentication']}")	
  
	
   	
   	
  end	
  
	
   	
   	
  fail_with(Exploit::Failure::Unknown,	
  
	
   	
   	
  "Upload	
  failed	
  on	
  #{path_tmp}	
  
	
   	
   	
  [#{res.code}	
  #{res.message}]")	
  
	
   	
  end	
  
No	
  match,	
  
No	
  shell*	
  
*	
  exploit	
  dependent	
  
#6	
  
]	
  [	
  REVIEW
§  Using	
  status	
  codes	
  to	
  our	
  benefit	
  is	
  fun	
  
§  …	
  and	
  useful!	
  
§  Browsers	
  can	
  be	
  quirky	
  
§  Scanners	
  /	
  a]ack	
  toolkits	
  are	
  someemes	
  
set	
  in	
  their	
  ways	
  
§  Take	
  the	
  easy	
  route	
  
§  Easy	
  to	
  fool	
  
§  WAFs	
  need	
  to	
  get	
  more	
  offensive	
  about	
  
their	
  defense	
  
§  More	
  than	
  just	
  blocking	
  a	
  request	
  
§  Even	
  if	
  you	
  use	
  a	
  snazzy	
  message	
  
§  Hacking	
  back	
  is	
  bad	
  
§  Slowing	
  down	
  known	
  a]acks	
  is	
  good	
  
§  Make	
  life	
  harder	
  for	
  skiddies	
  is	
  pricele$$	
  
§  Current	
  tools	
  are	
  much	
  the	
  same	
  as	
  APT	
  
§  APT	
  (Adequate	
  Persistent	
  Threat)	
  
§  Only	
  as	
  advanced	
  as	
  they	
  NEED	
  to	
  be	
  
…because	
  screwing	
  
with	
  sk1dd13s	
  
is	
  fun!	
  
Implementaeon	
  
#6.1	
  
§  PHP	
  (the	
  lowest	
  common	
  denominator)	
  
§  auto-­‐prepend-­‐file	
  
§  Limited	
  to	
  resources	
  PHP	
  handles	
  
§  MITMdump	
  
§  MITMproxy	
  ==	
  memory	
  hog	
  
§  Reverse	
  proxy	
  mode	
  
Ghe]o	
  Implementaeon	
  
§  Usable	
  implementaeon	
  
§  Nginx	
  as	
  reverse	
  proxy	
  
§  Requires:	
  ngx_lua	
  
§  ngx.status	
  =	
  XXX	
  
§  Bugs	
  in	
  non-­‐git	
  version	
  
§  203,	
  305,	
  306,	
  414,	
  505,	
  506	
  return	
  nil	
  
h]ps://github.com/ChrisJohnRiley/Random_Code/blob/master/nginx/nginx.conf	
  
	
  
§  Ease	
  adopeon	
  
§  Implement	
  into	
  mod-­‐security	
  
§  Not	
  a	
  simple	
  task	
  
§  Already	
  been	
  discussed	
  many	
  emes	
  
§  Help	
  wanted	
  ;)	
  
Countering	
  
this	
  research	
  
#6.2	
  
§  Less	
  reliance	
  on	
  status	
  codes	
  
§  More	
  reliance	
  on	
  content	
  /	
  headers	
  
§  Pros 	
  	
  
§  Be]er	
  matching	
  /	
  intelligence	
  
§  Cons	
  
§  Slower?	
  (regex	
  matching)	
  
§  More	
  resource	
  intensive	
  
Queseons?	
  
 
CODE	
  /	
  SCRIPTS	
  AVAILABLE	
  
	
  
HTTP://GITHUB.COM/CHRISJOHNRILEY/RANDOM_CODE	
  
Thanks	
  for	
  coming	
  
	
  
h]p://blog.c22.cc	
  
@ChrisJohnRiley	
  	
  	
  	
  contact@c22.cc	
  

More Related Content

What's hot

Securing Your WordPress Website - WordCamp GC 2011
Securing Your WordPress Website - WordCamp GC 2011Securing Your WordPress Website - WordCamp GC 2011
Securing Your WordPress Website - WordCamp GC 2011Vlad Lasky
 
A Complete Installation Guide for Orangescrum
A Complete Installation Guide for OrangescrumA Complete Installation Guide for Orangescrum
A Complete Installation Guide for OrangescrumOrangescrum
 
2011/1/27 Amazon Route53 使ってみた@第1回クラウド女子会
2011/1/27 Amazon Route53 使ってみた@第1回クラウド女子会2011/1/27 Amazon Route53 使ってみた@第1回クラウド女子会
2011/1/27 Amazon Route53 使ってみた@第1回クラウド女子会Miki Takata
 
Securing Your WordPress Website by Vlad Lasky
Securing Your WordPress Website by Vlad LaskySecuring Your WordPress Website by Vlad Lasky
Securing Your WordPress Website by Vlad Laskywordcampgc
 
Beating Spam On Your WordPress Website - WordCamp Melbourne 2013
Beating Spam On Your WordPress Website - WordCamp Melbourne 2013Beating Spam On Your WordPress Website - WordCamp Melbourne 2013
Beating Spam On Your WordPress Website - WordCamp Melbourne 2013Vlad Lasky
 
Beyond xp_cmdshell: Owning the Empire through SQL Server
Beyond xp_cmdshell: Owning the Empire through SQL ServerBeyond xp_cmdshell: Owning the Empire through SQL Server
Beyond xp_cmdshell: Owning the Empire through SQL ServerScott Sutherland
 
OBIEE 11g installation steps
OBIEE 11g installation stepsOBIEE 11g installation steps
OBIEE 11g installation stepsDharmaraj Borse
 
Security in PHP - 那些在滲透測試的小技巧
Security in PHP - 那些在滲透測試的小技巧Security in PHP - 那些在滲透測試的小技巧
Security in PHP - 那些在滲透測試的小技巧Orange Tsai
 
Attacking Oracle with the Metasploit Framework
Attacking Oracle with the Metasploit FrameworkAttacking Oracle with the Metasploit Framework
Attacking Oracle with the Metasploit FrameworkChris Gates
 
APEX richtig installieren und konfigurieren
APEX richtig installieren und konfigurierenAPEX richtig installieren und konfigurieren
APEX richtig installieren und konfigurierenOliver Lemm
 
SOA Fusion Middleware installation
SOA Fusion Middleware installationSOA Fusion Middleware installation
SOA Fusion Middleware installationMonowar Mukul
 
Installation instruction of Testlink
Installation instruction of TestlinkInstallation instruction of Testlink
Installation instruction of Testlinkusha kannappan
 
Mikhail Egorov - Hunting for bugs in Adobe Experience Manager webapps
Mikhail Egorov - Hunting for bugs in Adobe Experience Manager webappsMikhail Egorov - Hunting for bugs in Adobe Experience Manager webapps
Mikhail Egorov - Hunting for bugs in Adobe Experience Manager webappshacktivity
 
Installing the Oracle SOA Suite on Red Hat 6
Installing the Oracle SOA Suite on Red Hat 6Installing the Oracle SOA Suite on Red Hat 6
Installing the Oracle SOA Suite on Red Hat 6TUSHAR VARSHNEY
 

What's hot (20)

Securing Your WordPress Website - WordCamp GC 2011
Securing Your WordPress Website - WordCamp GC 2011Securing Your WordPress Website - WordCamp GC 2011
Securing Your WordPress Website - WordCamp GC 2011
 
A Complete Installation Guide for Orangescrum
A Complete Installation Guide for OrangescrumA Complete Installation Guide for Orangescrum
A Complete Installation Guide for Orangescrum
 
Presentation (PPT)
Presentation (PPT)Presentation (PPT)
Presentation (PPT)
 
2011/1/27 Amazon Route53 使ってみた@第1回クラウド女子会
2011/1/27 Amazon Route53 使ってみた@第1回クラウド女子会2011/1/27 Amazon Route53 使ってみた@第1回クラウド女子会
2011/1/27 Amazon Route53 使ってみた@第1回クラウド女子会
 
Securing Your WordPress Website by Vlad Lasky
Securing Your WordPress Website by Vlad LaskySecuring Your WordPress Website by Vlad Lasky
Securing Your WordPress Website by Vlad Lasky
 
Beating Spam On Your WordPress Website - WordCamp Melbourne 2013
Beating Spam On Your WordPress Website - WordCamp Melbourne 2013Beating Spam On Your WordPress Website - WordCamp Melbourne 2013
Beating Spam On Your WordPress Website - WordCamp Melbourne 2013
 
Demystifying REST
Demystifying RESTDemystifying REST
Demystifying REST
 
Beyond xp_cmdshell: Owning the Empire through SQL Server
Beyond xp_cmdshell: Owning the Empire through SQL ServerBeyond xp_cmdshell: Owning the Empire through SQL Server
Beyond xp_cmdshell: Owning the Empire through SQL Server
 
OBIEE 11g installation steps
OBIEE 11g installation stepsOBIEE 11g installation steps
OBIEE 11g installation steps
 
Security in PHP - 那些在滲透測試的小技巧
Security in PHP - 那些在滲透測試的小技巧Security in PHP - 那些在滲透測試的小技巧
Security in PHP - 那些在滲透測試的小技巧
 
Attacking Oracle with the Metasploit Framework
Attacking Oracle with the Metasploit FrameworkAttacking Oracle with the Metasploit Framework
Attacking Oracle with the Metasploit Framework
 
APEX richtig installieren und konfigurieren
APEX richtig installieren und konfigurierenAPEX richtig installieren und konfigurieren
APEX richtig installieren und konfigurieren
 
Oracle vm-installation
Oracle vm-installationOracle vm-installation
Oracle vm-installation
 
IIS Web Ecosystem
IIS Web EcosystemIIS Web Ecosystem
IIS Web Ecosystem
 
Its3 Drupal
Its3 DrupalIts3 Drupal
Its3 Drupal
 
SOA Fusion Middleware installation
SOA Fusion Middleware installationSOA Fusion Middleware installation
SOA Fusion Middleware installation
 
Oam install & config
Oam install & configOam install & config
Oam install & config
 
Installation instruction of Testlink
Installation instruction of TestlinkInstallation instruction of Testlink
Installation instruction of Testlink
 
Mikhail Egorov - Hunting for bugs in Adobe Experience Manager webapps
Mikhail Egorov - Hunting for bugs in Adobe Experience Manager webappsMikhail Egorov - Hunting for bugs in Adobe Experience Manager webapps
Mikhail Egorov - Hunting for bugs in Adobe Experience Manager webapps
 
Installing the Oracle SOA Suite on Red Hat 6
Installing the Oracle SOA Suite on Red Hat 6Installing the Oracle SOA Suite on Red Hat 6
Installing the Oracle SOA Suite on Red Hat 6
 

Viewers also liked

Defcon 21 - Fear the Evil FOCA: mitm attacks using IPv6
Defcon 21 - Fear the Evil FOCA: mitm attacks using IPv6Defcon 21 - Fear the Evil FOCA: mitm attacks using IPv6
Defcon 21 - Fear the Evil FOCA: mitm attacks using IPv6Chema Alonso
 
DirtyTooth: It´s only Rock'n Roll but I like it
DirtyTooth: It´s only Rock'n Roll but I like itDirtyTooth: It´s only Rock'n Roll but I like it
DirtyTooth: It´s only Rock'n Roll but I like itTelefónica
 
DirtyTooth: It´s only Rock'n Roll but I like it [Slides]
DirtyTooth: It´s only Rock'n Roll but I like it [Slides]DirtyTooth: It´s only Rock'n Roll but I like it [Slides]
DirtyTooth: It´s only Rock'n Roll but I like it [Slides]Telefónica
 
Defense by numbers: Making problems for script kiddies
Defense by numbers: Making problems for script kiddiesDefense by numbers: Making problems for script kiddies
Defense by numbers: Making problems for script kiddiesChris John Riley
 
Cutting accounts down to scythe
Cutting accounts down to scytheCutting accounts down to scythe
Cutting accounts down to scytheChris John Riley
 
Web Browser Fingerprinting
Web Browser FingerprintingWeb Browser Fingerprinting
Web Browser FingerprintingChema Alonso
 
FC00::1 (Algunos) Ataques en IPv6
FC00::1 (Algunos) Ataques en IPv6FC00::1 (Algunos) Ataques en IPv6
FC00::1 (Algunos) Ataques en IPv6Chema Alonso
 
Índice Libro "macOS Hacking" de 0xWord
Índice Libro "macOS Hacking" de 0xWordÍndice Libro "macOS Hacking" de 0xWord
Índice Libro "macOS Hacking" de 0xWordTelefónica
 
OpenNebula 4.14 Hands-on Tutorial
OpenNebula 4.14 Hands-on TutorialOpenNebula 4.14 Hands-on Tutorial
OpenNebula 4.14 Hands-on TutorialOpenNebula Project
 
Índice del libro "Hacking Web Technologies"
Índice del libro "Hacking Web Technologies"Índice del libro "Hacking Web Technologies"
Índice del libro "Hacking Web Technologies"Telefónica
 
Servicio VPN con OpenVPN y Latch sobre Raspberry Pi
Servicio VPN con OpenVPN y Latch sobre Raspberry PiServicio VPN con OpenVPN y Latch sobre Raspberry Pi
Servicio VPN con OpenVPN y Latch sobre Raspberry PiTelefónica
 

Viewers also liked (12)

Productos de ANT
Productos de ANTProductos de ANT
Productos de ANT
 
Defcon 21 - Fear the Evil FOCA: mitm attacks using IPv6
Defcon 21 - Fear the Evil FOCA: mitm attacks using IPv6Defcon 21 - Fear the Evil FOCA: mitm attacks using IPv6
Defcon 21 - Fear the Evil FOCA: mitm attacks using IPv6
 
DirtyTooth: It´s only Rock'n Roll but I like it
DirtyTooth: It´s only Rock'n Roll but I like itDirtyTooth: It´s only Rock'n Roll but I like it
DirtyTooth: It´s only Rock'n Roll but I like it
 
DirtyTooth: It´s only Rock'n Roll but I like it [Slides]
DirtyTooth: It´s only Rock'n Roll but I like it [Slides]DirtyTooth: It´s only Rock'n Roll but I like it [Slides]
DirtyTooth: It´s only Rock'n Roll but I like it [Slides]
 
Defense by numbers: Making problems for script kiddies
Defense by numbers: Making problems for script kiddiesDefense by numbers: Making problems for script kiddies
Defense by numbers: Making problems for script kiddies
 
Cutting accounts down to scythe
Cutting accounts down to scytheCutting accounts down to scythe
Cutting accounts down to scythe
 
Web Browser Fingerprinting
Web Browser FingerprintingWeb Browser Fingerprinting
Web Browser Fingerprinting
 
FC00::1 (Algunos) Ataques en IPv6
FC00::1 (Algunos) Ataques en IPv6FC00::1 (Algunos) Ataques en IPv6
FC00::1 (Algunos) Ataques en IPv6
 
Índice Libro "macOS Hacking" de 0xWord
Índice Libro "macOS Hacking" de 0xWordÍndice Libro "macOS Hacking" de 0xWord
Índice Libro "macOS Hacking" de 0xWord
 
OpenNebula 4.14 Hands-on Tutorial
OpenNebula 4.14 Hands-on TutorialOpenNebula 4.14 Hands-on Tutorial
OpenNebula 4.14 Hands-on Tutorial
 
Índice del libro "Hacking Web Technologies"
Índice del libro "Hacking Web Technologies"Índice del libro "Hacking Web Technologies"
Índice del libro "Hacking Web Technologies"
 
Servicio VPN con OpenVPN y Latch sobre Raspberry Pi
Servicio VPN con OpenVPN y Latch sobre Raspberry PiServicio VPN con OpenVPN y Latch sobre Raspberry Pi
Servicio VPN con OpenVPN y Latch sobre Raspberry Pi
 

Similar to Defense by numbers: Making Problems for Script Kiddies and Scanner Monkeys

WAF Bypass Techniques - Using HTTP Standard and Web Servers’ Behaviour
WAF Bypass Techniques - Using HTTP Standard and Web Servers’ BehaviourWAF Bypass Techniques - Using HTTP Standard and Web Servers’ Behaviour
WAF Bypass Techniques - Using HTTP Standard and Web Servers’ BehaviourSoroush Dalili
 
Web Fundamentals
Web FundamentalsWeb Fundamentals
Web Fundamentalsarunv
 
The never-ending REST API design debate -- Devoxx France 2016
The never-ending REST API design debate -- Devoxx France 2016The never-ending REST API design debate -- Devoxx France 2016
The never-ending REST API design debate -- Devoxx France 2016Restlet
 
Making the Most of HTTP In Your Apps
Making the Most of HTTP In Your AppsMaking the Most of HTTP In Your Apps
Making the Most of HTTP In Your AppsBen Ramsey
 
Data normalization weaknesses
Data normalization weaknessesData normalization weaknesses
Data normalization weaknessesIvan Novikov
 
Identifying Web Servers: A First-look Into the Future of Web Server Fingerpri...
Identifying Web Servers: A First-look Into the Future of Web Server Fingerpri...Identifying Web Servers: A First-look Into the Future of Web Server Fingerpri...
Identifying Web Servers: A First-look Into the Future of Web Server Fingerpri...Jeremiah Grossman
 
Charles guide sharing
Charles guide sharingCharles guide sharing
Charles guide sharingVincent Chang
 
Http error codes and their meaning
Http error codes and their meaningHttp error codes and their meaning
Http error codes and their meaningMD.kayesar hasan
 
The never-ending REST API design debate
The never-ending REST API design debateThe never-ending REST API design debate
The never-ending REST API design debateRestlet
 
ExpressionEngine - Simple Steps to Performance and Security (EECI 2014)
ExpressionEngine - Simple Steps to Performance and Security (EECI 2014)ExpressionEngine - Simple Steps to Performance and Security (EECI 2014)
ExpressionEngine - Simple Steps to Performance and Security (EECI 2014)Nexcess.net LLC
 
Apache web server installation/configuration, Virtual Hosting
Apache web server installation/configuration, Virtual HostingApache web server installation/configuration, Virtual Hosting
Apache web server installation/configuration, Virtual Hostingwebhostingguy
 
Site Performance - From Pinto to Ferrari
Site Performance - From Pinto to FerrariSite Performance - From Pinto to Ferrari
Site Performance - From Pinto to FerrariJoseph Scott
 
A Forgotten HTTP Invisibility Cloak
A Forgotten HTTP Invisibility CloakA Forgotten HTTP Invisibility Cloak
A Forgotten HTTP Invisibility CloakSoroush Dalili
 
Apache Cookbook - TekX Chicago 2010
Apache Cookbook - TekX Chicago 2010Apache Cookbook - TekX Chicago 2010
Apache Cookbook - TekX Chicago 2010Rich Bowen
 
Apache Wizardry - Ohio Linux 2011
Apache Wizardry - Ohio Linux 2011Apache Wizardry - Ohio Linux 2011
Apache Wizardry - Ohio Linux 2011Rich Bowen
 
Vulnerabilities on Various Data Processing Levels
Vulnerabilities on Various Data Processing LevelsVulnerabilities on Various Data Processing Levels
Vulnerabilities on Various Data Processing LevelsPositive Hack Days
 
Vulnerabilities in data processing levels
Vulnerabilities in data processing levelsVulnerabilities in data processing levels
Vulnerabilities in data processing levelsbeched
 
Rooting your internals - Exploiting Internal Network Vulns via the Browser Us...
Rooting your internals - Exploiting Internal Network Vulns via the Browser Us...Rooting your internals - Exploiting Internal Network Vulns via the Browser Us...
Rooting your internals - Exploiting Internal Network Vulns via the Browser Us...Michele Orru
 
Generating the Server Response: HTTP Status Codes
Generating the Server Response: HTTP Status CodesGenerating the Server Response: HTTP Status Codes
Generating the Server Response: HTTP Status CodesDeeptiJava
 

Similar to Defense by numbers: Making Problems for Script Kiddies and Scanner Monkeys (20)

WAF Bypass Techniques - Using HTTP Standard and Web Servers’ Behaviour
WAF Bypass Techniques - Using HTTP Standard and Web Servers’ BehaviourWAF Bypass Techniques - Using HTTP Standard and Web Servers’ Behaviour
WAF Bypass Techniques - Using HTTP Standard and Web Servers’ Behaviour
 
Web Fundamentals
Web FundamentalsWeb Fundamentals
Web Fundamentals
 
The never-ending REST API design debate -- Devoxx France 2016
The never-ending REST API design debate -- Devoxx France 2016The never-ending REST API design debate -- Devoxx France 2016
The never-ending REST API design debate -- Devoxx France 2016
 
Making the Most of HTTP In Your Apps
Making the Most of HTTP In Your AppsMaking the Most of HTTP In Your Apps
Making the Most of HTTP In Your Apps
 
Data normalization weaknesses
Data normalization weaknessesData normalization weaknesses
Data normalization weaknesses
 
Identifying Web Servers: A First-look Into the Future of Web Server Fingerpri...
Identifying Web Servers: A First-look Into the Future of Web Server Fingerpri...Identifying Web Servers: A First-look Into the Future of Web Server Fingerpri...
Identifying Web Servers: A First-look Into the Future of Web Server Fingerpri...
 
Charles guide sharing
Charles guide sharingCharles guide sharing
Charles guide sharing
 
Http error codes and their meaning
Http error codes and their meaningHttp error codes and their meaning
Http error codes and their meaning
 
The never-ending REST API design debate
The never-ending REST API design debateThe never-ending REST API design debate
The never-ending REST API design debate
 
ExpressionEngine - Simple Steps to Performance and Security (EECI 2014)
ExpressionEngine - Simple Steps to Performance and Security (EECI 2014)ExpressionEngine - Simple Steps to Performance and Security (EECI 2014)
ExpressionEngine - Simple Steps to Performance and Security (EECI 2014)
 
Apache web server installation/configuration, Virtual Hosting
Apache web server installation/configuration, Virtual HostingApache web server installation/configuration, Virtual Hosting
Apache web server installation/configuration, Virtual Hosting
 
Site Performance - From Pinto to Ferrari
Site Performance - From Pinto to FerrariSite Performance - From Pinto to Ferrari
Site Performance - From Pinto to Ferrari
 
Into The Box 2018 Ortus Keynote
Into The Box 2018 Ortus KeynoteInto The Box 2018 Ortus Keynote
Into The Box 2018 Ortus Keynote
 
A Forgotten HTTP Invisibility Cloak
A Forgotten HTTP Invisibility CloakA Forgotten HTTP Invisibility Cloak
A Forgotten HTTP Invisibility Cloak
 
Apache Cookbook - TekX Chicago 2010
Apache Cookbook - TekX Chicago 2010Apache Cookbook - TekX Chicago 2010
Apache Cookbook - TekX Chicago 2010
 
Apache Wizardry - Ohio Linux 2011
Apache Wizardry - Ohio Linux 2011Apache Wizardry - Ohio Linux 2011
Apache Wizardry - Ohio Linux 2011
 
Vulnerabilities on Various Data Processing Levels
Vulnerabilities on Various Data Processing LevelsVulnerabilities on Various Data Processing Levels
Vulnerabilities on Various Data Processing Levels
 
Vulnerabilities in data processing levels
Vulnerabilities in data processing levelsVulnerabilities in data processing levels
Vulnerabilities in data processing levels
 
Rooting your internals - Exploiting Internal Network Vulns via the Browser Us...
Rooting your internals - Exploiting Internal Network Vulns via the Browser Us...Rooting your internals - Exploiting Internal Network Vulns via the Browser Us...
Rooting your internals - Exploiting Internal Network Vulns via the Browser Us...
 
Generating the Server Response: HTTP Status Codes
Generating the Server Response: HTTP Status CodesGenerating the Server Response: HTTP Status Codes
Generating the Server Response: HTTP Status Codes
 

Recently uploaded

Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsHyundai Motor Group
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
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
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 

Recently uploaded (20)

Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
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
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
 

Defense by numbers: Making Problems for Script Kiddies and Scanner Monkeys

  • 1. Defense  by  Numb3r5     Making  problems  for  script  k1dd13s   and  scanner  monkeys   @ChrisJohnRiley  
  • 2.
  • 3. “THE  WISEST  MAN,  IS  HE   WHO  KNOWS,  THAT  HE   KNOWS  NOTHING”       SOCRATES:  APOLOGY,  21D  
  • 4.
  • 5.
  • 6. This  talk  contains:    - Numbers - Bad Jokes - Traces of peanuts - Did I mention numbers?    
  • 8. Goals  for  this  talk   Describe  the   defensive  uses  of   HTTP  status  codes  
  • 9. 1)  What   2)  Why   3)  How   4)  Goals   5)  Bringing  it  together   6)  Review  
  • 10. #1   ]  [  WHAT ?
  • 12.
  • 13. Seems  like  such  a     Small  detail  
  • 14. …  small  detail,   big  impact  
  • 15. HTTP  Status  Codes   §  Majority  part  of  RFC  2616  (HTTP/1.1)   §  5  main  classes  of  response   §  1XX  informaOonal   §  2XX  success   §  3XX  redirecOon   §  4XX  client  error   §  5XX  server  error  
  • 16. HTTP  Status  Codes   §  Proposed  RFC*  for  7XX  codes   §  Examples:   §  701  Meh   §  719  I  am  not  a  teapot   §  721  Known  unknowns   §  722  Unknown  unknowns   §  732  Fucking  Unic☐de   *  h]ps://github.com/joho/7XX-­‐rfc  
  • 17. BASICS   AKA:  THE  BORING  THEORY  BIT   #1.1  
  • 18. 1XX  Informaeonal   §  Indicates  response  received   §  Processing  is  not  yet  completed   §  100  Conenue   §  101  Switching  Protocols   §  102  Processing  (WebDAV  RFC  2518)  
  • 19. 2XX  Success   §  Indicates  response  received   §  Processed  and  understood   §  200  OK   §  201  Created   §  202  Accepted   §  203  Non-­‐Authoritaeve  Informaeon   §  204  No  Content  
  • 20. 2XX  Success  (cont.)   §  205  Reset  Content   §  206  Pareal  Content   §  207  Mule-­‐Status  (WebDAV  RFC  4918)   Codes  not  supported  by  Apache   §  208  Already  Reported   §  226  IM  Used   §  250  Low  on  Storage  Space  
  • 21. 3XX  Redireceon   §  Aceon  required  to  complete  request   §  300  Muleple  Choices   §  301  Moved  Permanently   §  302  Found  (Moved  Temporarily)   §  303  See  Other   §  304  Not  Modified  
  • 22. 3XX  Redireceon  (cont.)   §  305  Use  Proxy   §  306  Switch  Proxy  (unused)   §  307  Temporary  Redirect   Codes  not  supported  by  Apache   §  308  Permanent  Redirect  
  • 23. 4XX  Client  Error   §  Client  caused  an  error   §  400  Bad  Request   §  401  Unauthorized   §  402  Payment  Required   §  403  Forbidden   §  404  Not  Found   §  405  Method  Not  Allowed  
  • 24. 4XX  Client  Error  (cont.)   §  406  Not  Accessible   §  407  Proxy  Authenecaeon  Required   §  408  Request  Timeout   §  409  Conflict   §  410  Gone   §  411  Length  Required  
  • 25. 4XX  Client  Error  (cont.)   §  412  Precondieon  Failed   §  413  Request  Enety  Too  Large   §  414  Request-­‐URI  Too  Long   §  415  Unsupported  Media  Type   §  416  Request  Range  Not  Saesfiable   §  417  Expectaeon  Failed   §  418  I’m  a  Teapot  (IETF  April  Fools  RFC  2324)  
  • 26. 4XX  Client  Error  (cont.)   §  419  /  420  /  421  Unused   §  422  Unprocessable  Enety  (RFC  4918)   §  423  Locked  (RFC  4918)   §  424  Failed  Dependency  (RFC  4918)   §  425  No  Code  /  Unordered  Colleceon   §  426  Upgrade  Required  (RFC  2817)  
  • 27. 4XX  Client  Error  (cont.)   Codes  not  supported  by  Apache   §  428  Precondieon  Required   §  429  Too  Many  Requests   §  431  Request  Header  Fields  Too  Large   §  444  No  Response  (NGINX)   §  449  Retry  With  (Microsoo)   §  450  Blocked  by  Win.  Parental  Controls   §  451  Unavailable  For  Legal  Reasons   §  494  Request  Header  Too  Large  (NGINX)   §  495  Cert  Error  (NGINX)   §  496  No  Cert  (NGINX)   §  497  HTTP  to  HTTPS  (NGINX)   §  499  Client  Closed  Request  (NGINX)  
  • 28. 5XX  Server  Error   §  Server  error  occurred   §  500  Internal  Server  Error   §  501  Not  Implemented   §  502  Bad  Gateway   §  503  Service  Unavailable   §  504  Gateway  Timeout   §  505  HTTP  Version  Not  supported  
  • 29. 5XX  Server  Error  (cont.)   §  506  Variant  Also  Negoeates  (RFC  2295)   §  507  Insufficient  Storage  (WebDAV  RFC  4918)   §  508  Loop  Detected  (WebDAV  RFC  5842)   §  509  Bandwidth  Limit  Exceeded  (apache  ext.)     §  510  Not  Extended  (RFC  2274)   Codes  not  supported  by  Apache   §  511  Network  Authenecaeon  Required  (RFC  6585)   §  550  Permission  Denied   §  598  Network  Read  Timeout  Error  (Microsoo  Proxy)   §  599  Network  Conneceon  Timeout  Error  (Microsoo  Proxy)  
  • 30. OMG  Enough  with   the  numb3rs   already!!!!  
  • 31.
  • 32. #2   ]  [  WHY?
  • 33. It  started  as  a  simple  idea…  
  • 34.
  • 35. ?   ?   ?   …  and  started  to  think  
  • 37. …  AND  SCRIPT   K1DD13S  
  • 39. @thegrugq  26  Feb  2013  
  • 40. @thegrugq  26  Feb  2013  
  • 41. INCREASE   ATTACKER  COSTS   $  $   $  
  • 43.
  • 44. -­‐  When  the  tables  turn  (2004)     -­‐  Roelof  Temmingh,  Haroon  Meer,  Charl  van  der  Walt   -­‐  h]p://slideshare.net/sensepost/strikeback   -­‐  Stopping  Automated  A]ack  Tools  (2006)   -­‐  Gunter  Ollmann   -­‐  h]p://www.technicalinfo.net/papers/ StoppingAutomatedA]ackTools.html     Prior  Art  
  • 45. -­‐  mod-­‐security  mailing  list  (2006)     -­‐  Status  Code  503  together  w/  Retry-­‐Aoer  header   -­‐  Ryan  BarneW   -­‐  h]p://bb10.com/apache-­‐mod-­‐security-­‐user/ 2006-­‐12/msg00042.html   Prior  Art   SecFilterDefaultAceon  "deny,log,status:503"   SecFilter  ".*"   Header  set  Retry-­‐Aoer  "120"  
  • 46. #3   ]  [  HOW?
  • 47. BROWSERS  HAVE   TO  BE  FLEXIBLE  
  • 48. THIS  LEADS  TO   INTERPRETATION   …  which  leads  to  the  dark-­‐side  
  • 49. RFCS…     THEY’RE  MORE  OF  A   GUIDELINE  REALLY  
  • 50. WHAT COULD POSSIBLY GO WRONG!
  • 51. TESTING   THE  HOW  OF  THE  THING!   #3.1  
  • 52. §  Restricted  research  to  the  big  3   §  Internet  Explorer   §  Chrome  /  Chromium   §  Firefox  
  • 53. NO…  SAFARI  ISN’T   IN  THE  TOP  10  3  
  • 54. OPERA  JUMPED…   …or  was  it  pushed?  
  • 56. §  MITMproxy  /  MITMdump   §  Python-­‐based   §  Simple  to  setup  proxy  /  reverse  proxy   §  Script-­‐based  aceons  
  • 57. §  PHP   §  Ability  to  set  response  code   §  Must  be  at  the  top  of  the  PHP  code   §  Can  be  added  to  php.ini   §  auto-­‐prepend-­‐file  =  /full/path   §  Limited  by  web-­‐server  (apache)   #  set  response  code   Header($_server[“SERVER_PROTOCOL”].  ”  $status_code”);  
  • 58. §  Teseng  browsers  automaecally   §  Created  PHP  file  to  set  status  code   §  h]p://c22.cc/POC/respcode.php?code=XXX  
  • 59. BROWSERS   …  AND  THEIR  STATUS  CODE  HABITS   #3.2  
  • 60. Miss
  • 61.
  • 62.
  • 63.
  • 64.
  • 65.
  • 66. Browsers  handle   most  things  just  like   they  handle  a   200  OK?  
  • 68. §  HTML  Responses   §  Almost  all  response  codes  are  rendered   by  the  browser  correctly   §  iFrames   §  Some  special  cases  for  IE,  but  other   browsers  handle  this  the  same  as  HTML    
  • 69. §  JavaScript/CSS   §  Limited  accepted  status  codes   §  Limited  3XX  support   §  Chrome  is  the  excepeon  here   §  No  support  for  4XX/5XX  codes  
  • 70. So  we  know   what  browsers   interpret   differently  
  • 71. What  do   browsers  have   in  common?  
  • 72. §  1XX  code  handling   §  Retries   §  Confusion   §  Chrome  /  IE6  try  to  download  the  page!   §  Fun  on  Android…  (never  ending  download)   §  Times  outs  (eventually)  
  • 73. §  204  No  Content   §  Um,  no  content!   §  304  Not  Modified   §  Again,  no  content  returned  
  • 75. Just  because  the  RFC  says   a  specific  status  code   must  have  an  associated   header…  
  • 76. …doesn’t  mean   it  HAS  to  
  • 77. §  Redireceon  codes  (301-­‐304,  307)   §  No  Locaeon  header,  no  redirect   §  401  Unauthorized   §  No  WWW-­‐Authenecate  header,  no   authenecaeon  prompt   §  407  Proxy  Authenecaeon  Required   §  No  Proxy-­‐Authenecate  header,  no  prompt  
  • 78. Just  because  the  RFC  says   a  specific  status  code   shouldn’t  have  an   associated  header…    
  • 80. §  300  Muleple  Choices  w/  Locaeon  Header   §  Firefox  /  IE6  follows  the  redirect   §  Chrome  doesn’t   §  More  research  needed  in  this  direceon   §  Most  headers  are  unintereseng  /  ignored  
  • 81. EACH  BROWSER   HANDLES  THINGS  A   LITTLE  DIFFERENTLY  
  • 82. I  WONDER  WHAT   WE  CAN  DO   WITH  THAT!  
  • 83.
  • 84. #4   ]  [  GOALS
  • 85. §  Each  browser  handles  things  differently   §  Use  known  condieons   §  Handled  codes   §  Unhandled  codes   §  Browser  weirdness  
  • 87. §  Doesn’t  load  JavaScript  returned  with  a  300   ‘Muleple  Choices’  status  code   §  Other  browsers  tested  DO  (IE/Chrome)     §  Request  JavaScript  from  server   §  Response  Status:  300  Muleple  Choices   §  If  JavaScript  doesn’t  run  in  the  browser   §  Firefox   Firefox  
  • 88. §  Loads  JavaScript  returned  with  a  307   ‘Temporary  Redirect’  status  code   §  Other  browsers  tested  DON’T  (IE/FF)   §  Request  JavaScript  from  server   §  Response  Status:  307  Temporary  Redirect   §  If  JavaScript  runs  in  the  browser   §  Chrome   Chrome    
  • 89. §  Loads  JavaScript  returned  with  a  205  ‘Reset   Content’  status  code   §  Other  browsers  tested  DON’T  (FF/Chrome)   §  Request  JavaScript  from  server   §  Response  Status:  205  Reset  Content   §  If  JavaScript  runs  in  the  browser   §  Internet  Explorer   Internet  Explorer    
  • 91.
  • 92. §  Other  opeons  to  fingerprint  browsers   §  300  Redirect  (Chrome)   §  305  /  306  JavaScript  (Firefox)   §  400  iFrame  (Internet  Explorer)   §  …     POC  Script  à  h]p://c22.cc/POC/fingerprint.html  
  • 96. §  Chrome  handles  proxy  config  differently   §  407  status  code  isn’t  rendered     §  Unless  an  HTTP  proxy  is  set!   §  Allows  us  to  detect  if  an  HTTP  proxy  is  set   §  Just  not  which  proxy   §  Can  only  detect  HTTP  proxies  ;(   Chrome  Proxy  Deteceon  
  • 97. §  Request  page  from  server   §  Response  Status:  407  Proxy  Authenecaeon   §  w/o  Proxy-­‐Authenecate  header   §  If  Chrome  responds  HTTP  proxy  is  set   Chrome  Proxy  Deteceon  
  • 98.
  • 99. §  Privoxy  3.0.20  (CVE-­‐2013-­‐2503)   §  407  Proxy  Authenecaeon  Required   §  w/  Proxy-­‐Authenecate  header   §  User  prompted  for  user/pass   §  Prompt  appears  to  be  from  Privoxy   §  Privoxy  passes  user/pass  to  remote  site   §  Profit???   Side-­‐Effect:  Owning  Proxies  
  • 100. §  Not  just  Privoxy  that’s  effected   §  Any  transparent  proxy   §  e.g.  Burp,  ZAP,  …   §  Not  really  a  vuln  for  most   §  Works  as  designed!   Side-­‐Effect:  Owning  Proxies  
  • 101. #5   ]  [  BRINGINGITALL TOGETHER
  • 102. What  we  have   §  Status  codes  all  browsers  treat  as  content   §  Status  codes  all  browsers  can’t  handle   §  1XX,  etc..   §  Lots  of  browser  quirks  
  • 103. What  can  we  do   §  F*ck  with  things   §  Screw  with  scanner  monkeys   §  Make  RFC  lovers  cry  into  their  beer   §  Break  things  in  general  
  • 104. Let’s  try  to…   §  Use  what  we’ve  discovered  to…   §  Break  spidering  tools   §  Cause  false  posieves  /  negaeves   §  Slow  down  a]ackers   §  The  fun  way!   §  Blocking  successful  exploitaeon  
  • 106. Simplisec  view   of  spiders  
  • 107. §  Access  target  URL   §  Read  links  /  funceons   §  Test  them  out   §  If  true:  conenue   §  What  is  TRUE?  
  • 108. §  What  happens  if:   §  Every  response  is   §  200  OK   §  404  Not  Found   §  500  Internal  Server  Error  
  • 109. 200  OK   §  IF  200  ==  True:   §  Problems!   §  Never-­‐ending  spider  
  • 110. 404  Not  Found   §  IF  404  ==  False:   §  What  website?  
  • 111. 500  Internal  Server  Error   §  Skipfish  !=  happy  fish  
  • 113. §  Most  scanners  use  status  codes   §  At  least  to  some  extent   §  Inieal  match  (prior  to  more  costly  regex)   §  Speed  up  deteceon   §  Easy  solueon  
  • 114. §  What  happens  if:   §  Every  response  is   §  200  OK   §  404  Not  Found   §  500  Internal  Server  Error   §  raNd0M*   *  Using  codes  that  are  accepted  by  all  browsers  as  content    
  • 115. Vulnerability  Baseline   §  w3af   §  Informaeon  Points  à  79   §  Vulnerabiliees  à  65   §  Shells  à  0  shells  L   §  Scan  eme  à  1h37m23s  
  • 116. Every  response  200  OK   §  No  change  in  discoveries   §  All  points  discovered  -­‐  per  baseline   §  79  Informaeon  Points   §  65  Vulnerabiliees   §  0  Shells   §  Scan  eme  à  9h56m55s   §  Lots  more  to  check  ;)  
  • 117. Every  response  404  Not  Found   §  Less  to  scan  ==  Less  to  find   §  False  negaeves   §  44  Informaeon  Points  (-­‐35)   §  37  Vulnerabiliees  (-­‐28)     §  Scan  eme  à  7m13s   §  Much  quicker  scan   §  Less  paths  traversed  
  • 118. Every  response  500   §  Server  Error  ==  OMG  VULN  SANDWICH!   §  False  posieves+++   §  9540  Informaeon  points  (+9461)   §  9526  Vulnerabiliees  (+9461)    
  • 119. Random  Status  Codes   §  Muleple  test  runs   §  All  tests  produced  False  posieves++   §  avg.  619  Informaeon  points  (+540)   §  avg.  550  Vulnerabiliees  (+485)     §  Avg.  scan  eme  à  11m37s   §  Ooen  much  quicker  scans   §  Lots  of  variaeon  in  scan  emes  
  • 120. Random  Status  Codes   §  Skipfish  +  $random_status  =  chaos   §  False  Posieves  +  False  Negaeves   §  Scan  jobs  killed  (due  to  lack  of  scanner  resources)   §  Scan  emes   §  1st  scan  eme  à  10h3m35s   §  2nd  scan  eme  à  0h0m4s   §  3rd  scan  eme  à  16h47m41s  
  • 122. What  does   your  WAF   really  do?  
  • 123. §  OMG  A]ack   §  Block  /  Return  error   §  403,  500,  …   §  Profit???  
  • 125. Remember  that  list   of  status  codes   browsers  don’t   handle  well?  
  • 126. Yeah  well,  scanners   don’t  usually  handle   them  well  either!  
  • 127. Especially  the   1XX  codes  
  • 128. §  Remember  LaBrea  tarpit?   §  Tim  Liston  2001  *   §  Designed  to  slow  spread  of  Code  Red   §  Slows  down  scans  /  a]ackers   *  h]p://labrea.sourceforge.net  
  • 129.
  • 130. How  about  an   HTTP  Tarpit!  
  • 131.
  • 132. HTTP  Tarpit  Scenario   §  WAF  detects  scan  /  a]ack   §  Adds  source  IP  to  “naughty”  list   §  Rewrite  all  responses  from  the  server   §  100|101|102  status  codes  only  (random)   §  204|304  might  also  be  useful  (no  content)  
  • 133. Let’s  do   some   science!*   *  Science  not  included  
  • 134. vs.  the  HTTP  TARPIT   NIKTO  
  • 135. Baseline   HTTP  Tarpit   Scan  eme   2m  18s   Findings   18   14h  33m  2s   10  
  • 136. vs.  the  HTTP  TARPIT   W3AF  
  • 137. Baseline   HTTP  Tarpit   Scan  eme   1h  37m  23s   Findings   65   18m  10s   0  
  • 138. vs.  the  HTTP  TARPIT   SKIPFISH  
  • 139. Baseline   HTTP  Tarpit   Scan  eme   18m  10s   Findings   Low:  2519   Med:  2522   High:  12   Low:   Med:     High:   05s   0   0   3  
  • 140. vs.  the  HTTP  TARPIT   ACUNETIX  
  • 141. Baseline   HTTP  Tarpit   Scan  eme   1h  19m   Findings   Info:  1104   Low:  30   Med:  32   High:  24   Info:   Low:   Med:     High:   33m   3   3   1   0  
  • 142. HTTP  Tarpit  Results   §  HTTP  Tarpit  Results  *   §  Slow  down  scans   §  Nikto:  340x  as  long   §  Others  give  up  quicker  ;)   §  Unreliable  /  aborted  scans   §  Up  to  100%  less  findings   *  Not  scienefically  sound  ;)  
  • 144. We’ve  made  it   hard  to  find  the   vulnerabiliees  
  • 145. We’ve  made  it   Ome  consuming   for  a]ackers  
  • 146. Now  let’s  stop  the   sk1dd13s  using   Metasploit  to  pop   $hells  
  • 147. Q:  How  ooen  does  Metasploit  reference   status  codes?      rgrep  -­‐E  'res[p|ponse]?.code'  *   à  958  *   *  Not  scienefically  sound  ;)   rgrep  -­‐E  'res[p|ponse]?.code'  *  
  • 148. Lots  of   dependency  on   status  codes*   *  yep,  even  the  stuff  I  wrote  
  • 149.    if  (res.code  <  200  or  res.code  >=  300)        case  res.code        when  401          print_warning("Warning:  The  web  site          asked  for  authentication:  #{res.headers          ['WWW-­‐Authenticate']  ||  res.headers            ['Authentication']}")        end        fail_with(Exploit::Failure::Unknown,        "Upload  failed  on  #{path_tmp}        [#{res.code}  #{res.message}]")      end  
  • 150. No  match,   No  shell*   *  exploit  dependent  
  • 151. #6   ]  [  REVIEW
  • 152. §  Using  status  codes  to  our  benefit  is  fun   §  …  and  useful!   §  Browsers  can  be  quirky   §  Scanners  /  a]ack  toolkits  are  someemes   set  in  their  ways   §  Take  the  easy  route   §  Easy  to  fool  
  • 153. §  WAFs  need  to  get  more  offensive  about   their  defense   §  More  than  just  blocking  a  request   §  Even  if  you  use  a  snazzy  message   §  Hacking  back  is  bad   §  Slowing  down  known  a]acks  is  good   §  Make  life  harder  for  skiddies  is  pricele$$  
  • 154. §  Current  tools  are  much  the  same  as  APT   §  APT  (Adequate  Persistent  Threat)   §  Only  as  advanced  as  they  NEED  to  be  
  • 155. …because  screwing   with  sk1dd13s   is  fun!  
  • 157.
  • 158. §  PHP  (the  lowest  common  denominator)   §  auto-­‐prepend-­‐file   §  Limited  to  resources  PHP  handles   §  MITMdump   §  MITMproxy  ==  memory  hog   §  Reverse  proxy  mode   Ghe]o  Implementaeon  
  • 159.
  • 160. §  Usable  implementaeon   §  Nginx  as  reverse  proxy   §  Requires:  ngx_lua   §  ngx.status  =  XXX   §  Bugs  in  non-­‐git  version   §  203,  305,  306,  414,  505,  506  return  nil   h]ps://github.com/ChrisJohnRiley/Random_Code/blob/master/nginx/nginx.conf    
  • 161.
  • 162. §  Ease  adopeon   §  Implement  into  mod-­‐security   §  Not  a  simple  task   §  Already  been  discussed  many  emes   §  Help  wanted  ;)  
  • 164. §  Less  reliance  on  status  codes   §  More  reliance  on  content  /  headers   §  Pros     §  Be]er  matching  /  intelligence   §  Cons   §  Slower?  (regex  matching)   §  More  resource  intensive  
  • 165.
  • 167.   CODE  /  SCRIPTS  AVAILABLE     HTTP://GITHUB.COM/CHRISJOHNRILEY/RANDOM_CODE  
  • 168.
  • 169. Thanks  for  coming     h]p://blog.c22.cc   @ChrisJohnRiley        contact@c22.cc