Enterprise Cyber Security Cheatsheet

Essential Network Ports, Cyber Attack Vectors, Windows Event IDs, and KQL Queries

🌐 Essential Network Ports & Protocols
Port 21
FTP (File Transfer Protocol)
Protocol: TCP | Usage: File upload/download.
Security Risk: Transmits credentials and data in cleartext. Replace with SFTP (Port 22) or FTPS (Port 990).
Port 22
SSH / SFTP
Protocol: TCP | Usage: Encrypted remote CLI administration.
Security Risk: Heavily targeted for brute-force attacks. Require SSH key authentication and disable root login.
Port 23
Telnet
Protocol: TCP | Usage: Unencrypted legacy remote CLI.
Security Risk: Transmits credentials in cleartext. High risk; disable globally in enterprise networks.
Port 25 / 587
SMTP / Secure SMTP
Protocol: TCP | Usage: Email transport routing.
Security Risk: Port 25 used for unencrypted mail flow; Port 587 uses TLS submission. Enforce SPF/DKIM/DMARC.
Port 53
DNS (Domain Name System)
Protocol: UDP/TCP | Usage: Hostname resolution.
Security Risk: Abused for DNS Tunneling C2 channels, DNS Poisoning, and Reflection DDoS attacks.
Port 80 / 443
HTTP / HTTPS
Protocol: TCP | Usage: Web browsing (443 = SSL/TLS Encrypted).
Security Risk: Web application attacks (OWASP Top 10), reverse proxying, and malicious payload egress.
Port 88
Kerberos Authentication
Protocol: TCP/UDP | Usage: Active Directory ticket authentication.
Security Risk: Target for Kerberoasting, AS-REP Roasting, and Golden Ticket persistence attacks.
Port 135
RPC Endpoint Mapper
Protocol: TCP | Usage: Windows Remote Procedure Call.
Security Risk: Used by attackers for internal network discovery and launching remote DCOM/WMI attacks.
Port 137–139
NetBIOS / NBNS
Protocol: UDP/TCP | Usage: Legacy Windows name resolution.
Security Risk: Abused by Responder tools for LLMNR/NBT-NS spoofing and credential hash harvesting. Disable NetBIOS.
Port 389 / 636
LDAP / LDAPS
Protocol: TCP | Usage: Active Directory queries (636 = TLS Encrypted).
Security Risk: Plain 389 transmits AD queries in cleartext. Enforce LDAPS channel binding on 636.
Port 445
SMB (Server Message Block)
Protocol: TCP | Usage: Windows file sharing & IPC.
Security Risk: Primary vector for worm/ransomware lateral movement (EternalBlue / WannaCry). Block at perimeter.
Port 1433 / 3306
MS SQL / MySQL Database
Protocol: TCP | Usage: Relational database access.
Security Risk: Target for direct database brute-force and SQL injection exfiltration. Restrict to local subnets.
Port 3389
RDP (Remote Desktop)
Protocol: TCP/UDP | Usage: Windows graphical remote management.
Security Risk: Never expose directly to the Internet. Enforce NLA, MFA, and VPN access gating.
☣️ Common Cyber Attacks & Threat Tactics
Kerberoasting
Active Directory Service Account Hash Theft
Mechanism & Mitigation:
  • An authenticated user requests a Kerberos TGS ticket for an account with a Service Principal Name (SPN). The ticket is encrypted with the service account's password hash. The attacker extracts the ticket from memory and cracks the password offline.
  • Mitigation: Use complex 25+ character passwords for service accounts, deploy Group Managed Service Accounts (gMSA), and monitor Event ID 4769 for RC4 ticket requests.
Pass-the-Hash (PtH)
Credential Theft via NTLM Hash Reuse
Mechanism & Mitigation:
  • The attacker extracts cached NTLM password hashes from a compromised machine's LSASS memory space (using Mimikatz) and presents the hash directly to authenticate to other domain hosts without needing the plaintext password.
  • Mitigation: Deploy Windows LAPS to randomize local admin passwords, enable Credential Guard, and restrict lateral network movement.
Ransomware & Extortion
Data Encryption and Exfiltration
Mechanism & Mitigation:
  • Malware gains execution, deletes Volume Shadow Copies (`vssadmin delete shadows`), encrypts local files and mapped network drives using strong symmetric keys, and exfiltrates data for double extortion.
  • Mitigation: Isolate infected hosts via EDR, enforce immutable air-gapped backups (3-2-1-1-0 rule), deploy Endpoint DLP, and enforce least privilege.
AiTM Phishing
Adversary-in-the-Middle MFA Bypass
Mechanism & Mitigation:
  • Attacker sets up a reverse proxy server (e.g. Evilginx) between the victim and legitimate login portal (M365). Intercepts user credentials and active OAuth session tokens post-MFA, allowing session hijacking.
  • Mitigation: Enforce Phishing-Resistant MFA (FIDO2 Hardware Security Keys / Certificate-based EAP-TLS) and conditional access device compliance.
SQL Injection (SQLi)
Web Application Database Exploitation
Mechanism & Mitigation:
  • Unsanitized input fields allow attackers to inject custom SQL commands (e.g., `' OR '1'='1`), bypassing web application authentication or extracting backend database tables.
  • Mitigation: Use Prepared Statements / Parameterized Queries, input sanitization, and deploy a Web Application Firewall (WAF).
ARP Poisoning / MitM
Layer 2 Local Traffic Interception
Mechanism & Mitigation:
  • Attacker sends spoofed ARP responses across the local network segment associating their MAC address with the Default Gateway IP, routing all subnet traffic through their machine.
  • Mitigation: Enable Dynamic ARP Inspection (DAI) and DHCP Snooping on managed network switches.
🔎 Critical Windows Security Event IDs for SOC Log Analysis
Event ID 4624
Successful User Logon
SOC Analysis Context:
  • Logs successful account authentication.
  • Key Fields: Logon Type (Type 2 = Interactive, Type 3 = Network, Type 10 = RDP), TargetUserName, WorkstationName, Source IP.
Event ID 4625
Failed User Logon Attempt
SOC Analysis Context:
  • Primary indicator for Brute Force or Password Spraying attacks.
  • Sub-Status Codes: 0xC000006A (Wrong Password), 0xC0000234 (Account Locked), 0xC0000064 (Non-existent Username).
Event ID 4720
A User Account Was Created
SOC Analysis Context:
  • Alerts on potential backdoor account creation by an attacker seeking persistence.
  • Verify whether account creation was backed by an approved HR/IT onboarding ticket.
Event ID 4740
User Account Locked Out
SOC Analysis Context:
  • Triggers when an account hits the bad password threshold limit.
  • Use LockoutStatus.exe or PDC logs to trace the caller computer name sending old cached credentials.
Event ID 1102
Audit Log Was Cleared
SOC Analysis Context:
  • High Severity Alert: Attackers often clear Windows Security event logs (`wevtutil cl security`) to cover their anti-forensic footprints.
Event ID 7045
A Service Was Installed in the System
SOC Analysis Context:
  • Monitors new Windows background service installations.
  • Frequently triggered by PsExec, Cobalt Strike beacons, or persistence rootkits (`ImagePath` attribute analysis).
Essential KQL Queries (Microsoft Sentinel & Defender XDR)
KQL - Failed Logons
Detect Brute Force / Password Spray Spikes
Query Syntax:
SecurityEvent
| where TimeGenerated > ago(24h)
| where EventID == 4625
| summarize FailedCount = count() by TargetUserName, IpAddress
| where FailedCount > 10
| sort by FailedCount desc
KQL - Encoded Script
Detect Obfuscated PowerShell Execution
Query Syntax:
DeviceProcessEvents
| where TimeGenerated > ago(7d)
| where FileName in~ ("powershell.exe", "pwsh.exe")
| where ProcessCommandLine has_any ("-enc", "-encodedcommand", "bypass", "nop")
| project TimeGenerated, DeviceName, AccountName, ProcessCommandLine, ParentProcessFileName
KQL - LSASS Dumping
Detect Credential Theft Attempts
Query Syntax:
DeviceProcessEvents
| where TimeGenerated > ago(7d)
| where ProcessCommandLine has_any ("lsass", "procdump", "comsvcs.dll", "rundll32")
| project TimeGenerated, DeviceName, AccountName, ProcessCommandLine, InitiatingProcessFileName
📜 Core Incident Response & Threat Frameworks
NIST SP 800-61
6 Phases of Incident Response
Lifecycle Steps:
  1. Preparation: Hardening systems, defining playbooks, training IR team.
  2. Detection & Analysis: Alert triage, parsing logs, verifying scope.
  3. Containment: Isolating hosts (EDR isolation) and disabling compromised accounts.
  4. Eradication: Removing malware binaries, wiping backdoors, patching root vulnerabilities.
  5. Recovery: Safe restoration of systems to production from clean backups.
  6. Post-Incident Activity: Documenting lessons learned and updating detection rules.
MITRE ATT&CK
Adversary Tactics & Techniques Matrix
Core Attack Tactics:
  • Reconnaissance → Resource Development → Initial Access → Execution → Persistence → Privilege Escalation → Defense Evasion → Credential Access → Discovery → Lateral Movement → Collection → Command and Control (C2) → Exfiltration → Impact.