Blog • September 24, 2026
From a Public Jenkins Server to an AWS Account Compromise
How We Detected, Traced, and Contained a Cloud Security Incident

Cloud security incidents rarely begin with a single catastrophic failure.
More often, they are the result of several small security gaps coming together: a publicly accessible CI/CD system, excessive permissions, long-lived credentials, and insufficient access controls.
This incident was a good example of exactly that.
What initially appeared to be an unexpected AWS cost spike eventually led us to uncover a chain of unauthorized activity involving a publicly accessible Jenkins server, compromised credentials, EC2 instances, IAM roles, and unauthorized use of AWS services.
More importantly, it demonstrated how quickly a security incident can be contained when logging, monitoring, and incident-response processes are in place.
The Incident
Our Jenkins server was hosted on an AWS EC2 instance and was publicly accessible over the internet.
It was not protected behind a VPN or restricted to an internal network.
At some point, an unauthorized actor gained access to Jenkins and leveraged the CI/CD environment to execute AWS-related operations.
The attack path eventually looked like this:
Public Jenkins → Unauthorized CI/CD Execution → EC2 Instance → IAM Role Creation → Administrative Permissions → AWS Service Access → Unexpected Cost Spike
The attacker was able to use the compromised environment to create an EC2 instance and then use that infrastructure to create IAM roles with highly privileged permissions.
Those permissions were subsequently used to gain access to AWS services, including Kiro-related resources.
The activity resulted in an unexpected spike in AWS usage and approximately $300 in additional charges before the incident was identified and contained.
The First Signal: An Unexpected Cost Spike
The first indication that something was wrong was not an application failure.
It was an unexpected increase in AWS usage and cost.
A sudden billing spike can be an important security signal, particularly when it does not correspond to any planned deployment, workload increase, or infrastructure change.
Instead of treating the increase purely as a billing issue, our team approached it as a potential security incident.
We immediately started investigating the AWS account activity.
The first question was:
What changed in the account, and who made those changes?
Step 1: Following the CloudTrail Trail
The first place we looked was AWS CloudTrail.
CloudTrail provided the activity trail necessary to reconstruct what had happened.
We investigated recent API activity, focusing on:
- IAM changes
- Role creation
- User activity
- EC2 instance creation
- Permission changes
- AWS service access
- Authentication activity
- Changes surrounding the billing spike
The investigation revealed IAM activity associated with the unauthorized access.
This gave us our first significant lead:
an IAM identity had been used to create or establish the privileged access involved in the incident.
Instead of simply disabling the most recently created resources, we continued tracing the activity backward.
Step 2: Identifying the Compromised Credentials
The next question was:
Whose credentials were being used?
By correlating the CloudTrail events with the IAM identity involved, we identified the credentials associated with the activity.
The credentials belonged to a former member of the organization.
This was a critical finding.
The credentials were no longer supposed to be actively used, but they were still present and had become compromised.
This transformed the investigation from:
"Someone accessed our AWS account."
into:
"A previously issued credential was compromised and was used as part of the attack chain."
Step 3: Reconstructing the Attack Path
Once we had identified the compromised identity, we reconstructed the sequence of events.
The investigation showed a chain similar to the following:
Internet │ ▼ Publicly Accessible Jenkins │ ▼ Unauthorized Jenkins / CI-CD Activity │ ▼ EC2 Instance Created │ ▼ IAM Role Created │ ▼ Privileged Permissions Obtained │ ▼ AWS Service / Kiro Access │ ▼ Unexpected Resource Usage │ ▼ AWS Cost Spike │ ▼ Incident Detected
This was an important realization.
The Jenkins server was not necessarily the final target.
It was an entry point into the infrastructure.
Once access to the CI/CD environment was obtained, it could be used as a mechanism to execute cloud operations.
Immediate Containment
Once the attack path became clear, our priority shifted from investigation to containment.
We took several immediate actions.
1. Removed Unauthorized Kiro Access
The unauthorized Kiro-related application/access that had been created during the incident was removed.
This immediately stopped the unauthorized usage associated with that resource.
2. Investigated and Removed Compromised Credentials
The compromised credentials associated with the former employee were identified and removed.
We also initiated a broader review to ensure that other long-lived credentials were not still active.
3. Reported the Account Misuse to AWS
Our team raised a support case with AWS to report the account misuse and provide details of the incident.
This ensured that AWS was aware of the unauthorized activity and could assist with the investigation and account-level response.
4. Secured Jenkins
The Jenkins server was immediately removed from direct public exposure.
We moved Jenkins behind a VPN so that it could only be accessed through the organization's controlled network path.
The Bigger Problem: Jenkins Permissions
During the investigation, we also identified another important risk.
CI/CD systems often have access to powerful cloud resources because they need to deploy infrastructure and applications.
However, giving a CI/CD system broad administrative access creates a significant blast radius if that system is compromised.
We therefore reviewed Jenkins' AWS permissions and redesigned the access model.
Instead of relying on broad permissions, we introduced role-based access and applied the principle of least privilege.
Jenkins received only the permissions required for the workloads it was responsible for.
Removing Hard-Coded Credentials
Another major remediation step was eliminating hard-coded AWS credentials.
Long-lived access keys create a significant security risk because they can:
- Be accidentally committed to repositories
- Remain active after an employee leaves
- Be copied to machines or CI/CD systems
- Be exposed through logs
- Be difficult to track
- Be reused outside their intended environment
We performed a broader review and replaced hard-coded credentials wherever they were being used.
The goal was to move toward:
Identity → Role → Temporary Credentials
rather than:
Application → Static Access Key
Moving Toward AWS Identity Center
We also redesigned how users accessed AWS.
Instead of distributing individual IAM access keys, access was centralized through AWS IAM Identity Center.
This provided a more controlled access model:
User │ ▼ AWS IAM Identity Center │ ▼ Permission Set │ ▼ AWS Account │ ▼ IAM Role
This approach provides better control over:
- User access
- Role assignment
- Permission boundaries
- Employee onboarding
- Employee offboarding
- Centralized authentication
- Access auditing
It also significantly reduces dependence on long-lived IAM user credentials.
Establishing a Proper AWS Landing Zone
The incident also highlighted that security cannot depend on individual configuration decisions.
We therefore moved toward a more structured AWS environment using AWS Control Tower and a proper AWS Landing Zone architecture.
The objective was to establish centralized governance across AWS accounts rather than managing security independently in each environment.
This included establishing stronger controls around:
- Account governance
- Identity
- Permissions
- Logging
- Security controls
- Organizational policies
- Environment separation
- Centralized monitoring
The focus shifted from:
"How do we secure this individual AWS account?"
to:
"How do we build an AWS environment where these mistakes are harder to make in the first place?"
Adding Billing Anomaly Detection
The incident also changed how we looked at AWS billing.
A cost spike should not only be treated as a financial event.
It can also be a potential security signal.
We therefore introduced alerting around unusual AWS spending and usage patterns.
The objective was simple:
Unexpected AWS Usage │ ▼ Cost / Usage Alarm │ ▼ Notification │ ▼ Security Investigation
This gives the team another layer of detection in addition to traditional security monitoring.
What We Changed
The incident resulted in several concrete improvements.
What We Learned
This incident reinforced several important lessons.
1. A CI/CD system is part of your security perimeter
Jenkins is not simply a deployment tool.
If Jenkins has access to your cloud environment, compromising Jenkins can potentially become a cloud compromise.
CI/CD systems therefore need the same security attention as production infrastructure.
2. Publicly exposed management systems are high-risk
A service such as Jenkins should not be directly exposed to the public internet unless there is a very specific and well-controlled requirement.
VPNs, private networking, SSO, MFA, access controls, and network restrictions can significantly reduce the attack surface.
3. Former employee credentials must be removed immediately
Offboarding is a security control.
When an employee leaves, their access should not simply become "unused."
It should be explicitly revoked.
The incident demonstrated why stale credentials can become a significant security liability.
4. Least privilege matters
CI/CD systems, developers, applications, and automation should receive only the permissions they actually require.
An attacker who compromises a low-privilege identity should not automatically gain a path to administrative access.
5. CloudTrail is critical for incident response
Without detailed API logging, reconstructing the sequence of events would have been considerably more difficult.
CloudTrail allowed us to move from:
"There is unusual activity."
to:
"This identity performed these actions, which led to these resources being created."
That level of traceability is essential during a cloud security incident.
6. Cost monitoring can become a security control
Unexpected spending can sometimes be one of the earliest indicators of compromise.
A billing alert may look like a financial control, but in cloud environments it can also function as a security signal.
From Incident Response to Security Architecture
The most important outcome of this incident was not simply that we stopped the unauthorized activity.
It was that we used the incident to improve the architecture.
We moved toward:
The objective was to make secure access the default architecture, rather than relying on individual users or teams to remember every security requirement.
Conclusion
The incident started with something that could easily have been overlooked: an unexpected AWS cost increase.
By immediately investigating the activity through CloudTrail, we were able to trace the sequence of events, identify the compromised credentials, understand how the attacker moved through the environment, and contain the unauthorized access.
More importantly, the incident exposed several architectural weaknesses:
Public Jenkins → Excessive CI/CD permissions → Long-lived credentials → Insufficient centralized access governance
We addressed each of these areas.
Jenkins was moved behind a VPN.
CI/CD permissions were redesigned around roles and least privilege.
Hard-coded and long-lived credentials were removed.
Access was centralized through AWS IAM Identity Center.
AWS Control Tower and a Landing Zone were introduced for governance.
And automated billing alerts were added to detect unusual usage earlier.
The key lesson was simple:
Security is not a single tool or control. It is a chain of controls designed to prevent, detect, trace, and contain an incident.
In this case, CloudTrail helped us trace the incident, monitoring helped us detect it, and architectural changes helped ensure that the same attack path would be significantly harder to reproduce.
That is ultimately what effective incident response should achieve—not just stopping today's incident, but making tomorrow's incident harder to happen.