What it takes to defend an application

Null Bhopal Meet

11 September 2016

Slides

Abstract

This session is an attempt to understand what would it take to defend an application. not just from web application security point but also external factors like server security to service provider selection to administrator’s laptop. This is high level overview of the security protections one should be thinking of while deploying an application. The session is conducted assuming a web application with fixed set of requirements is to be hosted and company has list of potential abusers and then discussion around what kind of protections should be present.

AI Generated Summary

AI Generated Content Disclaimer

Note: This summary is AI-generated and may contain inaccuracies, errors, or omissions. If you spot any issues, please contact the site owner for corrections. Errors or omissions are unintended.

“What It Takes to Secure a Web Application” was presented at Null Bhopal in September 2016. The session walks through the full security lifecycle of deploying and hardening a web application, from requirements gathering and software selection through OS hardening, web server and PHP configuration, database lockdown, HTTPS/TLS setup, SSH hardening, firewall rules, WAF deployment, and often-overlooked concerns like registrar security, admin endpoint protection, and backup strategy. Every decision is framed inside a realistic scenario: deploying a WordPress blog for a financial organization on a budget.

Summary

The scenario set concrete constraints: a financial organization’s public blog, accessed by the PR team plus one administrator, global accessibility including the admin interface, around one lakh hits a day, and a budget not to exceed $20 a month excluding the admin’s salary. The software stack followed from simplicity and cost: Linux, WordPress, PHP, NGINX, and MySQL. Threat modeling asked what is being protected and who the adversaries are: stray hackers, disgruntled employees, rivals or attackers for hire, and state agencies. On hosting, shared hosting was called the worst for security; the final pick was a virtual server instance with 1 core, 1 to 2 GB RAM, 1 static IP, and a management console at around $10 a month from providers like DigitalOcean, Linode, or AWS.

OS security kept ports 80 (redirecting to 443), 443, and 22 (SFTP over SSH) open, with port 25 reserved for outbound mail and never exposed publicly, plus automatic updates and a warning against untrusted PPAs. NGINX hardening used a 301 redirect, server_tokens off, autoindex off, the full security header set, clearing informative headers, and mapping error_page 403 =404 to prevent information leakage. PHP ran in FastCGI mode with hardened php.ini settings and long disable_functions lists per the OWASP PHP Configuration Cheat Sheet. Database rules: never use root or blank passwords, separate accounts by role, keep the WordPress user out of other databases, and never expose the database port. WordPress application security covered wp-admin login protection and information disclosure through username and attachment enumeration.

HTTPS transport security asked which certificate and ciphers to use and why Perfect Forward Secrecy matters, validated with SSLLabs, Mozilla’s Server Side TLS resources, and SSLScan; the recommendation was no CBC or RC4, preference above 128 bit, a trusted authority, SHA-256 signing, at least 2048-bit keys, and PFS, with the NGINX SSL config pinning a modern TLSv1.2-only cipher suite, adding HSTS, and enabling OCSP stapling. SSH hardening demanded key-based auth, no password login, no root login, and no X11 sharing.

Additional protections stacked four layers: a WAF (NAXSI as the default choice, ModSecurity the more powerful alternative), iptables (default DROP policy with port allowances chained into fail2ban plus minimal DoS mitigation rules), fail2ban (jails for SSH and WordPress login), and Docker for container-based separation of nginx, PHP, and MySQL. The deck then asked “are we done yet” and answered no: provider accounts need 2FA and complex passwords; registrar and DNS accounts need 2FA and resistance to social engineering, testable by calling them with fake details; the administrator laptop needs privilege separation, full disk encryption, and a password manager; and backups need multiple encrypted copies across onsite, offsite, and cold storage with periodic restoration testing.

Key Themes

Notable Points

Notable Quotes

“Linux OS (coz its “secure” [pun intended])”

“NGINX (coz its hip-hop)”

“Budget not to exceed 20$ a month excluding admin’s salary”

“Shared hosting (worst in terms of security)”

“what if backup don’t restore properly.”

“don’t just backup try periodically restoring them also”

Social chatter