Detect_engg_SOC.pptx
Detect_engg_SOC.pptx
“Everything Published, Talked and/or discussed in this conference is solely based on my personal point of view,
and does not represent my current, or past employers.”
Next 40 Mins !
• SOC Detection concept
• Detection Logic in WAF/ IDS
Workflow
HTTP Header – L7 data fields
Regular expressions
Example
• Q&A
SOC Detections Concept
IDS and WAF Workflow example
Stage 1: Parse HTTP(s) packet from client
(HTTP Request and response logs)
Most user-facing protocols and applications like HTTP, FTP and SMTP operate on layer 7.
HTTP Related Fields Files related Email Related TCP/UDP DOS related
http-req-cookie file-data pop3-req-protocol-payload tcp-context-free
http-req-headers file-elf-body pop3-rsp-protocol-payload udp-context-free
http-req-message-body file-flv-body imap-req-cmd-line
http-req-host-ipv4-address-found file-html-body imap-req-first-param unknown-req-tcp-payload
http-req-host-ipv6-address-found file-java-body imap-req-params-after-first-param unknown-rsp-tcp-payload
http-req-host-header file-mov-body imap-req-protocol-payload
http-req-mime-form-data file-office-content imap-rsp-protocol-payload unknown-req-udp-payload
http-req-ms-subdomain file-pdf-body email-headers unknown-rsp-udp-payload
http-req-origin-headers file-riff-body
http-req-params file-swf-body
http-req-uri file-tiff-body
http-req-uri-path file-unknown-body
http-req-user-agent-header ftp-req-params
http-rsp-headers ftp-req-protocol-payload
http-rsp-non-2xx-r ftp-rsp-protocol-payload
http-rsp-reason ftp-rsp-banner
http-req-method ftp-rsp-message
Not limited to these fields, there will be a greater number of fields available in the IDS/WAF
and Number of different ideologies (scoring etc) will be used by different vendors.
Regular expression…
…..is a sequence of characters that define a search pattern
- IDS and WAF will be using Regex for detection logic (the signatures/Rules/patterns are written)
- Easily understandable– Human friendly to read.
- Simply “string defined of different syntax and wildcards” which helps in finding sub-string in source text.
• Case in-sensitive
• Search of Open bracket script
• Anything after the string
Most of the Regex in IDS/WAF are written for Signature set of Injections like SQLi, LDAP, Header, Code, OS command and XSS -Cross site
Scripting (Nucli scan) etc.
Attacker are able to find potential ways to Bypass IDS/WAF , these are Bug or "weak places" in regular expressions:
https://github.com/attackercan/regexp-security-cheatsheet and https://www.slideshare.net/slideshow/lie-tomephd2013/21958607#35
- ReDos – rule set bypassing
- HTTP Parameter Pollution
- Double URL Encoded
Mitigation: Precompile regex patterns where possible to improve performance
Use of DAT (Dynamic analysis Tool) for regex checking and fuzzing with created regex patterns which will help in checking of Input
validation, limitation , Regex timeout, Resource limits
Ex: https://redosdetector.com/
How can these be used in our Environment:
- Understanding what to detect?
• select an adversarial technique to detect –Planning
• Proof of concept
• Research the underlying technology – Hypothesis creation
POC: https://www.trendmicro.com/ja_jp/devops/22/a/detect-log4j-vulnerabilities.html
Data collections:
- Type of Data collected?
- Where is it stored?
- Is it ingested to SIEM, EDR or not?
- Prioritizing data sources based on
expenses.
- Gap analysis on Data sources and
ingested data.
MITRE Framework
• MITRE attack will be overwhelming –
navigator : https://mitre-attack.github.io/attack-navigator/
• We need to scope the attack vectors as below:
Basically Filtering based on requirement:
- Filter Platform in layer controls (Linux, win, mac, etc.)
- Then starts look for particular things under selection controls
threat group, data sources
- Select unannotated ( technique/task not applicable) and
- Then toggle the state and hide (eyeball) the rest.
adversaries leverage Scripts
OS Binaries are local to their OS, but these binaries have been utilized and exploited by cyber criminals and crime
groups to camouflage their malicious activity.
1. Windows OS Built in Binaries - Living Off The Land Binaries (LOLBAS Binaries and Scripts) –
https://lolbas-project.github.io/api/lolbas.csv
• This file contains every LOLBAS entry in a single file, broken down by LOLBAS file and command
• LOLBAS are often Microsoft signed binaries
• They can be used for a range of attacks, including executing code, to performing file operations (downloading, uploading, copying, etc).
2. Mac OS Built in Binaries - Living Off the Orchard - https://www.loobins.io/binaries/ LOOBins is a Python SDK
and command-line utility for programmatically interact - https://www.loobins.io/docs/api/pyloobins/
1. Unix OS Built in Binaries - GTFOBins is a curated list of Unix binaries that can be used to bypass local security
restrictions in misconfigured systems https://gtfobins.github.io/ https://github.com/GTFOBins
Condition 1:
((CommandLine contains “powershell.exe –exec” AND CommandLine contains “bypass)
AND
(CommandLine contains “IEX (” OR CommandLine contains “Invoke-Expression”)
AND
CommandLine contains “.DownloadString”
AND
CommandLine contains “\b[a-zA-Z0-9-]+\. [a-zA-Z]{2,}\b”
AND
reffererURL contains “\b[a-zA-Z0-9-]+\. [a-zA-Z]{2,}\b”)
- There can be number of other tuning need to performed based on from which process the command is executed (parent
process) and is the parent is legitimate or unknown in string etc.
Processing Directions:
Step 2: