Security is not a feature!
π¨ π»
π¦π· Nacho Anaya
π¦ @ianaya89
- π Principal Engineer https://twitter.com/@BalloonPlatform
- π¨βπ Ambassador @Auth0 & @GitKraken
- π£ Tech Speaker @MozTechSpeakers
- π Organizador @Vuenos_Aires
πββοΈπββοΈ
"Hay dos tipos de empresas: aquellas que han sido hackeadas y aquellas que todavΓa no saben que han sido hackeadas"
John T. Chambers
π€ Entender el problema
πΉ Zoom
Competencia Despareja
π ... π
π 3.5 Billones
πΈ Perdida de Dinero
π€¬ Perdida de Confianza
π Cultura
- πββοΈ CapacitaciΓ³n
- π Politicas
- β± Tiempo
- π΅ Dinero
"Si gastas mas dinero en cafe que en Seguridad IT, vas a ser hackeado. En realidad, te mereces ser hackeado"
Richard A. Clarke
πββοΈ π β± π΅
Invertir!
π Mirada SistΓ©mica
π Vulnerabilidades
Heartbleed
π¦ TCP es complejo
HTTP/S - WebSockets - DNS - TCP - FTP - IPv4 - IPv6 - SSH- ASCII - IRC
π Los navegadores tambien
HTML - CSS - JS
DOM - Geolocation - Multimedia - Fetch - Web Sockets - Storage
π Entender la SoluciΓ³n
π€·ββοΈ No hay soluciΓ³n perfecta
πͺ Pero podemos prepararnos
π Seguridad no es "nice to have"
π Seguridad por defecto
π£ Siempre, pero siempre...
Asumamos lo peor
π€ Conocer tu AplicaciΓ³n.
πͺ Vectores de Entrada
Query String - URL Path - Request Body - Cookies - Request Headers - Form Fields - File Inputs - Emails - Web Socket - Browser Storage
β οΈ No confiar en los usuarios
β Checklist de Seguridad
π¨
π HTTPS
π 2020
β¬οΈ Actualizar Versiones
- Node.js (12.18.0 LTS)
- npm (6.14.4)
- express (4.17.1)
π¦ Actualizar Dependencias
π¦ Linter
eslint-plugin-security
π SQL / No-SQL Injection
π β SQL / No-SQL Injection
- Validar inputs en el SERVER
- Sanitizar queries
- Usar ORM / ODM
π π SQL / No-SQL Injection
π€ XSS
π€β XSS
- Validar inputs en el SERVER
- "Encodear" output (HTML)
- Secure Response Headers
π€ πββοΈ XSS Headers
- HSTS
- HPKP
- X-Frame-Options
- X-XSS-Protection
- X-Content-Type-Options
- Referrer-Policy
- Expect-CT
- Content-Security-Policy
Secure Headers
π€π XSS
- @hapi/joi
- express-validator
- helmet
- csurf (CSRF)
π΅ DoS
π΅ β DoS
- Rate limiting
- Manejo de errores
- "Crasheos" explΓcitos
- Validacion de Regex
- Bloqueo de Usuarios / IP
π΅ π DoS
- express-rate-limit (basico)
- node-rate-limiter-flexible (avanzado)
try/cath
-catch()
-if (err)
- safe-regex
π Sesiones & Tokens
π β Sesiones & Tokens
- No exponer
- Expirar
- Blacklist o WhiteList
- OAUTH - OpenID
π π Sesiones & Tokens
π Passwords
Time to crack
π β Passwords
- hash + salt (no usar
crypto
) - ContraseΓ±as fuertes (entropia)
- MFA
π π Passwords
π π Have I been pawned?
https://haveibeenpwned.com
π π Have I been pawned?
https://haveibeenpwned.com
π π Have I been pawned?
API & DB
πΆ Dev Passwords & Secrets
- CI
- Dev Tools
- Cloud
- Keys - Tokens - Secrets
πΆ β Dev Passwords & Secrets
- 1Password
- Blackbox
- GPG
- Secret Manager (AWS)
- MFA β οΈ
πͺ Cookies
πͺ π© Cookies Flags
httpOnly
secure
SameSite
πͺ β©οΈ Cookies Scoping
- domain
- path
- expires
π Logging & Monitoring
π π Logging & Monitoring
π π Logging & Monitoring
- datadog & new relic (monitoreo)
- sentry & bugsnag (errores)
- papertrail & loggly (logs)
- pingdom & checkly (status)
π³ Exponer InformaciΓ³n Sensible
π³ β
Exponer InformaciΓ³n Sensible
Simplemente no!
π» OWASP Top 10
owasp.org
π€ Recursos
- owasp.org
- WebGoat
- Web Security Basics
- MIT Computer Systems Security
- The Node.js best practices list
- Web Application Security