Module 5 ยท Software Engineering ยท Lesson 4 of 5
Security in Web
and Cloud Systems
Based on CyBOK โ€” The Cyber Security Body of Knowledge (cybok.org)
๐Ÿ›ก๏ธ CyBOK Framework
๐Ÿ”Ÿ OWASP Top 10
๐Ÿ” Auth & AuthZ
โ˜๏ธ Cloud Security
๐Ÿ”‘ Cryptography
๐Ÿ”„ DevSecOps
Lesson Agenda
Structure of today's session

๐Ÿ• Block 1 โ€” CyBOK Overview (20 min)

The Cyber Security Body of Knowledge: 5 categories, 21 knowledge areas and how they map to our project.

๐Ÿ•‘ Block 2 โ€” OWASP Top 10 (25 min)

The 10 most critical web security risks with real attack examples and mitigations.

๐Ÿ•’ Block 3 โ€” Auth, Crypto & Cloud (30 min)

Authentication vs Authorization, encryption in transit/at rest, and cloud shared responsibility.

๐ŸŽฏ Goal

Recognize critical security risks and apply CyBOK-informed protections for web applications and cloud infrastructure.

CyBOK โ€” Cyber Security Body of Knowledge
The international reference for cybersecurity education

๐Ÿ“– What is CyBOK?

An open, freely accessible body of knowledge developed by 115+ international experts, funded by the UK National Cyber Security Programme. Version 1.1 (current) defines 21 Knowledge Areas organized in 5 categories.

๐ŸŽฏ Why CyBOK matters?

It provides a shared vocabulary for cybersecurity, just like SWEBOK does for software engineering. It maps to university curricula and professional certifications. References IEEE SWEBOK v3 and ACM CS 2013.

Today we focus on the Knowledge Areas most relevant to our project: Web & Mobile Security, Authentication, Authorization & Accountability, Network Security (Cloud), and Applied Cryptography.

CyBOK โ€” 5 Categories, 21 Knowledge Areas
The full landscape of cybersecurity knowledge
๐Ÿ‘ค
Human
4 KAs
โš”๏ธ
Attacks
4 KAs
๐Ÿ–ฅ๏ธ
Systems
5 KAs
๐Ÿ’ป
Software
3 KAs
๐ŸŒ
Infrastructure
5 KAs
HORA
Human & Org
Risk Mgmt, Law, Human Factors, Privacy
AD
Attacks & Defences
Forensics, SecOps, Adversarial, Malware
SYS
Systems Security
AAA, Crypto, Distributed, OS, Formal
SPS
Software & Platform
Secure Lifecycle, Web & Mobile, Software Sec
IS
Infrastructure
Network, Cloud, Hardware, CPS, Telecom
OWASP Top 10 โ€” Critical Web Security Risks
CyBOK KA: Web & Mobile Security (SPS)
A01
Broken Access Control
Users act outside intended permissions
A02
Cryptographic Failures
Weak encryption or exposed secrets
A03
Injection
SQL, NoSQL, OS command, LDAP injection
A04
Insecure Design
Missing threat modeling and secure patterns
A05
Security Misconfiguration
Default configs, open ports, verbose errors
A06
Vulnerable Components
Outdated libraries with known CVEs
A07
Auth Failures
Broken authentication and session mgmt
A08
Data Integrity Failures
Insecure CI/CD, unsigned updates
A09
Logging & Monitoring
Insufficient logging delays breach detection
A10
SSRF
Server makes requests to unintended locations

A01 (Broken Access Control) has been the #1 risk since 2021. 94% of applications tested had some form of broken access control. Always validate permissions server-side.

A03 โ€” Injection: SQL Injection Demo
CyBOK KA: Software Security (SPS)

Vulnerable Code

server.js โ€” VULNERABLE

Secure Code (Parameterized)

server.js โ€” SECURE

The attacker inputs ' OR '1'='1' -- to bypass login. Parameterized queries prevent this by separating SQL structure from user data.

XSS & CSRF โ€” Client-Side Attacks
CyBOK KA: Web & Mobile Security (SPS)

XSS โ€” Cross-Site Scripting

Attacker injects malicious JavaScript into pages viewed by other users.

  • Stored XSS: script persisted in database
  • Reflected XSS: script in URL parameters
  • DOM XSS: client-side JS manipulation

Fix: output encoding, Content Security Policy (CSP), textContent instead of innerHTML

CSRF โ€” Cross-Site Request Forgery

Attacker tricks authenticated user into submitting unintended requests.

  • Exploits browser automatic cookie sending
  • User clicks link that triggers bank transfer
  • Server thinks it is a legitimate request

Fix: CSRF tokens, SameSite cookies, verify Origin header

Both XSS and CSRF exploit the trust relationship between browser and server. Defense requires layered controls: input validation, output encoding, secure headers, and proper session management.

Authentication vs Authorization (AAA)
CyBOK KA: Authentication, Authorization & Accountability
Aspect๐Ÿ” Authentication (AuthN)๐Ÿ›ก๏ธ Authorization (AuthZ)
Question Who are you? What can you do?
Mechanism Passwords, MFA, OAuth, JWT RBAC, ABAC, Policies
Principle Verify identity Least privilege
Failure Impersonation Privilege escalation
CyBOK ref User Authentication KA Access Control KA

Never trust the client alone. Always validate permissions server-side on every request. Authentication without proper authorization is an open door.

JWT & OAuth 2.0 โ€” Modern Auth Flow
CyBOK KA: Authentication, Authorization & Accountability
๐Ÿ‘ค
User Login
Credentials
๐Ÿ”
Auth Server
Validates
๐ŸŽซ
JWT Issued
Signed Token
๐Ÿ“ก
API Request
Bearer Token
โœ…
Verified
Access Granted

๐ŸŽซ JWT Structure

header.payload.signature

  • Header: algorithm (HS256, RS256)
  • Payload: claims (sub, exp, roles)
  • Signature: HMAC or RSA signed

Stateless โ€” no server-side session needed.

๐Ÿ”‘ OAuth 2.0 + OIDC

  • OAuth 2.0: authorization framework (scopes)
  • OpenID Connect: identity layer on top
  • Flows: Authorization Code, PKCE (mobile)
  • Never store tokens in localStorage

Use httpOnly cookies or secure storage.

Cryptography โ€” Protecting Data
CyBOK KA: Cryptography & Applied Cryptography

๐Ÿ”’ In Transit (TLS/HTTPS)

  • TLS 1.3: modern default, faster handshake
  • Certificate validation via Web PKI
  • HSTS header forces HTTPS
  • Perfect Forward Secrecy (PFS)

Every API call must use HTTPS. No exceptions.

๐Ÿ’พ At Rest

  • AES-256 for encrypted storage
  • Database encryption (transparent or column-level)
  • Passwords: hash, never encrypt
  • Use bcrypt or Argon2 for password hashing

Encryption keys must be managed separately from data.

SYMMETRIC
AES-256
Same key encrypts and decrypts. Fast. Used for data at rest.
ASYMMETRIC
RSA / ECDSA
Public + Private key pair. Used for TLS, digital signatures.
HASHING
bcrypt / Argon2
One-way. Cannot be reversed. Used for passwords.
Cloud Security โ€” Shared Responsibility
CyBOK KA: Network Security (Infrastructure)
๐Ÿ‘ค
Customer Responsibility
Data, identity (IAM), app security, config, encryption keys
YOU are responsible for what you put IN the cloud
shared boundary
โ˜๏ธ
Provider Responsibility
Physical security, network infrastructure, hypervisor, hardware
AWS/GCP/Azure secures the cloud ITSELF

Common Mistakes

  • Public S3 buckets with sensitive data
  • Hardcoded credentials in Git repos
  • Wide-open security groups (0.0.0.0/0)
  • No audit logging enabled
  • Root account without MFA

Best Practices

  • Least-privilege IAM policies
  • Secrets in vault (AWS Secrets Manager)
  • Private subnets for databases
  • CloudTrail / audit logs always ON
  • Infrastructure as Code (Terraform)
DevSecOps โ€” Security in the Pipeline
CyBOK KA: Secure Software Lifecycle (SPS)
๐Ÿ“
Plan
Threat Model
๐Ÿ’ป
Code
SAST + Linters
๐Ÿ”จ
Build
SCA + SBOM
๐Ÿงช
Test
DAST + Pen Test
๐Ÿš€
Deploy
Monitor + Respond

๐Ÿ” Shift Left

Move security checks earlier in the pipeline. Bugs found in design cost 6x less to fix than bugs found in production.

  • SAST: Static analysis (SonarQube, Semgrep)
  • SCA: Dependency scanning (npm audit, Snyk)
  • SBOM: Software Bill of Materials

๐Ÿ›ก๏ธ Runtime Defense

Security does not stop at deployment.

  • DAST: Dynamic testing (OWASP ZAP)
  • WAF: Web Application Firewall
  • SIEM: Security monitoring (alerts)
  • Incident Response: Plan before you need it
HTTP Security Headers in Practice
Quick wins for web application hardening
nginx.conf โ€” Security Headers

CSP โ€” Content Security Policy

Controls which scripts, styles and resources the browser is allowed to load. Strongest defense against XSS.

HSTS โ€” HTTP Strict Transport Security

Forces HTTPS for all future visits. max-age=31536000 = 1 year. Prevents SSL stripping attacks.

Backend for Frontend (BFF) โ€” Security & SEO
Architectural pattern for secure, indexable web apps

๐Ÿ”’ Security Benefits

  • Secrets stay server-side: API keys never reach the browser
  • Reduced attack surface: internal services in private subnets
  • Central auth: one place for JWT, CSRF, cookies
  • Input validation: sanitize at the BFF boundary

Rule: the browser only talks to the BFF, never to internal APIs.

๐Ÿ” SEO Benefits

  • SSR: full HTML for crawlers โ€” no JS dependency
  • Meta tags: dynamic og:title, og:image per page
  • Core Web Vitals: faster LCP, better ranking
  • Social previews: correct cards on Twitter, LinkedIn, WhatsApp

Frameworks: Next.js, Nuxt, SvelteKit have built-in BFF.

๐ŸŒ
Browser
Request
๐Ÿ–ฅ๏ธ
BFF Server
Auth + SSR
๐Ÿ”‘
Internal APIs
Private Subnet
๐Ÿ—„๏ธ
Database
Encrypted

Without BFF: fetch('https://api.stripe.com', { headers: { Authorization: 'sk_live_...' } }) in the browser exposes your secret key in DevTools. BFF eliminates this entire class of vulnerability.

Security Checklist for Your Project
Click to check off items as you implement them

Application Security

  • All user inputs validated and sanitized
  • Parameterized queries for all database access
  • Output encoding to prevent XSS
  • CSRF tokens on state-changing requests
  • Security headers configured (CSP, HSTS, etc)
  • Dependencies scanned for known vulnerabilities

Auth & Infrastructure

  • Passwords hashed with bcrypt/Argon2
  • JWT tokens with proper expiration
  • HTTPS enforced everywhere
  • Least-privilege IAM policies
  • Secrets in environment variables or vault
  • Audit logging enabled
Key Takeaways
Security in Web and Cloud Systems
1
CyBOK organizes security into 5 categories, 21 KAs
The international reference for cybersecurity education
2
OWASP Top 10: know the risks, apply the fixes
Injection, broken access, misconfiguration are top threats
3
AuthN != AuthZ โ€” both mandatory, server-side
JWT, OAuth 2.0, RBAC, least privilege
4
Encrypt in transit (TLS) and at rest (AES)
Hash passwords with bcrypt/Argon2, never encrypt them
5
Cloud = Shared Responsibility + DevSecOps
Shift left: security from design to deployment

๐Ÿ“– Further Reading

  • CyBOK: cybok.org โ€” free knowledge base
  • OWASP: owasp.org/Top10
  • NIST: Cybersecurity Framework

Next Lesson

Agile Project Management: Fundamentals and Practical Applications