<?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: JacivaldoCarvalho</title>
    <description>The latest articles on DEV Community by JacivaldoCarvalho (@jacivaldocarvalho).</description>
    <link>https://dev.to/jacivaldocarvalho</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4201512%2F77b15e91-6f5c-4787-b0f8-b445e7d253cd.jpg</url>
      <title>DEV Community: JacivaldoCarvalho</title>
      <link>https://dev.to/jacivaldocarvalho</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jacivaldocarvalho"/>
    <language>en</language>
    <item>
      <title>PHP2Shell: When the Vulnerability Is in the Runtime, Not Just the Application</title>
      <dc:creator>JacivaldoCarvalho</dc:creator>
      <pubDate>Fri, 23 Oct 2026 21:16:00 +0000</pubDate>
      <link>https://dev.to/jacivaldocarvalho/php2shell-when-the-vulnerability-is-in-the-runtime-not-just-the-application-4h7p</link>
      <guid>https://dev.to/jacivaldocarvalho/php2shell-when-the-vulnerability-is-in-the-runtime-not-just-the-application-4h7p</guid>
      <description>&lt;p&gt;&lt;strong&gt;What two critical PHP vulnerabilities teach us about SBOMs, containers, DevSecOps, and automated security patching.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In application security, we often focus our efforts on source code analysis, dependency management, and API protection.&lt;/p&gt;

&lt;p&gt;But what happens when the vulnerability exists in the runtime responsible for executing the application itself?&lt;/p&gt;

&lt;p&gt;On October 21, 2026, the PHP project released emergency security updates addressing two critical vulnerabilities, identified as &lt;strong&gt;CVE-2026-109618 and CVE-2026-109619&lt;/strong&gt;, collectively known as &lt;strong&gt;PHP2Shell&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Both received a CVSS v4.0 score of 9.2 and may allow unauthenticated remote code execution (RCE), depending on the conditions required for exploitation.&lt;/p&gt;

&lt;p&gt;This incident highlights an important security challenge: &lt;strong&gt;an application can have secure code and still be vulnerable because of the infrastructure running it.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  1. The Technical Problem: Vulnerabilities in the PHP Core
&lt;/h2&gt;

&lt;p&gt;Unlike common vulnerabilities found in frameworks, libraries, or plugins, PHP2Shell involves internal mechanisms responsible for processing HTTP requests.&lt;/p&gt;

&lt;p&gt;The two vulnerabilities have distinct characteristics:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;CVE-2026-109618 — Memory corruption during allocation failure handling.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Under certain out-of-memory conditions, PHP may interrupt request processing without properly restoring its internal state. Subsequent cleanup operations may then access uninitialized memory structures.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;CVE-2026-109619 — Reuse of invalid global state.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The runtime may retain references to memory regions associated with previous requests. When this state is not properly reinitialized, subsequent requests may access memory that has already been freed.&lt;/p&gt;

&lt;p&gt;Potential consequences include remote code execution, sensitive information disclosure, and service disruption.&lt;/p&gt;

&lt;p&gt;The risk is not limited to a specific application.&lt;/p&gt;

&lt;p&gt;Environments using PHP-FPM, Apache with mod_php, php-cgi, FrankenPHP, or LiteSpeed may be exposed, depending on their versions and configurations.&lt;/p&gt;

&lt;p&gt;This means that fixing application code alone does not eliminate the vulnerability.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Why Updating Dependencies Is Not Enough
&lt;/h2&gt;

&lt;p&gt;Consider an API developed with Laravel and deployed inside a Docker container.&lt;/p&gt;

&lt;p&gt;The development team uses static analysis, automated testing, dependency scanning, and CI/CD pipelines.&lt;/p&gt;

&lt;p&gt;Even with these practices in place, the base container image may still contain a vulnerable PHP version.&lt;/p&gt;

&lt;p&gt;The execution stack extends far beyond application code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PHP / Laravel Application
        |
Composer Dependencies
        |
PHP Runtime
        |
System Libraries
        |
Container Base Image
        |
Operating System / Host
        |
Cloud Infrastructure
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A vulnerability in any of these layers can compromise the security of the service.&lt;/p&gt;

&lt;p&gt;For this reason, security must cover the entire execution environment.&lt;/p&gt;

&lt;p&gt;This is where &lt;strong&gt;Software Supply Chain Security&lt;/strong&gt; becomes essential.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. SBOM: Understanding Your Components Before Applying Fixes
&lt;/h2&gt;

&lt;p&gt;A Software Bill of Materials (SBOM) is a structured inventory of the software components used in an application.&lt;/p&gt;

&lt;p&gt;It can document packages, libraries, versions, and component identification information.&lt;/p&gt;

&lt;p&gt;When a critical vulnerability is disclosed, the operational question is no longer simply:&lt;/p&gt;

&lt;p&gt;"Which applications use PHP?"&lt;/p&gt;

&lt;p&gt;Instead, it becomes:&lt;/p&gt;

&lt;p&gt;"Which applications, containers, and servers are running vulnerable PHP versions, which are exposed to the internet, and which services depend on them?"&lt;/p&gt;

&lt;p&gt;Tools such as Syft, Trivy, and Grype help automate this process.&lt;/p&gt;

&lt;p&gt;A defensive example using Syft:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;syft my-api:latest &lt;span class="nt"&gt;-o&lt;/span&gt; cyclonedx-json &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; sbom.json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command generates an inventory of the components identified in the container image.&lt;/p&gt;

&lt;p&gt;Next, we can perform a vulnerability scan:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;trivy image my-api:latest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These checks help identify potentially affected components, but they do not replace validation against official vendor security advisories.&lt;/p&gt;

&lt;p&gt;It is also important to remember that Linux distributions may apply security fixes through &lt;em&gt;backporting&lt;/em&gt;, preserving version numbers that may still appear outdated.&lt;/p&gt;

&lt;p&gt;Therefore, vulnerability assessments must consider both the origin of the packages and their actual patch status.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Containers Do Not Eliminate Runtime Vulnerabilities
&lt;/h2&gt;

&lt;p&gt;A common misconception is that using Docker automatically makes an application secure.&lt;/p&gt;

&lt;p&gt;Containers provide isolation mechanisms, but they do not fix vulnerabilities in the components running inside them.&lt;/p&gt;

&lt;p&gt;If an image contains a vulnerable runtime, creating new containers from that image simply reproduces the problem.&lt;/p&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fayvd1gy0x9gfmjmxdkyw.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fayvd1gy0x9gfmjmxdkyw.png" alt="Figure 1: Multiple containers created from the same vulnerable image inherit the affected PHP runtime. Container isolation does not fix vulnerabilities in the underlying software components." width="800" height="548"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Figure 1: Multiple containers created from the same vulnerable image inherit the affected PHP runtime. Container isolation does not fix vulnerabilities in the underlying software components.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;For PHP2Shell, the PHP project released the following patched versions:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;PHP Branch&lt;/th&gt;
&lt;th&gt;Patched Version&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;PHP 8.2&lt;/td&gt;
&lt;td&gt;8.2.35&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;PHP 8.3&lt;/td&gt;
&lt;td&gt;8.3.36&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;PHP 8.4&lt;/td&gt;
&lt;td&gt;8.4.27&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;PHP 8.5&lt;/td&gt;
&lt;td&gt;8.5.12&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Older, unsupported versions require additional attention, migration, or security patches maintained by specific vendors.&lt;/p&gt;

&lt;p&gt;One defensive approach is to update the base image to a patched runtime version:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;&lt;span class="k"&gt;FROM&lt;/span&gt;&lt;span class="s"&gt; php:8.4.27-fpm&lt;/span&gt;

&lt;span class="k"&gt;WORKDIR&lt;/span&gt;&lt;span class="s"&gt; /var/www/html&lt;/span&gt;

&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; . .&lt;/span&gt;

&lt;span class="k"&gt;CMD&lt;/span&gt;&lt;span class="s"&gt; ["php-fpm"]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This example illustrates a runtime update but is not intended to represent a complete production-ready Dockerfile.&lt;/p&gt;

&lt;p&gt;After updating the runtime, the image must be rebuilt, tested, and deployed to replace existing containers.&lt;/p&gt;

&lt;p&gt;A basic workflow could look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker build &lt;span class="nt"&gt;--pull&lt;/span&gt; &lt;span class="nt"&gt;--no-cache&lt;/span&gt; &lt;span class="nt"&gt;-t&lt;/span&gt; my-api:patched &lt;span class="nb"&gt;.&lt;/span&gt;
docker run &lt;span class="nt"&gt;--rm&lt;/span&gt; my-api:patched php &lt;span class="nt"&gt;-v&lt;/span&gt;
trivy image my-api:patched
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In production environments, verified images should be used, preferably pinned by digest. The exact artifact validated during testing should then be promoted to production.&lt;/p&gt;

&lt;p&gt;In Kubernetes, the process also requires verifying that Pods are actually running the updated image.&lt;/p&gt;

&lt;p&gt;Updating an image in the container registry without replacing running workloads does not guarantee that the vulnerability has been eliminated.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. DevSecOps: Turning Security Patching into an Automated Process
&lt;/h2&gt;

&lt;p&gt;Incidents such as PHP2Shell demonstrate that response speed is an essential part of operational security.&lt;/p&gt;

&lt;p&gt;A DevSecOps strategy can organize the remediation process into a structured workflow:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Inventory → Detection → Prioritization → Remediation → Validation → Monitoring&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Within a CI/CD pipeline, these activities can be automated.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Git Repository
      |
CI Pipeline
      |
Container Image Build
      |
SBOM Generation
      |
Vulnerability Scanning
      |
Automated Testing
      |
Security Policies
      |
Container Registry
      |
Controlled Deployment
      |
Observability
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A security policy may prevent images containing known critical vulnerabilities from being promoted, while considering exposure criteria, approved exceptions, and patch availability.&lt;/p&gt;

&lt;p&gt;Automation can also create dependency update requests and execute regression tests.&lt;/p&gt;

&lt;p&gt;However, &lt;strong&gt;automated remediation should not mean uncontrolled deployment&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Runtime updates may introduce compatibility issues.&lt;/p&gt;

&lt;p&gt;For this reason, security pipelines should include functional validation, health checks, progressive deployments, and rollback strategies.&lt;/p&gt;

&lt;p&gt;The goal is to reduce the exposure window without compromising service availability.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. A WAF Is a Protection Layer, Not a Permanent Fix
&lt;/h2&gt;

&lt;p&gt;During the PHP2Shell disclosure, vendors such as Cloudflare and AWS published guidance and protective measures to reduce exposure to exploitation attempts.&lt;/p&gt;

&lt;p&gt;These measures are particularly valuable when updating every affected system requires additional time.&lt;/p&gt;

&lt;p&gt;However, the PHP project made it clear that no complete mitigation can replace patching the vulnerable runtime.&lt;/p&gt;

&lt;p&gt;This distinction is essential:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Web Application Firewall (WAF):&lt;/strong&gt; Helps block potentially malicious traffic patterns.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Security patching:&lt;/strong&gt; Fixes the vulnerability in the affected component.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Observability:&lt;/strong&gt; Enables monitoring of exploitation attempts, errors, and abnormal behavior.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Incident response:&lt;/strong&gt; Establishes procedures when there are indications of compromise.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These controls complement one another.&lt;/p&gt;

&lt;p&gt;None should be treated as a universal replacement for the others.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Security should be part of the development process from the very first &lt;code&gt;git init&lt;/code&gt;.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Security should not begin when a vulnerability is discovered or when an application reaches production. It must be considered from the earliest stages of development, integrated into architecture decisions, dependency management, CI/CD pipelines, infrastructure provisioning, and runtime maintenance.&lt;/p&gt;

&lt;p&gt;This is the foundation of &lt;strong&gt;Security by Design&lt;/strong&gt; and the DevSecOps mindset: security is not a final checkpoint, but a continuous responsibility throughout the entire software lifecycle.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Because security should start with &lt;code&gt;git init&lt;/code&gt;, not with a critical CVE.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  7. The Role of DevOps and SRE During a Critical Vulnerability
&lt;/h2&gt;

&lt;p&gt;For DevOps and Site Reliability Engineering (SRE) teams, the challenge does not end when the security team identifies a vulnerability.&lt;/p&gt;

&lt;p&gt;Teams must determine which services are affected, assess the potential impact, and apply fixes safely.&lt;/p&gt;

&lt;p&gt;A structured response may include:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Identification:&lt;/strong&gt; Locate servers, containers, and images running affected versions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Prioritization:&lt;/strong&gt; Evaluate internet exposure, service criticality, and potential exploitation paths.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Containment:&lt;/strong&gt; Apply temporary network and WAF controls when appropriate.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Remediation:&lt;/strong&gt; Update packages and images, rebuild artifacts, and replace affected workloads.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Validation:&lt;/strong&gt; Run tests, verify runtime versions, and monitor operational indicators.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Investigation:&lt;/strong&gt; Analyze logs, events, and evidence of potential compromise. Applying a patch removes the known vulnerability, but it does not automatically resolve the consequences of a previous intrusion.&lt;/p&gt;

&lt;p&gt;From an SRE perspective, the response must balance security and reliability.&lt;/p&gt;

&lt;p&gt;Metrics such as time to identification, time to remediation, inventory coverage, and deployment success rate help assess operational maturity.&lt;/p&gt;

&lt;p&gt;It is also important to establish emergency patching procedures that do not depend exclusively on regular maintenance windows.&lt;/p&gt;

&lt;h2&gt;
  
  
  8. Automated Patching: Moving from Reaction to Prevention
&lt;/h2&gt;

&lt;p&gt;The most important lesson from PHP2Shell goes beyond the two vulnerabilities themselves.&lt;/p&gt;

&lt;p&gt;It highlights the need to transform security into a continuous operational capability.&lt;/p&gt;

&lt;p&gt;A mature organization should be able to answer questions such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Which vulnerable components are currently running in production?&lt;/li&gt;
&lt;li&gt;Which container images and services depend on those components?&lt;/li&gt;
&lt;li&gt;Is a patched version available?&lt;/li&gt;
&lt;li&gt;Which workloads need to be rebuilt?&lt;/li&gt;
&lt;li&gt;How can the fix be validated without causing downtime?&lt;/li&gt;
&lt;li&gt;How can we demonstrate that every affected environment has been updated?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Combining asset inventories, SBOMs, vulnerability scanners, CI/CD pipelines, security policies, and observability makes it possible to build this capability.&lt;/p&gt;

&lt;p&gt;AI-powered tools can also assist with vulnerability classification and the preparation of remediation changes.&lt;/p&gt;

&lt;p&gt;However, decisions with operational impact must follow authorization policies, testing requirements, and audit mechanisms.&lt;/p&gt;

&lt;p&gt;Automation should strengthen response capabilities, not eliminate the controls required to operate critical systems safely.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;PHP2Shell demonstrates how vulnerabilities in foundational software components can affect applications regardless of the quality of their source code.&lt;/p&gt;

&lt;p&gt;For DevOps and SRE professionals, this incident reinforces five key principles:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Application security also means runtime security.&lt;/li&gt;
&lt;li&gt;Containers must be continuously updated and verified.&lt;/li&gt;
&lt;li&gt;SBOMs and asset inventories are essential for identifying exposure.&lt;/li&gt;
&lt;li&gt;DevSecOps pipelines should incorporate vulnerability detection and remediation.&lt;/li&gt;
&lt;li&gt;Observability and automation must be part of the operational security response.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;The challenge is not simply discovering a vulnerability. It is knowing where it exists, understanding its impact, and being able to fix it quickly, verifiably, and safely.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This is one of the fundamental challenges of applying Site Reliability Engineering principles to modern cybersecurity.&lt;/p&gt;




&lt;h3&gt;
  
  
  Technical References
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;PHP Project:&lt;/strong&gt; Security Advisory — CVE-2026-109618 and CVE-2026-109619 (October 21, 2026). &lt;a href="https://www.php.net/" rel="noopener noreferrer"&gt;https://www.php.net/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Docker:&lt;/strong&gt; Security Update on PHP2Shell: Impact for Docker Customers (October 22, 2026). &lt;a href="https://www.docker.com/blog/security-update-on-php2shell-impact-for-docker-customers/" rel="noopener noreferrer"&gt;https://www.docker.com/blog/security-update-on-php2shell-impact-for-docker-customers/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cloudflare:&lt;/strong&gt; Cloudflare deploys protections against php2shell vulnerability (October 21, 2026). &lt;a href="https://blog.cloudflare.com/php-vulnerabilities-waf-protection/" rel="noopener noreferrer"&gt;https://blog.cloudflare.com/php-vulnerabilities-waf-protection/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AWS Security Blog:&lt;/strong&gt; Using AWS WAF to apply mitigations for PHP2Shell RCE vulnerabilities (October 21, 2026). &lt;a href="https://aws.amazon.com/blogs/security/using-aws-waf-to-apply-mitigations-for-php2shell-rce-vulnerabilities-cve-2026-109618-and-cve-2026-109619/" rel="noopener noreferrer"&gt;https://aws.amazon.com/blogs/security/using-aws-waf-to-apply-mitigations-for-php2shell-rce-vulnerabilities-cve-2026-109618-and-cve-2026-109619/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Red Hat:&lt;/strong&gt; RHSB-2026-013 — PHP request handling memory corruption. &lt;a href="https://access.redhat.com/security/vulnerabilities/RHSB-2026-013" rel="noopener noreferrer"&gt;https://access.redhat.com/security/vulnerabilities/RHSB-2026-013&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>devsecops</category>
      <category>cybersecurity</category>
      <category>devops</category>
      <category>php</category>
    </item>
    <item>
      <title>Building JC SRE NetProbe: A Python CLI for Network Health Checks, DevOps, and SRE</title>
      <dc:creator>JacivaldoCarvalho</dc:creator>
      <pubDate>Fri, 23 Oct 2026 03:40:13 +0000</pubDate>
      <link>https://dev.to/jacivaldocarvalho/building-jc-sre-netprobe-a-python-cli-for-network-health-checks-devops-and-sre-4l0f</link>
      <guid>https://dev.to/jacivaldocarvalho/building-jc-sre-netprobe-a-python-cli-for-network-health-checks-devops-and-sre-4l0f</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;As a Telecommunications Engineer interested in Networking, DevOps, and Site Reliability Engineering (SRE), I've always been fascinated by how different layers of network infrastructure work together to deliver reliable services.&lt;/p&gt;

&lt;p&gt;When an application becomes unavailable, the problem isn't necessarily the application itself.&lt;/p&gt;

&lt;p&gt;It could be a DNS resolution issue, a TCP connection failure, an expired TLS certificate, or an HTTP service returning an unexpected response.&lt;/p&gt;

&lt;p&gt;Understanding where the failure occurs is an important part of troubleshooting.&lt;/p&gt;

&lt;p&gt;With that in mind, I built &lt;strong&gt;JC SRE NetProbe&lt;/strong&gt;, an open-source Python command-line tool designed to simplify network connectivity checks and basic service health diagnostics.&lt;/p&gt;

&lt;p&gt;🔗 &lt;strong&gt;GitHub:&lt;/strong&gt; &lt;a href="https://github.com/jacivaldocarvalho/jc-sre-netprobe" rel="noopener noreferrer"&gt;https://github.com/jacivaldocarvalho/jc-sre-netprobe&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What is JC SRE NetProbe?
&lt;/h2&gt;

&lt;p&gt;JC SRE NetProbe is a lightweight Python package that provides network diagnostic utilities through a command-line interface (CLI) and a Python API.&lt;/p&gt;

&lt;p&gt;The project brings together several common network checks into a single tool, making it useful for telecommunications professionals, network engineers, DevOps teams, and SRE practitioners.&lt;/p&gt;

&lt;p&gt;Its main capabilities include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;TCP connectivity checks with latency measurement&lt;/li&gt;
&lt;li&gt;DNS resolution checks&lt;/li&gt;
&lt;li&gt;HTTP/HTTPS endpoint health checks&lt;/li&gt;
&lt;li&gt;IPv4 and IPv6 network information&lt;/li&gt;
&lt;li&gt;TLS certificate validation and expiration information&lt;/li&gt;
&lt;li&gt;Configurable timeouts&lt;/li&gt;
&lt;li&gt;Structured JSON output&lt;/li&gt;
&lt;li&gt;Exit codes designed for automation&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The goal is straightforward: &lt;strong&gt;make network troubleshooting easier to execute, understand, and automate.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Why I Built It
&lt;/h2&gt;

&lt;p&gt;In network operations and infrastructure troubleshooting, engineers often need to perform multiple checks to identify why a service is unavailable.&lt;/p&gt;

&lt;p&gt;For example, consider an API endpoint that suddenly stops responding.&lt;/p&gt;

&lt;p&gt;Several questions immediately come to mind:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Is the hostname resolving correctly?&lt;/li&gt;
&lt;li&gt;Can a TCP connection be established?&lt;/li&gt;
&lt;li&gt;Is the TLS certificate valid?&lt;/li&gt;
&lt;li&gt;Is the HTTP endpoint responding as expected?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Each question investigates a different part of the service delivery process.&lt;/p&gt;

&lt;p&gt;I wanted to create a Python tool that could perform these checks consistently while also providing structured results suitable for scripting and automation.&lt;/p&gt;

&lt;p&gt;JC SRE NetProbe is a practical project that connects my telecommunications background with software development and SRE practices.&lt;/p&gt;

&lt;h2&gt;
  
  
  Getting Started
&lt;/h2&gt;

&lt;p&gt;JC SRE NetProbe requires &lt;strong&gt;Python 3.11 or newer&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Install the package using pip:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip &lt;span class="nb"&gt;install &lt;/span&gt;jc-sre-netprobe
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once installed, the CLI is available directly from your terminal.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Checking TCP Connectivity
&lt;/h3&gt;

&lt;p&gt;To verify whether a remote service accepts TCP connections:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;jc-sre-netprobe tcp github.com 443
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This checks connectivity to GitHub on TCP port 443.&lt;/p&gt;

&lt;p&gt;TCP connectivity checks are useful when investigating service availability, firewall restrictions, and network connectivity problems.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Checking DNS Resolution
&lt;/h3&gt;

&lt;p&gt;DNS plays a critical role in connecting applications to network services.&lt;/p&gt;

&lt;p&gt;To check hostname resolution:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;jc-sre-netprobe dns github.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This helps determine whether a hostname can be resolved before investigating higher-level protocols.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Checking HTTP/HTTPS Services
&lt;/h3&gt;

&lt;p&gt;A successful TCP connection doesn't necessarily mean that an application is healthy.&lt;/p&gt;

&lt;p&gt;To perform an HTTP health check:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;jc-sre-netprobe http https://github.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This provides an application-layer check of the endpoint.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Inspecting TLS Certificates
&lt;/h3&gt;

&lt;p&gt;TLS certificates are essential for secure communication.&lt;/p&gt;

&lt;p&gt;Expired or invalid certificates can cause application failures even when the underlying network is operational.&lt;/p&gt;

&lt;p&gt;To inspect a server's TLS certificate:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;jc-sre-netprobe tls github.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can also configure a timeout:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;jc-sre-netprobe tls github.com &lt;span class="nt"&gt;--timeout&lt;/span&gt; 3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  5. Working with IPv4 and IPv6 Networks
&lt;/h3&gt;

&lt;p&gt;The tool also provides network information for IPv4 and IPv6 address ranges.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;jc-sre-netprobe network 192.168.1.0/24
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This functionality can be useful when working with IP addressing and network infrastructure.&lt;/p&gt;

&lt;h2&gt;
  
  
  Designed for Automation
&lt;/h2&gt;

&lt;p&gt;One of the important aspects of JC SRE NetProbe is its ability to integrate with scripts and operational workflows.&lt;/p&gt;

&lt;h3&gt;
  
  
  JSON Output
&lt;/h3&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;jc-sre-netprobe &lt;span class="nt"&gt;--json&lt;/span&gt; tls github.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Structured output makes it easier to consume results programmatically and integrate checks into other tools.&lt;/p&gt;

&lt;h3&gt;
  
  
  Operational Exit Codes
&lt;/h3&gt;

&lt;p&gt;The CLI uses exit codes that can be interpreted by automation systems.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Exit Code&lt;/th&gt;
&lt;th&gt;Meaning&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;Target is healthy or check succeeded&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;Target is unhealthy or unavailable&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;Invalid CLI usage or input&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;jc-sre-netprobe tcp github.com 443
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="nv"&gt;$?&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This behavior makes the tool useful in shell scripts, CI/CD pipelines, and operational checks.&lt;/p&gt;

&lt;h2&gt;
  
  
  Using JC SRE NetProbe with Python
&lt;/h2&gt;

&lt;p&gt;In addition to its CLI, the package provides a Python API.&lt;/p&gt;

&lt;p&gt;For example, a TCP connectivity check can be performed directly from Python:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;jc_sre_netprobe&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;tcp_check&lt;/span&gt;

&lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;tcp_check&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;github.com&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;443&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;TLS checks are also available:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;jc_sre_netprobe&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;tls_check&lt;/span&gt;

&lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;tls_check&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;github.com&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This allows developers to reuse the network probing functionality inside their own applications and automation scripts.&lt;/p&gt;

&lt;h2&gt;
  
  
  Development and Code Quality
&lt;/h2&gt;

&lt;p&gt;Beyond implementing network checks, I wanted this project to follow good Python development practices.&lt;/p&gt;

&lt;p&gt;The repository includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Ruff&lt;/strong&gt; for linting&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Mypy&lt;/strong&gt; for static type checking&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pytest&lt;/strong&gt; for automated testing&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Coverage&lt;/strong&gt; for test coverage analysis&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GitHub Actions&lt;/strong&gt; for CI/CD&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;PyPI Trusted Publishing&lt;/strong&gt; for package releases&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The CI pipeline validates the project against Python 3.11, 3.12, and 3.13.&lt;/p&gt;

&lt;p&gt;These practices help make the project more maintainable and provide a foundation for future improvements.&lt;/p&gt;

&lt;h2&gt;
  
  
  Networking Meets Site Reliability Engineering
&lt;/h2&gt;

&lt;p&gt;One of the aspects I enjoy most about this project is how it connects traditional networking concepts with modern SRE practices.&lt;/p&gt;

&lt;p&gt;In telecommunications and network engineering, troubleshooting frequently involves understanding protocols, connectivity, addressing, and service behavior.&lt;/p&gt;

&lt;p&gt;In SRE, these same concepts are essential for investigating reliability and availability.&lt;/p&gt;

&lt;p&gt;JC SRE NetProbe brings these perspectives together through lightweight black-box checks.&lt;/p&gt;

&lt;p&gt;It isn't intended to replace comprehensive monitoring and observability platforms. Instead, it provides focused diagnostic utilities that can complement existing operational workflows.&lt;/p&gt;

&lt;h2&gt;
  
  
  What's Next?
&lt;/h2&gt;

&lt;p&gt;I plan to continue improving JC SRE NetProbe as I explore new ideas in network automation, Python development, DevOps, and SRE.&lt;/p&gt;

&lt;p&gt;Some areas worth exploring include additional diagnostic capabilities, improved automation integrations, and more examples of real-world usage.&lt;/p&gt;

&lt;p&gt;As an open-source project, feedback, suggestions, and contributions are welcome.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;Building JC SRE NetProbe has been an opportunity to combine my telecommunications engineering background with my interest in software development and infrastructure reliability.&lt;/p&gt;

&lt;p&gt;I believe that building practical tools is one of the best ways to deepen technical knowledge while contributing something useful to the community.&lt;/p&gt;

&lt;p&gt;If you work with networking, telecommunications, DevOps, or SRE, I'd love to hear your thoughts.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What network diagnostic checks do you use most frequently in your daily work?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Feel free to explore the repository, open an issue, or contribute.&lt;/p&gt;

&lt;p&gt;⭐ &lt;strong&gt;GitHub:&lt;/strong&gt; &lt;a href="https://github.com/jacivaldocarvalho/jc-sre-netprobe" rel="noopener noreferrer"&gt;https://github.com/jacivaldocarvalho/jc-sre-netprobe&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Thanks for reading!&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Jacivaldo Carvalho&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Telecommunications Engineer | Networking | DevOps | SRE&lt;/em&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>devops</category>
      <category>sre</category>
      <category>networking</category>
    </item>
  </channel>
</rss>
