<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Bishal Chapagain</title>
    <description>The latest articles on DEV Community by Bishal Chapagain (@bishal_cpgn).</description>
    <link>https://dev.to/bishal_cpgn</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1830409%2F2676cffb-7f9e-4f90-82dc-165984748578.jpg</url>
      <title>DEV Community: Bishal Chapagain</title>
      <link>https://dev.to/bishal_cpgn</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/bishal_cpgn"/>
    <language>en</language>
    <item>
      <title>ENABLE EBS ENCRYPTION BY DEFAULT IN 30 SECONDS</title>
      <dc:creator>Bishal Chapagain</dc:creator>
      <pubDate>Fri, 21 Nov 2025 08:09:01 +0000</pubDate>
      <link>https://dev.to/aws-builders/enable-ebs-encryption-by-default-in-30-seconds-2125</link>
      <guid>https://dev.to/aws-builders/enable-ebs-encryption-by-default-in-30-seconds-2125</guid>
      <description>&lt;h3&gt;
  
  
  The One Security Setting Every AWS Account Needs
&lt;/h3&gt;

&lt;p&gt;We have all been there. You are in a rush to launch an EC2 instance. You click through the configuration screens, hit "Launch," and then realize... you forgot to tick the "Encrypt" box for the storage volume.&lt;/p&gt;

&lt;p&gt;In the world of cloud security, human error is the biggest risk. But what if you could "future-proof" your account so that you never have to remember to click that button again?&lt;/p&gt;

&lt;p&gt;There is a setting in AWS that takes literally 30 seconds to turn on, costs nothing extra to enable, and ensures that every single new hard drive (EBS volume) you create is encrypted automatically. Here is how to turn it on, why it matters, and the few things you need to know.&lt;br&gt;
Why should you care?&lt;/p&gt;

&lt;p&gt;Think of EBS Encryption by Default as automatically locking your front door every time you close it.&lt;/p&gt;

&lt;p&gt;Peace of Mind: You don’t need to rely on your team remembering to encrypt data. AWS enforces it for you.&lt;/p&gt;

&lt;p&gt;Compliance: If you are handling sensitive data (GDPR, HIPAA, etc.), encryption at rest is usually mandatory.&lt;/p&gt;
&lt;h3&gt;
  
  
  How to Enable it (The 30-Second Guide)
&lt;/h3&gt;

&lt;p&gt;If you are familiar with AWS CLI, use the following command and it's done.&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;aws ec2 get-ebs-encryption-by-default --region &amp;lt;region&amp;gt;&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;Else, you don’t need to be a coding wizard to do this. Just follow these steps in the AWS Console.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Pick your Region&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Log into your AWS Console.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Select your region from the top right corner.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;Crucial: This setting is Region-Specific. If you work in both us-east-1 (N. Virginia) and ap-south-1 (Mumbai), you need to do this in both places.&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Navigate to the EC2 service.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Find the Settings&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Look at the navigation pane on the left side. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Scroll all the way down to the bottom and click on Settings &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8kwx91zkpzb0wxrhw73o.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8kwx91zkpzb0wxrhw73o.png" alt="AWS EC2 Settings" width="800" height="349"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click on the Data Protection and Security tab.&lt;/li&gt;
&lt;li&gt;You will see a section called EBS Encryption.&lt;/li&gt;
&lt;li&gt;Click Manage.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0qfk1ocw2nweu8hg7vr7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0qfk1ocw2nweu8hg7vr7.png" alt="EBS Encryption By Default" width="800" height="347"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Check the Enable box.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnei21h2ozbiqezpcr8sq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnei21h2ozbiqezpcr8sq.png" alt="EBS Encryption By Default" width="800" height="347"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Key Selection: You can leave it as the default (aws/ebs)  or pick a Customer Managed Key (CMK) if you plan to share snapshots later.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;Note: While the default key is free, AWS charges approx. $1/month to maintain a Customer Managed Key.&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click Update EBS encryption.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Done. That’s it. You are now secure by default.&lt;/p&gt;

&lt;h3&gt;
  
  
  Things to Consider Before You Switch It On
&lt;/h3&gt;

&lt;p&gt;While this setting is fantastic for security, there are a few details you should know so you aren't surprised later.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. It doesn’t fix the past&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Turning this on acts like a fresh start. It encrypts every new volume you create from this moment forward. However, for your old volumes, you can’t simply turn on encryption for drives that already exist. You have to create a snapshot and copy it to a new drive to secure them.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. It is Region-Specific&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;AWS settings often apply to just one specific location (Region). If you enable this in N. Virginia, it does not automatically turn on in Mumbai or Sydney. You need to repeat this process for every Region where you have servers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Be careful with "Key Selection"&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Default Key: It is totally free and auto rotated every year but you cannot share snapshots encrypted with this key to other AWS accounts.&lt;/p&gt;

&lt;p&gt;Customer Managed Key (CMK): If you plan to share disk images with a client or a different production account later, you must create and use your own Customer Managed Key. AWS charges for using CMK and you are responsible for rotating it.  &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. It is "All or Nothing"&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Once you enable this for a Region, it applies to everything you create in that Region. You cannot disable encryption for just one specific volume later. This is actually a good thing; it prevents accidental loopholes in your security.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. A note on storage costs&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you decide to clean up your old data by copying unencrypted snapshots to make them encrypted, be aware that AWS creates a full copy, not a partial one. This means you will be storing more data, which might result in a small increase in your storage bill.&lt;/p&gt;

&lt;h3&gt;
  
  
  Final Thoughts
&lt;/h3&gt;

&lt;p&gt;Security doesn't always have to be hard. By enabling EBS Encryption by Default, you are removing the chance of human error and ensuring that your data remains locked tight, no matter who launches the instance.&lt;/p&gt;

&lt;p&gt;Go do it now,it will take less time than finishing your coffee!&lt;/p&gt;

&lt;p&gt;For more technical details or CLI commands, you can check the official &lt;a href="https://docs.aws.amazon.com/ebs/latest/userguide/encryption-by-default.html" rel="noopener noreferrer"&gt;AWS Documentation&lt;/a&gt;. &lt;/p&gt;

</description>
      <category>aws</category>
      <category>cloud</category>
      <category>security</category>
      <category>devops</category>
    </item>
    <item>
      <title>AWS Support: "We're here to help"</title>
      <dc:creator>Bishal Chapagain</dc:creator>
      <pubDate>Sat, 19 Jul 2025 04:46:47 +0000</pubDate>
      <link>https://dev.to/bishal_cpgn/aws-support-were-here-to-help-2dhp</link>
      <guid>https://dev.to/bishal_cpgn/aws-support-were-here-to-help-2dhp</guid>
      <description>&lt;p&gt;They said they’re “here to help.”&lt;/p&gt;

&lt;p&gt;They meant help me cry more. &lt;/p&gt;

</description>
      <category>aws</category>
      <category>humor</category>
      <category>awssupport</category>
      <category>troubleshoot</category>
    </item>
    <item>
      <title>From Container to Root</title>
      <dc:creator>Bishal Chapagain</dc:creator>
      <pubDate>Fri, 25 Apr 2025 17:18:04 +0000</pubDate>
      <link>https://dev.to/bishal_cpgn/privilege-escalation-using-docker-container-4h7</link>
      <guid>https://dev.to/bishal_cpgn/privilege-escalation-using-docker-container-4h7</guid>
      <description>&lt;h4&gt;
  
  
  Background 
&lt;/h4&gt;

&lt;p&gt;In many companies, employees are often provided with limited user privileges. These accounts often lack &lt;code&gt;sudo&lt;/code&gt; or &lt;code&gt;root&lt;/code&gt; privileges, preventing direct access to install packages or make system-wide changes. But what if you could break through these restrictions with a Docker container? &lt;/p&gt;

&lt;p&gt;In this article, I’ll show you how I got root access onto the host all from within a container.&lt;/p&gt;

&lt;h4&gt;
  
  
  About Docker
&lt;/h4&gt;

&lt;p&gt;Docker makes extensive use of &lt;em&gt;cgroups&lt;/em&gt; and &lt;em&gt;namespaces&lt;/em&gt; to provide containerization. These are core Linux kernel features that enable Docker to isolate and manage resources for containers effectively. Even with &lt;code&gt;root&lt;/code&gt; inside a container, you can't affect the host system unless you explicitly allow it. Docker containers are isolated environments that share the host kernel but are otherwise sandboxed.&lt;/p&gt;

&lt;p&gt;By running containers in &lt;code&gt;--privileged&lt;/code&gt; mode and mounting the host filesystem, we effectively give the container god-mode access to the host. This is what we exploit in this method. &lt;/p&gt;

&lt;p&gt;This method is tested on &lt;em&gt;Ubuntu 24.04.2 LTS&lt;/em&gt; with &lt;em&gt;Docker&lt;/em&gt; installed on it. &lt;/p&gt;

&lt;h4&gt;
  
  
  Disclaimer: 
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;This method is dangerous as it breaks the isolation model of Docker. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;One wrong move and you can corrupt your host system. &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Steps
&lt;/h3&gt;

&lt;p&gt;1. Run a Docker Container&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;First, run a privileged Ubuntu container with the host root directory mounted on it. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fea628a14ocea2cnq85df.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fea628a14ocea2cnq85df.png" alt="docker-container-with-host-root-volume" width="800" height="108"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker run -it --rm --privileged -v /:/mnt/host ubuntu:latest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Once inside the container, you can check the contents of the host root directory. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwadvdirmklwq88d90npe.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwadvdirmklwq88d90npe.png" alt="check-contents-of-directory-ls" width="800" height="157"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ls /mnt/host
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt; 2. &lt;code&gt;chroot&lt;/code&gt; into the host system &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The chroot command changes the apparent root directory for the current process and its children. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The directory &lt;code&gt;/mnt/host&lt;/code&gt; becomes the new root for the processes. Thus, host files and directories can be accessed with an isolated bash shell.&lt;br&gt;
&lt;br&gt;
 &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;chroot /mnt/host /bin/bash
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3t7hqtnia4w1zy296wmo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3t7hqtnia4w1zy296wmo.png" alt="chroot" width="800" height="112"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, we’re in the host environment and can install packages or make other modifications as if we were logged in directly.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If it fails, check for missing binaries or libraries using strace.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;strace -f chroot /mnt/host /bin/bash
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;3. Install packages &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;For this demo, let’s install python3. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy3mjf2wxuy7yuzgjllue.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy3mjf2wxuy7yuzgjllue.png" alt="install-pyhton3-in-ubuntu" width="800" height="192"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;4. Test it from your end&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;We can see a running Ubuntu container using &lt;code&gt;docker ps&lt;/code&gt; command in the new terminal. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;On testing, python3 has been successfully installed on our system. &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fitiqv1vp4wfs95k8ck2n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fitiqv1vp4wfs95k8ck2n.png" alt="check-python-version" width="800" height="192"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;5. Fixing DNS Issues&lt;/p&gt;

&lt;p&gt;If you face any DNS issues inside the container, you can resolve this by manually setting the DNS.&lt;br&gt;
&lt;br&gt;
 &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;echo "nameserver 8.8.8.8" &amp;gt; /etc/resolv.conf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  How to prevent it? 
&lt;/h3&gt;

&lt;p&gt;When an employee gains unauthorized root access to a company's end device, the impacts can be severe, affecting security, operations and compliance. &lt;/p&gt;

&lt;p&gt;The following ways can be considered for prevention : &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Use Rootless mode&lt;br&gt;&lt;br&gt;
This is the safest way to run containers without risking the host system’s security as both Docker daemon and containers runs in rootless mode. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Leverage SELinux/AppArmor&lt;br&gt;&lt;br&gt;
Mandatory Access Control via SELinux or AppArmor prevents containers from accessing host paths, even if privileged.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Final Thoughts
&lt;/h3&gt;

&lt;p&gt;This method granted me the freedom to act as root on a machine where I didn’t have direct access. However, never test this on critical systems. &lt;/p&gt;

&lt;p&gt;Happy hacking!&lt;/p&gt;

</description>
      <category>docker</category>
      <category>cybersecurity</category>
      <category>linux</category>
      <category>containers</category>
    </item>
  </channel>
</rss>
