SlideShare a Scribd company logo
1 of 48
Download to read offline
WHAT IT TAKES TO
SECURE A WEB APPLICATION
ANANT SHRIVASTAVA
NULL BHOPAL - SEP 2016
ANANT SHRIVASTAVA
Information Security Consultant
Admin - Dev - Security
null + OWASP + G4H
and @anantshri
Trainer : Blackhat, RuxCon, NullCon, g0s, c0c0n
Speaker : Nullcon, c0c0n, ClubHack, RootConf
http://anantshri.info
       
Android Tamer Code Vigilant
SO YOU WANT TO
HOST A WEB APPLICATION
LETS BEGIN
Ref: https://makeameme.org/meme/lets-begin-ms712r
DEFINING SCOPE
A Financial Organizations Public Blog
To be kept separate from internal/company network
Only PR team and one Administrator to have access.
Should be accessible across the globe (admin interface too)
Easy to use, WYSIWYG
Cost effective
Expected Traffic (1L hits a day)
Budget not to exceed 20$ a month excluding admin's salary
LETS SELECT THE SOFTWARE
1. Linux OS (coz its "secure" [pun intended])
2. Wordpress (coz its simpler)
3. PHP (coz WP needs it)
4. NGINX (coz its hip-hop)
5. mysql (coz that's what is generally used)
LET BOOK OUR DOMAIN
1. how cheap they are
2. do they offer freebies (discount / free whois protection / free ssl etc)
3. usability
Let me add
1. how quickly does the dns propagates
2. do they prevent domain ownership transfer
example : gandi, namecheap or more
P.S.: More on this later
SO YOU WANT TO SECURE IT
ref:http://meta.security.stackexchange.com/questions/880/the-memes-of-information-security
WHAT ARE YOU PROTECTING
Data on blog (reputation damage)
Defacement (reputation damage)
Financial data, year end review etc (money damage)
Site downtime (reputation damage)
Reverse hack on users and back-end users. (leading to potential internal
network compromise when they connect to internal network)
WHO IS YOUR ADVERSARY
Stray hacker / attacker
Disgruntled employee
Rival or determined attacker (for hire)
State Agencies
LETS GET STARTED
PROTECTION AND DEPLOYMENT
Ref: http://www.mememaker.net/meme/well-lets-begin-then/
WHERE WOULD YOU HOST IT
1. Shared hosting (worst in terms of security)
2. VPS
3. Cloud Services (GCloud, Azure, AWS etc)
4. Dedicated server
P.S. 2,3,4 basically means you take care of your own security different models
PAAS, IAAS, SAAS
LETS FINALIZE VPS / CLOUD
SERVER
virtual server instance
1. 1 Core
2. 1-2 GB RAM
3. 1 Static IP
4. 1 management console
Cost: 10$ or so.
Source: DO, Linode, AWS and more
BASIC SECURITY HYGIENE
Don't use pirated so ware
Verify OS installers before using them
Keep OS and components update
OS SECURITY
What ports need to be opened
21
22
80
443
25
what else
http port 80 should be opened or not.
p 21 should be used or not
https 443 to be or not to be
OS SECURITY
Ports to be kept open
80 (seemless redirection to 443)
443
22 (s p over ssh)
Services to be configured
nginx with 80 marked as auto forward to 443
ssh to allow s p access
443 with ssl
25 exim4 or sendmail for outbound emails not to be exposed publicly
OS SECURITY
Automatic updates
Encrypted partitions (Should we use them? what do they prevent)
why not to use ppa's or why not to use third party channels
WEB SERVER SECURITY
Port 80 redirect to 443 seamlessly
server {
listen 80;
listen [::]:80;
server_name abc.com ;
location / {
return 301 https://$host$request_uri;
}
}
Production config: header update
server_tokens off;
autoindex off;
more_set_headers "X-Frame-Options:
SAMEORIGIN";
more_set_headers "X-Content-Type-Options:
nosniff";
more_set_headers "X-XSS-Protection: 1;
mode=block";
more_set_headers "X-Download-Options:
noopen";
more_clear_headers 'Link';
more_clear_headers 'Server';
more_clear_headers 'X-CF-Powered-By';
error_page 403 = 404;
WEB LANGUAGE (PHP)
SECURITY
fastcgi mode
use GETor POSTand not REQUEST
don't rely on mysql_real_escape_string
Common basic prod settings
allow_url_fopen = Off
allow_url_include = Off
allow_webdav_methods = Off
expose_php = Off
error_reporting = E_ALL
display_errors = Off
display_startup_errors = Off
log_errors = On
error_log = /valid_path/PHP-logs/php_error.log
ignore_repeated_errors = Off
MORE
enable_dl = On
disable_functions = system, exec, shell_exec, passthru, phpinfo, show_source, popen,
proc_open
disable_functions = fopen_with_path, dbmopen, dbase_open, putenv, move_uploaded_file
disable_functions = chdir, mkdir, rmdir, chmod, rename
disable_functions = filepro, filepro_rowcount, filepro_retrieve, posix_mkfifo
# see also: http://ir.php.net/features.safe-mode
disable_classes =
Ref: https://www.owasp.org/index.php/PHP_Configuration_Cheat_Sheet
DATABASE SERVER SECURITY
Don't use root user for everything
Don't use blank password for any account
Separate accounts via there role.
WP user should not have access to other users db.
Never expose server port to public internet
WEB APPLICATION SECURITY
Login mechanism protection (wp-admin)
Information disclosure protection (username / attachment enumeration)
Basic Web application level attacks
self-plug self-plughttps://github.com/anantshri/wp-security
Ref: https://www.owasp.org/index.php/OWASP_Testing_Guide_v4_Table_of_Contents
HTTPS TRANSPORT SECURITY
What certificate to be used (Self signed, DV, EV or more)
What ciphers to be used
What is Perfect Forward Secrecy and why to use it
How to validate config
References
SSLlabs ( )
Mozilla ( )
Config generator (
)
SSLScan ( )
http://ssllabs.com/
https://wiki.mozilla.org/Security/Server_Side_TLS
https://mozilla.github.io/server-side-tls/ssl-config-
generator/
https://github.com/rbsec/sslscan
RECOMMENDATION
no CBC, RC4
no 40 or 56 bit cipher. prefer > 128 bit
SSL Certificate signed by trusted authority
sha-256 signed cert
Public key modulus >= 2048 bits
Prefer PFS (Perfect forward secrecy)
CONFIG
certs sent to the client in SERVER HELLO are concatenated in ssl_certificate
ssl_certificate /path/to/signed_cert_plus_intermediates;
ssl_certificate_key /path/to/private_key;
ssl_session_timeout 1d;
ssl_session_cache shared:SSL:50m;
ssl_session_tickets off;
HSTS (ngx_http_headers_module is required) (15768000 seconds = 6 months)
OCSP Stapling ---fetch OCSP records from URL in ssl_certificate and cache them
add_header Strict-Transport-Security max-age=15768000;
ssl_stapling on;
ssl_stapling_verify on;
MORE
modern configuration. tweak to your needs.
ssl_protocols TLSv1.2;
ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-
POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-
SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-
AES128-SHA256';
ssl_prefer_server_ciphers on;
verify chain of trust of OCSP response using Root CA and Intermediate certs
ssl_trusted_certificate /path/to/root_CA_cert_plus_intermediates;
resolver ;
SSH / REMOTE ADMIN SECURITY
Key based auth
no password allowed
no root login allowed
no sharing of X clients
Reference
ssh_scan ( )
Guidelines ( )
https://github.com/mozilla/ssh_scan
https://wiki.mozilla.org/Security/Guidelines/OpenSSH
ADDITIONAL PROTECTIONS
WAF
iptables
fail2ban
docker
WAF
NAXSI
Default config is a good starter
enable in learning mode
understand if it works for you
might also be blocking legitimate traffic initially so be careful.
more powerful alternative ModSecurity
IPTABLES
Default drop
Default port
Fail2ban config
# Setting default filter policy
iptables -P INPUT DROP
iptables -P OUTPUT DROP
iptables -P FORWARD DROP
-A INPUT -p tcp -m multiport --dports 80,443 -j fail2ban-
wordpress
-A INPUT -p tcp -m multiport --dports 22 -j fail2ban-ssh
-A INPUT -p tcp -m multiport --dports 22 -j fail2ban-ssh
-A INPUT -p tcp -m tcp --dport 22 -j ACCEPT
-A fail2ban-ssh -j RETURN
-A fail2ban-ssh -j RETURN
-A fail2ban-wordpress -j RETURN
MOAR IPTABLES
minimal DoS mitigation
-A INPUT -p tcp -m tcp --tcp-flags RST RST -m limit --limit 2/sec --limit-burst 2 -j
ACCEPT
-A INPUT -m state --state RELATED,ESTABLISHED -m limit --limit 50/sec --limit-burst 50
-j ACCEPT
-A INPUT -p tcp -m tcp --dport 443 -m limit --limit 50/min --limit-burst 200 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 80 -m limit --limit 50/min --limit-burst 200 -j ACCEPT
-A INPUT -p tcp -m tcp ! --tcp-flags FIN,SYN,RST,ACK SYN -m state --state NEW -j DROP
-A INPUT -p tcp -m tcp --tcp-flags FIN,SYN,RST,PSH,ACK,URG NONE -j DROP
-A INPUT -p tcp -m tcp --tcp-flags FIN,SYN,RST,PSH,ACK,URG FIN,SYN,RST,PSH,ACK,URG -j
DROP
-A INPUT -m conntrack --ctstate INVALID -j DROP
FAIL2BAN
destemail = EMAIL_ADDRESS
[wordpress]
enabled = true
filter = wordpress
logpath = /var/log/auth.log
maxretry = 3
port = http,https
[ssh]
enabled = true
port = ssh
filter = sshd
logpath = /var/log/auth.log
maxretry = 3
need a wordpress plugin to provide auth log : such as wp-fail2ban
DOCKER
new kid in the block
Allows for fine grained privilege seperation
runs everything in its own containers.
Web application will be divided
web server "nginx"
app server "php"
database server "mysql"
Useful but not necessary
ARE WE DONE YET
NOPE NOT YET
WELL WE COVERED
EVERYTHING
DID WE??
WHAT ABOUT
Server provider access control
domain registrar account security
DNS account security
administrator laptop
What about backup's
did we missed anything?
SERVER PROVIDER ACCESS
CONTROL
VPS / Cloud or any service provider also need to be in good shape
1. Use 2 factor authentication
2. Google authenticator / freeotp etc
3. Complex password
DOMAIN / DNS REGISTRAR
1. 2 factor authentication
2. do they allow easy transfer
3. do they get attacked by social engineering try calling them up giving them fake
details or public details and see if they accept it to reset your account password
or give you details.
ADMINISTRATOR LAPTOP
privilege separation
1 root user
1 admin user
1 non sudo/ admin user for daily operations.
switch to admin only when you need to install so ware
full disk encryption
encrypted storage to be used only for work
password manager
BACKUP PLANS
Think of following:
1. What if the server goes down entirely.
2. What if service provider goes down entirely (Linode Dec 2015)
3. What is the backups are only avialable with service provider.
4. what if backup don't restore properly.
BACKUP PLANS
1. multiple encrypted backup copies
2. onsite, offsite, cold storage
3. don't just backup try periodically restoring them also
4. Ensure security of these backup accounts are again maintained. Complex
passwords, end to end encryption, encrypted storage etc.
MORE QUESTIONS
1. how to keep all these secure / complex passwords
2. how to ensure people dont use weak passwords
3. Should we use something like cloudflare (Hosted DNS + traffic proxy) or not
THATS ALL

More Related Content

What's hot

Avoiding damage, shame and regrets data protection for mobile client-server a...
Avoiding damage, shame and regrets data protection for mobile client-server a...Avoiding damage, shame and regrets data protection for mobile client-server a...
Avoiding damage, shame and regrets data protection for mobile client-server a...Stanfy
 
Testing Android Security Codemotion Amsterdam edition
Testing Android Security Codemotion Amsterdam editionTesting Android Security Codemotion Amsterdam edition
Testing Android Security Codemotion Amsterdam editionJose Manuel Ortega Candel
 
Ruby and Framework Security
Ruby and Framework SecurityRuby and Framework Security
Ruby and Framework SecurityCreston Jamison
 
IstSec'14 - Onur ALANBEL - ShellShock
IstSec'14 - Onur ALANBEL - ShellShockIstSec'14 - Onur ALANBEL - ShellShock
IstSec'14 - Onur ALANBEL - ShellShockBGA Cyber Security
 
5 Bare Minimum Things A Web Startup CTO Must Worry About
5 Bare Minimum Things A Web Startup CTO Must Worry About5 Bare Minimum Things A Web Startup CTO Must Worry About
5 Bare Minimum Things A Web Startup CTO Must Worry AboutIndus Khaitan
 
Securing Hadoop with OSSEC
Securing Hadoop with OSSECSecuring Hadoop with OSSEC
Securing Hadoop with OSSECVic Hargrave
 
Shellcoding in linux
Shellcoding in linuxShellcoding in linux
Shellcoding in linuxAjin Abraham
 
Aws security with HIDS, OSSEC
Aws security with HIDS, OSSECAws security with HIDS, OSSEC
Aws security with HIDS, OSSECMayank Gaikwad
 
Everyone Matters In Infosec 2014
Everyone Matters In Infosec 2014Everyone Matters In Infosec 2014
Everyone Matters In Infosec 2014Micah Hoffman
 
HackFest 2015 - Rasp vs waf
HackFest 2015 - Rasp vs wafHackFest 2015 - Rasp vs waf
HackFest 2015 - Rasp vs wafIMMUNIO
 
OSX/Pirrit: The blue balls of OS X adware
OSX/Pirrit: The blue balls of OS X adwareOSX/Pirrit: The blue balls of OS X adware
OSX/Pirrit: The blue balls of OS X adwareAmit Serper
 
BlueHat v17 || Mitigations for the Masses: From EMET to Windows Defender Exp...
BlueHat v17 ||  Mitigations for the Masses: From EMET to Windows Defender Exp...BlueHat v17 ||  Mitigations for the Masses: From EMET to Windows Defender Exp...
BlueHat v17 || Mitigations for the Masses: From EMET to Windows Defender Exp...BlueHat Security Conference
 

What's hot (20)

Recon
ReconRecon
Recon
 
Avoiding damage, shame and regrets data protection for mobile client-server a...
Avoiding damage, shame and regrets data protection for mobile client-server a...Avoiding damage, shame and regrets data protection for mobile client-server a...
Avoiding damage, shame and regrets data protection for mobile client-server a...
 
Testing Android Security Codemotion Amsterdam edition
Testing Android Security Codemotion Amsterdam editionTesting Android Security Codemotion Amsterdam edition
Testing Android Security Codemotion Amsterdam edition
 
Down by the Docker
Down by the DockerDown by the Docker
Down by the Docker
 
Ruby and Framework Security
Ruby and Framework SecurityRuby and Framework Security
Ruby and Framework Security
 
Mod Security
Mod SecurityMod Security
Mod Security
 
IstSec'14 - Onur ALANBEL - ShellShock
IstSec'14 - Onur ALANBEL - ShellShockIstSec'14 - Onur ALANBEL - ShellShock
IstSec'14 - Onur ALANBEL - ShellShock
 
5 Bare Minimum Things A Web Startup CTO Must Worry About
5 Bare Minimum Things A Web Startup CTO Must Worry About5 Bare Minimum Things A Web Startup CTO Must Worry About
5 Bare Minimum Things A Web Startup CTO Must Worry About
 
Securing Hadoop with OSSEC
Securing Hadoop with OSSECSecuring Hadoop with OSSEC
Securing Hadoop with OSSEC
 
Shellcoding in linux
Shellcoding in linuxShellcoding in linux
Shellcoding in linux
 
Random numbers
Random numbersRandom numbers
Random numbers
 
Aws security with HIDS, OSSEC
Aws security with HIDS, OSSECAws security with HIDS, OSSEC
Aws security with HIDS, OSSEC
 
Everyone Matters In Infosec 2014
Everyone Matters In Infosec 2014Everyone Matters In Infosec 2014
Everyone Matters In Infosec 2014
 
OWASP Serverless Top 10
OWASP Serverless Top 10OWASP Serverless Top 10
OWASP Serverless Top 10
 
HackFest 2015 - Rasp vs waf
HackFest 2015 - Rasp vs wafHackFest 2015 - Rasp vs waf
HackFest 2015 - Rasp vs waf
 
WordPress Security 101
WordPress Security 101WordPress Security 101
WordPress Security 101
 
OSX/Pirrit: The blue balls of OS X adware
OSX/Pirrit: The blue balls of OS X adwareOSX/Pirrit: The blue balls of OS X adware
OSX/Pirrit: The blue balls of OS X adware
 
pwnd.sh
pwnd.shpwnd.sh
pwnd.sh
 
Nessus Basics
Nessus BasicsNessus Basics
Nessus Basics
 
BlueHat v17 || Mitigations for the Masses: From EMET to Windows Defender Exp...
BlueHat v17 ||  Mitigations for the Masses: From EMET to Windows Defender Exp...BlueHat v17 ||  Mitigations for the Masses: From EMET to Windows Defender Exp...
BlueHat v17 || Mitigations for the Masses: From EMET to Windows Defender Exp...
 

Viewers also liked

Owasp Mobile Risk Series : M4 : Unintended Data Leakage
Owasp Mobile Risk Series : M4 : Unintended Data LeakageOwasp Mobile Risk Series : M4 : Unintended Data Leakage
Owasp Mobile Risk Series : M4 : Unintended Data LeakageAnant Shrivastava
 
Owasp Mobile Risk Series : M3 : Insufficient Transport Layer Protection
Owasp Mobile Risk Series : M3 : Insufficient Transport Layer ProtectionOwasp Mobile Risk Series : M3 : Insufficient Transport Layer Protection
Owasp Mobile Risk Series : M3 : Insufficient Transport Layer ProtectionAnant Shrivastava
 
Career In Information security
Career In Information securityCareer In Information security
Career In Information securityAnant Shrivastava
 
Android Tamer BH USA 2016 : Arsenal Presentation
Android Tamer BH USA 2016 : Arsenal PresentationAndroid Tamer BH USA 2016 : Arsenal Presentation
Android Tamer BH USA 2016 : Arsenal PresentationAnant Shrivastava
 
OWASP Bangalore : OWTF demo : 13 Dec 2014
OWASP Bangalore : OWTF demo : 13 Dec 2014OWASP Bangalore : OWTF demo : 13 Dec 2014
OWASP Bangalore : OWTF demo : 13 Dec 2014Anant Shrivastava
 
Owasp Mobile Risk M2 : Insecure Data Storage : null/OWASP/G4H Bangalore Aug 2014
Owasp Mobile Risk M2 : Insecure Data Storage : null/OWASP/G4H Bangalore Aug 2014Owasp Mobile Risk M2 : Insecure Data Storage : null/OWASP/G4H Bangalore Aug 2014
Owasp Mobile Risk M2 : Insecure Data Storage : null/OWASP/G4H Bangalore Aug 2014Anant Shrivastava
 
Raspberry pi Beginners Session
Raspberry pi Beginners SessionRaspberry pi Beginners Session
Raspberry pi Beginners SessionAnant Shrivastava
 
Snake bites : Python for Pentesters
Snake bites : Python for PentestersSnake bites : Python for Pentesters
Snake bites : Python for PentestersAnant Shrivastava
 
Understanding The Known: OWASP A9 Using Components With Known Vulnerabilities
Understanding The Known: OWASP A9 Using Components With Known VulnerabilitiesUnderstanding The Known: OWASP A9 Using Components With Known Vulnerabilities
Understanding The Known: OWASP A9 Using Components With Known VulnerabilitiesAnant Shrivastava
 
When the internet bleeded : RootConf 2014
When the internet bleeded : RootConf 2014When the internet bleeded : RootConf 2014
When the internet bleeded : RootConf 2014Anant Shrivastava
 
One Laptop Per Child
One Laptop Per ChildOne Laptop Per Child
One Laptop Per Childprashant3535
 
What Firefox can tell about you? - Firefox Forensics
What Firefox can tell about you? - Firefox ForensicsWhat Firefox can tell about you? - Firefox Forensics
What Firefox can tell about you? - Firefox Forensicsprashant3535
 
C# Advanced L08-Networking+WCF
C# Advanced L08-Networking+WCFC# Advanced L08-Networking+WCF
C# Advanced L08-Networking+WCFMohammad Shaker
 

Viewers also liked (20)

Owasp Mobile Risk Series : M4 : Unintended Data Leakage
Owasp Mobile Risk Series : M4 : Unintended Data LeakageOwasp Mobile Risk Series : M4 : Unintended Data Leakage
Owasp Mobile Risk Series : M4 : Unintended Data Leakage
 
Owasp Mobile Risk Series : M3 : Insufficient Transport Layer Protection
Owasp Mobile Risk Series : M3 : Insufficient Transport Layer ProtectionOwasp Mobile Risk Series : M3 : Insufficient Transport Layer Protection
Owasp Mobile Risk Series : M3 : Insufficient Transport Layer Protection
 
Career In Information security
Career In Information securityCareer In Information security
Career In Information security
 
Android Tamer BH USA 2016 : Arsenal Presentation
Android Tamer BH USA 2016 : Arsenal PresentationAndroid Tamer BH USA 2016 : Arsenal Presentation
Android Tamer BH USA 2016 : Arsenal Presentation
 
OWASP Bangalore : OWTF demo : 13 Dec 2014
OWASP Bangalore : OWTF demo : 13 Dec 2014OWASP Bangalore : OWTF demo : 13 Dec 2014
OWASP Bangalore : OWTF demo : 13 Dec 2014
 
Owasp Mobile Risk M2 : Insecure Data Storage : null/OWASP/G4H Bangalore Aug 2014
Owasp Mobile Risk M2 : Insecure Data Storage : null/OWASP/G4H Bangalore Aug 2014Owasp Mobile Risk M2 : Insecure Data Storage : null/OWASP/G4H Bangalore Aug 2014
Owasp Mobile Risk M2 : Insecure Data Storage : null/OWASP/G4H Bangalore Aug 2014
 
basic knowhow hacking
basic knowhow hackingbasic knowhow hacking
basic knowhow hacking
 
Raspberry pi Beginners Session
Raspberry pi Beginners SessionRaspberry pi Beginners Session
Raspberry pi Beginners Session
 
Snake bites : Python for Pentesters
Snake bites : Python for PentestersSnake bites : Python for Pentesters
Snake bites : Python for Pentesters
 
Understanding The Known: OWASP A9 Using Components With Known Vulnerabilities
Understanding The Known: OWASP A9 Using Components With Known VulnerabilitiesUnderstanding The Known: OWASP A9 Using Components With Known Vulnerabilities
Understanding The Known: OWASP A9 Using Components With Known Vulnerabilities
 
When the internet bleeded : RootConf 2014
When the internet bleeded : RootConf 2014When the internet bleeded : RootConf 2014
When the internet bleeded : RootConf 2014
 
Web2.0 : an introduction
Web2.0 : an introductionWeb2.0 : an introduction
Web2.0 : an introduction
 
Avr introduction
Avr introductionAvr introduction
Avr introduction
 
WCF And ASMX Web Services
WCF And ASMX Web ServicesWCF And ASMX Web Services
WCF And ASMX Web Services
 
One Laptop Per Child
One Laptop Per ChildOne Laptop Per Child
One Laptop Per Child
 
Tracking Emails
Tracking EmailsTracking Emails
Tracking Emails
 
What Firefox can tell about you? - Firefox Forensics
What Firefox can tell about you? - Firefox ForensicsWhat Firefox can tell about you? - Firefox Forensics
What Firefox can tell about you? - Firefox Forensics
 
C# Advanced L08-Networking+WCF
C# Advanced L08-Networking+WCFC# Advanced L08-Networking+WCF
C# Advanced L08-Networking+WCF
 
Web Service Security
Web Service SecurityWeb Service Security
Web Service Security
 
Burpsuite yara
Burpsuite yaraBurpsuite yara
Burpsuite yara
 

Similar to Null bhopal Sep 2016: What it Takes to Secure a Web Application

EAP TLS, the Rolls-Royce of extensible authentication protocol (EAP) methods ...
EAP TLS, the Rolls-Royce of extensible authentication protocol (EAP) methods ...EAP TLS, the Rolls-Royce of extensible authentication protocol (EAP) methods ...
EAP TLS, the Rolls-Royce of extensible authentication protocol (EAP) methods ...Jisc
 
Writing & Sharing Great Modules - Puppet Camp Boston
Writing & Sharing Great Modules - Puppet Camp BostonWriting & Sharing Great Modules - Puppet Camp Boston
Writing & Sharing Great Modules - Puppet Camp BostonPuppet
 
Aeon mike guide transparent ssl filtering (1)
Aeon mike guide transparent ssl filtering (1)Aeon mike guide transparent ssl filtering (1)
Aeon mike guide transparent ssl filtering (1)Conrad Cruz
 
Aeon mike guide transparent ssl filtering
Aeon mike guide transparent ssl filteringAeon mike guide transparent ssl filtering
Aeon mike guide transparent ssl filteringConrad Cruz
 
Server hardening
Server hardeningServer hardening
Server hardeningTeja Babu
 
Writing & Sharing Great Modules on the Puppet Forge
Writing & Sharing Great Modules on the Puppet ForgeWriting & Sharing Great Modules on the Puppet Forge
Writing & Sharing Great Modules on the Puppet ForgePuppet
 
Securing Network Access with Open Source solutions
Securing Network Access with Open Source solutionsSecuring Network Access with Open Source solutions
Securing Network Access with Open Source solutionsNick Owen
 
The Enterprise Wor/d/thy/Press
The Enterprise Wor/d/thy/PressThe Enterprise Wor/d/thy/Press
The Enterprise Wor/d/thy/PressJeroen van Dijk
 
Palo Alto Networks authentication
Palo Alto Networks authenticationPalo Alto Networks authentication
Palo Alto Networks authenticationAlberto Rivai
 
Pyramid Deployment and Maintenance
Pyramid Deployment and MaintenancePyramid Deployment and Maintenance
Pyramid Deployment and MaintenanceJazkarta, Inc.
 
LAMP security practices
LAMP security practicesLAMP security practices
LAMP security practicesAmit Kejriwal
 
WordPress End-User Security
WordPress End-User SecurityWordPress End-User Security
WordPress End-User SecurityDre Armeda
 
Tame Your Build And Deployment Process With Hudson, PHPUnit, and SSH
Tame Your Build And Deployment Process With Hudson, PHPUnit, and SSHTame Your Build And Deployment Process With Hudson, PHPUnit, and SSH
Tame Your Build And Deployment Process With Hudson, PHPUnit, and SSHDavid Stockton
 
Securing Your Web Server
Securing Your Web ServerSecuring Your Web Server
Securing Your Web Servermanugoel2003
 
Docker Security workshop slides
Docker Security workshop slidesDocker Security workshop slides
Docker Security workshop slidesDocker, Inc.
 
Web application security
Web application securityWeb application security
Web application securityRavi Raj
 
Art of Web Backdoor - Pichaya Morimoto
Art of Web Backdoor - Pichaya MorimotoArt of Web Backdoor - Pichaya Morimoto
Art of Web Backdoor - Pichaya MorimotoPichaya Morimoto
 
The Enterprise Wor/d/thy/Press
The Enterprise Wor/d/thy/PressThe Enterprise Wor/d/thy/Press
The Enterprise Wor/d/thy/PressJeroen van Dijk
 

Similar to Null bhopal Sep 2016: What it Takes to Secure a Web Application (20)

EAP TLS, the Rolls-Royce of extensible authentication protocol (EAP) methods ...
EAP TLS, the Rolls-Royce of extensible authentication protocol (EAP) methods ...EAP TLS, the Rolls-Royce of extensible authentication protocol (EAP) methods ...
EAP TLS, the Rolls-Royce of extensible authentication protocol (EAP) methods ...
 
Writing & Sharing Great Modules - Puppet Camp Boston
Writing & Sharing Great Modules - Puppet Camp BostonWriting & Sharing Great Modules - Puppet Camp Boston
Writing & Sharing Great Modules - Puppet Camp Boston
 
Aeon mike guide transparent ssl filtering (1)
Aeon mike guide transparent ssl filtering (1)Aeon mike guide transparent ssl filtering (1)
Aeon mike guide transparent ssl filtering (1)
 
Aeon mike guide transparent ssl filtering
Aeon mike guide transparent ssl filteringAeon mike guide transparent ssl filtering
Aeon mike guide transparent ssl filtering
 
Download It
Download ItDownload It
Download It
 
Server hardening
Server hardeningServer hardening
Server hardening
 
Writing & Sharing Great Modules on the Puppet Forge
Writing & Sharing Great Modules on the Puppet ForgeWriting & Sharing Great Modules on the Puppet Forge
Writing & Sharing Great Modules on the Puppet Forge
 
Securing Network Access with Open Source solutions
Securing Network Access with Open Source solutionsSecuring Network Access with Open Source solutions
Securing Network Access with Open Source solutions
 
The Enterprise Wor/d/thy/Press
The Enterprise Wor/d/thy/PressThe Enterprise Wor/d/thy/Press
The Enterprise Wor/d/thy/Press
 
Palo Alto Networks authentication
Palo Alto Networks authenticationPalo Alto Networks authentication
Palo Alto Networks authentication
 
Pyramid Deployment and Maintenance
Pyramid Deployment and MaintenancePyramid Deployment and Maintenance
Pyramid Deployment and Maintenance
 
LAMP security practices
LAMP security practicesLAMP security practices
LAMP security practices
 
WordPress End-User Security
WordPress End-User SecurityWordPress End-User Security
WordPress End-User Security
 
Tame Your Build And Deployment Process With Hudson, PHPUnit, and SSH
Tame Your Build And Deployment Process With Hudson, PHPUnit, and SSHTame Your Build And Deployment Process With Hudson, PHPUnit, and SSH
Tame Your Build And Deployment Process With Hudson, PHPUnit, and SSH
 
Securing Your Web Server
Securing Your Web ServerSecuring Your Web Server
Securing Your Web Server
 
Docker Security workshop slides
Docker Security workshop slidesDocker Security workshop slides
Docker Security workshop slides
 
Web application security
Web application securityWeb application security
Web application security
 
Art of Web Backdoor - Pichaya Morimoto
Art of Web Backdoor - Pichaya MorimotoArt of Web Backdoor - Pichaya Morimoto
Art of Web Backdoor - Pichaya Morimoto
 
PHP Security
PHP SecurityPHP Security
PHP Security
 
The Enterprise Wor/d/thy/Press
The Enterprise Wor/d/thy/PressThe Enterprise Wor/d/thy/Press
The Enterprise Wor/d/thy/Press
 

More from Anant Shrivastava

Diverseccon keynote: My 2 Paisa's on Infosec World
Diverseccon keynote: My 2 Paisa's on Infosec WorldDiverseccon keynote: My 2 Paisa's on Infosec World
Diverseccon keynote: My 2 Paisa's on Infosec WorldAnant Shrivastava
 
WhitePaper : Security issues in android custom rom
WhitePaper : Security issues in android custom romWhitePaper : Security issues in android custom rom
WhitePaper : Security issues in android custom romAnant Shrivastava
 
Security Issues in Android Custom ROM
Security Issues in Android Custom ROMSecurity Issues in Android Custom ROM
Security Issues in Android Custom ROMAnant Shrivastava
 
Web application finger printing - whitepaper
Web application finger printing - whitepaperWeb application finger printing - whitepaper
Web application finger printing - whitepaperAnant Shrivastava
 
Battle Underground NullCon 2011 Walkthrough
Battle Underground NullCon 2011 WalkthroughBattle Underground NullCon 2011 Walkthrough
Battle Underground NullCon 2011 WalkthroughAnant Shrivastava
 
Nullcon Hack IM 2011 walk through
Nullcon Hack IM 2011 walk throughNullcon Hack IM 2011 walk through
Nullcon Hack IM 2011 walk throughAnant Shrivastava
 
Embedded Systems : introduction
Embedded Systems : introductionEmbedded Systems : introduction
Embedded Systems : introductionAnant Shrivastava
 

More from Anant Shrivastava (10)

Diverseccon keynote: My 2 Paisa's on Infosec World
Diverseccon keynote: My 2 Paisa's on Infosec WorldDiverseccon keynote: My 2 Paisa's on Infosec World
Diverseccon keynote: My 2 Paisa's on Infosec World
 
WhitePaper : Security issues in android custom rom
WhitePaper : Security issues in android custom romWhitePaper : Security issues in android custom rom
WhitePaper : Security issues in android custom rom
 
Security Issues in Android Custom ROM
Security Issues in Android Custom ROMSecurity Issues in Android Custom ROM
Security Issues in Android Custom ROM
 
Web application finger printing - whitepaper
Web application finger printing - whitepaperWeb application finger printing - whitepaper
Web application finger printing - whitepaper
 
Battle Underground NullCon 2011 Walkthrough
Battle Underground NullCon 2011 WalkthroughBattle Underground NullCon 2011 Walkthrough
Battle Underground NullCon 2011 Walkthrough
 
Nullcon Hack IM 2011 walk through
Nullcon Hack IM 2011 walk throughNullcon Hack IM 2011 walk through
Nullcon Hack IM 2011 walk through
 
Embedded Systems : introduction
Embedded Systems : introductionEmbedded Systems : introduction
Embedded Systems : introduction
 
introduction to Lamp Stack
introduction to Lamp Stackintroduction to Lamp Stack
introduction to Lamp Stack
 
Logic Families Electronics
Logic Families ElectronicsLogic Families Electronics
Logic Families Electronics
 
Filesystem
FilesystemFilesystem
Filesystem
 

Recently uploaded

Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
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
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
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
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentationphoebematthew05
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
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
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
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
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
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
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
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
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 

Recently uploaded (20)

Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 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
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
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
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentation
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
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
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
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
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
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
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
 
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
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 

Null bhopal Sep 2016: What it Takes to Secure a Web Application

  • 1. WHAT IT TAKES TO SECURE A WEB APPLICATION ANANT SHRIVASTAVA NULL BHOPAL - SEP 2016
  • 2. ANANT SHRIVASTAVA Information Security Consultant Admin - Dev - Security null + OWASP + G4H and @anantshri Trainer : Blackhat, RuxCon, NullCon, g0s, c0c0n Speaker : Nullcon, c0c0n, ClubHack, RootConf http://anantshri.info         Android Tamer Code Vigilant
  • 3. SO YOU WANT TO HOST A WEB APPLICATION
  • 6. DEFINING SCOPE A Financial Organizations Public Blog To be kept separate from internal/company network Only PR team and one Administrator to have access. Should be accessible across the globe (admin interface too) Easy to use, WYSIWYG Cost effective Expected Traffic (1L hits a day) Budget not to exceed 20$ a month excluding admin's salary
  • 7. LETS SELECT THE SOFTWARE 1. Linux OS (coz its "secure" [pun intended]) 2. Wordpress (coz its simpler) 3. PHP (coz WP needs it) 4. NGINX (coz its hip-hop) 5. mysql (coz that's what is generally used)
  • 8. LET BOOK OUR DOMAIN 1. how cheap they are 2. do they offer freebies (discount / free whois protection / free ssl etc) 3. usability Let me add 1. how quickly does the dns propagates 2. do they prevent domain ownership transfer example : gandi, namecheap or more P.S.: More on this later
  • 9. SO YOU WANT TO SECURE IT ref:http://meta.security.stackexchange.com/questions/880/the-memes-of-information-security
  • 10. WHAT ARE YOU PROTECTING Data on blog (reputation damage) Defacement (reputation damage) Financial data, year end review etc (money damage) Site downtime (reputation damage) Reverse hack on users and back-end users. (leading to potential internal network compromise when they connect to internal network)
  • 11. WHO IS YOUR ADVERSARY Stray hacker / attacker Disgruntled employee Rival or determined attacker (for hire) State Agencies
  • 12. LETS GET STARTED PROTECTION AND DEPLOYMENT Ref: http://www.mememaker.net/meme/well-lets-begin-then/
  • 13. WHERE WOULD YOU HOST IT 1. Shared hosting (worst in terms of security) 2. VPS 3. Cloud Services (GCloud, Azure, AWS etc) 4. Dedicated server P.S. 2,3,4 basically means you take care of your own security different models PAAS, IAAS, SAAS
  • 14. LETS FINALIZE VPS / CLOUD SERVER virtual server instance 1. 1 Core 2. 1-2 GB RAM 3. 1 Static IP 4. 1 management console Cost: 10$ or so. Source: DO, Linode, AWS and more
  • 15. BASIC SECURITY HYGIENE Don't use pirated so ware Verify OS installers before using them Keep OS and components update
  • 16. OS SECURITY What ports need to be opened 21 22 80 443 25 what else http port 80 should be opened or not. p 21 should be used or not https 443 to be or not to be
  • 17. OS SECURITY Ports to be kept open 80 (seemless redirection to 443) 443 22 (s p over ssh) Services to be configured nginx with 80 marked as auto forward to 443 ssh to allow s p access 443 with ssl 25 exim4 or sendmail for outbound emails not to be exposed publicly
  • 18. OS SECURITY Automatic updates Encrypted partitions (Should we use them? what do they prevent) why not to use ppa's or why not to use third party channels
  • 19. WEB SERVER SECURITY Port 80 redirect to 443 seamlessly server { listen 80; listen [::]:80; server_name abc.com ; location / { return 301 https://$host$request_uri; } }
  • 20. Production config: header update server_tokens off; autoindex off; more_set_headers "X-Frame-Options: SAMEORIGIN"; more_set_headers "X-Content-Type-Options: nosniff"; more_set_headers "X-XSS-Protection: 1; mode=block"; more_set_headers "X-Download-Options: noopen"; more_clear_headers 'Link'; more_clear_headers 'Server'; more_clear_headers 'X-CF-Powered-By'; error_page 403 = 404;
  • 21. WEB LANGUAGE (PHP) SECURITY fastcgi mode use GETor POSTand not REQUEST don't rely on mysql_real_escape_string Common basic prod settings allow_url_fopen = Off allow_url_include = Off allow_webdav_methods = Off expose_php = Off error_reporting = E_ALL display_errors = Off display_startup_errors = Off log_errors = On error_log = /valid_path/PHP-logs/php_error.log ignore_repeated_errors = Off
  • 22. MORE enable_dl = On disable_functions = system, exec, shell_exec, passthru, phpinfo, show_source, popen, proc_open disable_functions = fopen_with_path, dbmopen, dbase_open, putenv, move_uploaded_file disable_functions = chdir, mkdir, rmdir, chmod, rename disable_functions = filepro, filepro_rowcount, filepro_retrieve, posix_mkfifo # see also: http://ir.php.net/features.safe-mode disable_classes = Ref: https://www.owasp.org/index.php/PHP_Configuration_Cheat_Sheet
  • 23. DATABASE SERVER SECURITY Don't use root user for everything Don't use blank password for any account Separate accounts via there role. WP user should not have access to other users db. Never expose server port to public internet
  • 24. WEB APPLICATION SECURITY Login mechanism protection (wp-admin) Information disclosure protection (username / attachment enumeration) Basic Web application level attacks self-plug self-plughttps://github.com/anantshri/wp-security Ref: https://www.owasp.org/index.php/OWASP_Testing_Guide_v4_Table_of_Contents
  • 25. HTTPS TRANSPORT SECURITY What certificate to be used (Self signed, DV, EV or more) What ciphers to be used What is Perfect Forward Secrecy and why to use it How to validate config References SSLlabs ( ) Mozilla ( ) Config generator ( ) SSLScan ( ) http://ssllabs.com/ https://wiki.mozilla.org/Security/Server_Side_TLS https://mozilla.github.io/server-side-tls/ssl-config- generator/ https://github.com/rbsec/sslscan
  • 26. RECOMMENDATION no CBC, RC4 no 40 or 56 bit cipher. prefer > 128 bit SSL Certificate signed by trusted authority sha-256 signed cert Public key modulus >= 2048 bits Prefer PFS (Perfect forward secrecy)
  • 27. CONFIG certs sent to the client in SERVER HELLO are concatenated in ssl_certificate ssl_certificate /path/to/signed_cert_plus_intermediates; ssl_certificate_key /path/to/private_key; ssl_session_timeout 1d; ssl_session_cache shared:SSL:50m; ssl_session_tickets off; HSTS (ngx_http_headers_module is required) (15768000 seconds = 6 months) OCSP Stapling ---fetch OCSP records from URL in ssl_certificate and cache them add_header Strict-Transport-Security max-age=15768000; ssl_stapling on; ssl_stapling_verify on;
  • 28. MORE modern configuration. tweak to your needs. ssl_protocols TLSv1.2; ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20- POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM- SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA- AES128-SHA256'; ssl_prefer_server_ciphers on; verify chain of trust of OCSP response using Root CA and Intermediate certs ssl_trusted_certificate /path/to/root_CA_cert_plus_intermediates; resolver ;
  • 29. SSH / REMOTE ADMIN SECURITY Key based auth no password allowed no root login allowed no sharing of X clients Reference ssh_scan ( ) Guidelines ( ) https://github.com/mozilla/ssh_scan https://wiki.mozilla.org/Security/Guidelines/OpenSSH
  • 31. WAF NAXSI Default config is a good starter enable in learning mode understand if it works for you might also be blocking legitimate traffic initially so be careful. more powerful alternative ModSecurity
  • 32. IPTABLES Default drop Default port Fail2ban config # Setting default filter policy iptables -P INPUT DROP iptables -P OUTPUT DROP iptables -P FORWARD DROP -A INPUT -p tcp -m multiport --dports 80,443 -j fail2ban- wordpress -A INPUT -p tcp -m multiport --dports 22 -j fail2ban-ssh -A INPUT -p tcp -m multiport --dports 22 -j fail2ban-ssh -A INPUT -p tcp -m tcp --dport 22 -j ACCEPT -A fail2ban-ssh -j RETURN -A fail2ban-ssh -j RETURN -A fail2ban-wordpress -j RETURN
  • 33. MOAR IPTABLES minimal DoS mitigation -A INPUT -p tcp -m tcp --tcp-flags RST RST -m limit --limit 2/sec --limit-burst 2 -j ACCEPT -A INPUT -m state --state RELATED,ESTABLISHED -m limit --limit 50/sec --limit-burst 50 -j ACCEPT -A INPUT -p tcp -m tcp --dport 443 -m limit --limit 50/min --limit-burst 200 -j ACCEPT -A INPUT -p tcp -m tcp --dport 80 -m limit --limit 50/min --limit-burst 200 -j ACCEPT -A INPUT -p tcp -m tcp ! --tcp-flags FIN,SYN,RST,ACK SYN -m state --state NEW -j DROP -A INPUT -p tcp -m tcp --tcp-flags FIN,SYN,RST,PSH,ACK,URG NONE -j DROP -A INPUT -p tcp -m tcp --tcp-flags FIN,SYN,RST,PSH,ACK,URG FIN,SYN,RST,PSH,ACK,URG -j DROP -A INPUT -m conntrack --ctstate INVALID -j DROP
  • 34. FAIL2BAN destemail = EMAIL_ADDRESS [wordpress] enabled = true filter = wordpress logpath = /var/log/auth.log maxretry = 3 port = http,https [ssh] enabled = true port = ssh filter = sshd logpath = /var/log/auth.log maxretry = 3 need a wordpress plugin to provide auth log : such as wp-fail2ban
  • 35. DOCKER new kid in the block Allows for fine grained privilege seperation runs everything in its own containers. Web application will be divided web server "nginx" app server "php" database server "mysql" Useful but not necessary
  • 36. ARE WE DONE YET
  • 40. WHAT ABOUT Server provider access control domain registrar account security DNS account security administrator laptop What about backup's did we missed anything?
  • 41. SERVER PROVIDER ACCESS CONTROL VPS / Cloud or any service provider also need to be in good shape 1. Use 2 factor authentication 2. Google authenticator / freeotp etc 3. Complex password
  • 42. DOMAIN / DNS REGISTRAR 1. 2 factor authentication 2. do they allow easy transfer 3. do they get attacked by social engineering try calling them up giving them fake details or public details and see if they accept it to reset your account password or give you details.
  • 43. ADMINISTRATOR LAPTOP privilege separation 1 root user 1 admin user 1 non sudo/ admin user for daily operations. switch to admin only when you need to install so ware full disk encryption encrypted storage to be used only for work password manager
  • 44. BACKUP PLANS Think of following: 1. What if the server goes down entirely. 2. What if service provider goes down entirely (Linode Dec 2015) 3. What is the backups are only avialable with service provider. 4. what if backup don't restore properly.
  • 45. BACKUP PLANS 1. multiple encrypted backup copies 2. onsite, offsite, cold storage 3. don't just backup try periodically restoring them also 4. Ensure security of these backup accounts are again maintained. Complex passwords, end to end encryption, encrypted storage etc.
  • 46. MORE QUESTIONS 1. how to keep all these secure / complex passwords 2. how to ensure people dont use weak passwords 3. Should we use something like cloudflare (Hosted DNS + traffic proxy) or not
  • 47.