Ubuntu VM repeatedly compromised with mining malware on Azure

Sahen Ahuja 0 Reputation points
2025-12-20T12:24:44.69+00:00

I'm experiencing a critical security issue where every Ubuntu 24.04 VM I create on Azure gets compromised with cryptocurrency mining malware within 30 minutes. Setup: - Region: UAE North - OS: Ubuntu 24.04 LTS - SSH port changed to 2222 - Password auth disabled - NSG rules: SSH only from specific IPs (my laptop + Jenkins server) - Ports 80/443 public for web app Issue: - Mining processes (kdevtmpfsi, kinsing) appear - Unauthorized SSH keys added - Cron jobs created for persistence - Happens consistently across fresh deployments Security measures taken: - SSH keys only (no password) - Custom SSH port (2222) - Restricted NSG rules - fail2ban installed - UFW configured NSG Configuration: - Rule 110: SSH (2222) from my IP (my-ip/32) - Rule 140: SSH (2222) from Jenkins (jenkins-ip/32) - Rule 120: HTTP (80) from Any - Rule 130: HTTPS (443) from Any Questions: 1. Is there a vulnerability in this NSG configuration? 2. Could Jenkins server () be compromised? 3. What's the recommended security architecture for CI/CD + public web app? 4. Are there Azure-specific security measures I'm missing? I've checked auth logs, activity logs, and followed security best practices but still experiencing this issue.

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
{count} votes

1 answer

Sort by: Most helpful
  1. TP 146.4K Reputation points Volunteer Moderator
    2025-12-20T13:25:27.24+00:00

    Hi,

    From your description it appears you have a web app open to the public. Have you patched all known vulnerabilities of the components that make up your web app? For example, the recent React Server Components remote code execution vulnerability has been affecting many people. Please review below articles:

    Does you app use Next.js? If yes see below:

    https://nextjs.org/blog/CVE-2025-66478

    Critical Security Vulnerability in React Server Components

    https://react.dev/blog/2025/12/03/critical-security-vulnerability-in-react-server-components

    Defending against the CVE-2025-55182 (React2Shell) vulnerability in React Server Components

    https://www.microsoft.com/en-us/security/blog/2025/12/15/defending-against-the-cve-2025-55182-react2shell-vulnerability-in-react-server-components/

    Please click Accept Answer and upvote if the above was helpful.

    Thanks.

    -TP


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.