avatar

Sergio Albea

@Sergio_Albea
Trusted contributorCompletionist
15 followers237 downloads2,277 copies102 likes17,550 views

75 detections

This KQL is focus on gather statistics related to hackers activities over our tenants, such as the number of emails sent tagged as threats. Below, I’ve provided KQL queries to help identify the risky ASNs mentioned at the beggining.
You can adjust the filtering criteria by modifying the line: “| where SuspiciousPercentage > 95 and Total_different_IPs > 10” based on your specific requirements.
avatar
Sergio Albea@Sergio_Albea
avatar
01 | 🇨🇭 Swiss Cyber Hunters
1 year ago
70137
When two accounts from the same Entra tenant are signed into the same browser app, the device authentication (the PRT) belonging to the primary account is implicitly applied to the second account. That means the second account can inherit device-based Conditional Access, effectively bypassing intended device checks and weakening protection for privileged accounts.
Based on this behavior, I created a KQL query that detects any account assigned a privileged role signing in with private/incognito browser sessions on a device where potentially another account is already signed in — a pattern that helps to detect the mentioned PRT/device-trust bypass. Even lower-privileged accounts are concerning when they browse in private mode so I am not filtering by just admin ones. However, to target specific roles, add:
| 𝘸𝘩𝘦𝘳𝘦 𝘵𝘰𝘴𝘵𝘳𝘪𝘯𝘨(𝘈𝘴𝘴𝘪𝘨𝘯𝘦𝘥𝘙𝘰𝘭𝘦𝘴) 𝘤𝘰𝘯𝘵𝘢𝘪𝘯𝘴 "𝘢𝘥𝘮𝘪𝘯"
avatar
Sergio Albea@Sergio_Albea
avatar
01 | 🇨🇭 Swiss Cyber Hunters
1 year ago
419644
This query groups all files by their originating file—such as a ZIP archive or from a Website—and includes all the files that were extracted from it. Among the benefits of Correlating File Events Using InitiatingProcessUniqueId field we can identify:

- Provides full visibility into all files related to a single action (e.g., ZIP extraction).
- Helps detect hidden or secondary malicious files that may not trigger alerts.
- Traces the origin of files—whether downloaded or extracted from another source.
- Strengthens root cause analysis and incident investigation.
- Enhances detection of multi-stage payloads or complex delivery methods.
- Builds context around suspicious activity for better decision-making.

On the other hand, we can enhance this detection by adding additional checks — for example, identifying when one of the extracted or downloaded files has a high-risk file extension.
| where FileExtension in ("exe","cmd","bat","ps1","js","vbs")
avatar
Sergio Albea@Sergio_Albea
avatar
01 | 🇨🇭 Swiss Cyber Hunters
1 year ago
175343
NetworkSignatureInspected just means the network sensor saw and matched a signature (it inspected the packet) — it doesn’t mean the flow was blocked. That’s the problem.
If your machines are negotiating SMB or NTLM with unknown remote IPs, you’ve got a real risk on your hands: data leakage, credential relay, or worm-style propagation. SMB to the Internet is almost never legitimate; if you don’t recognize the remote IP, treat it as suspicious.

The KQL query includes multiple conditions to detect not only default connections on legacy (139) or modern (445) SMB ports, but also cases where SMB is running over non-standard ports (attempts to evade simple port-based detection). It also extracts the SMB negotiation state so you can spot repeated or incomplete negotiation attempts (useful to detect scanning, failed auths, or relay attempts).
avatar
Sergio Albea@Sergio_Albea
avatar
01 | 🇨🇭 Swiss Cyber Hunters
1 year ago
243451
In this case, I have been researching about the 'curve' value into AdditionalFields field of DeviceNetworkEvents table which I identified into iana.org as two groups 'Elliptic curve' and 'Diffie-Hellman groups'.

These 2 kinds of encryption groups work to secure communication over an insecure channel, are classified by Internet Assigned Numbers Authority (IANA), as if are 'recommended' and the Datagram Transport Layer Security status. In addition, to take into account, the mentioned site mention: "If an item is not marked as 'Recommended', it does not necessarily mean that it is flawed; rather, it indicates that the item either has not been through the IETF consensus process, has limited applicability, or is intended only for specific use cases"

Therefore, this KQL Query is oriented to identify if the current encryption to secure your communications is enough or if due to the level of sensitive of your information, would need to be reviewed.
avatar
Sergio Albea@Sergio_Albea
avatar
01 | 🇨🇭 Swiss Cyber Hunters
1 year ago
130207
This query is using the DeviceNetworkEvents table to filter by connections where there are encryption algorithms used. Then, I take a list of the encryption algorithms database from the well-known site iana.org which is an entity that monitors the global allocation of IP addresses, autonomous systems, DNS domain name root servers and other Internet Protocol resources. Finally, It list cases where there are multiple connections established using non-recommended or non-valid datagram transport layer security (DTLS), which could mean that our users are not protected against eavesdropping, tampering or message forgery.
avatar
Sergio Albea@Sergio_Albea
avatar
01 | 🇨🇭 Swiss Cyber Hunters
1 year ago
41117
This query identifies Azure AD sign-ins that are using legacy TLS versions (below TLS 1.2). It highlights the accounts, devices, and applications involved, providing visibility into insecure protocol usage. Tracking these events helps detect weak encryption risks and enables proactive remediation to enforce modern, secure standards.
avatar
Sergio Albea@Sergio_Albea
avatar
01 | 🇨🇭 Swiss Cyber Hunters
1 year ago
110140
This query helps you quickly see the number of affected devices or get a detailed list of machines still running versions that are approaching end of support:

Windows 10 & 11 version 22H2 → end of support on October 14, 2025
Windows 11 version 23H2 (Home & Pro) → end of support on November 11, 2025
avatar
Sergio Albea@Sergio_Albea
avatar
01 | 🇨🇭 Swiss Cyber Hunters
1 year ago
6285
New KSMBD DoS (CVE-2025-38501) can exhaust SMB connections via half-open TCP handshakes — patch to Linux 6.1.15+ or rate-limit TCP/445 to mitigate.
This KQL query helps to hunt for connection attempts to port 445 across Linux endpoints in Defender XDR:
avatar
Sergio Albea@Sergio_Albea
avatar
01 | 🇨🇭 Swiss Cyber Hunters
1 year ago
6054
Time to live (TTL) values in DNS responses provide valuable threat-hunting insights, including:

- Fast-flux botnets (rotating IPs with low TTLs).
- Malware C2 detection (extremely low TTLs). ( | where TTLs < 10 )
- DNS tunneling (high TTLs or changing TTLs). ( | where TTLs > 86400 )
- Fake domains mimicking real services (TTL anomalies).
- Evasive infrastructure constantly changing TTL values.

You can use the following KQL Query to search for the mentioned cases.
avatar
Sergio Albea@Sergio_Albea
avatar
01 | 🇨🇭 Swiss Cyber Hunters
1 year ago
130123
Page 6 of 8