SlideShare a Scribd company logo
2
Most read
6
Most read
10
Most read
1
Netskope
Agenda
2
• Cloud Shell in a glimpse
• Recon
• The Abuse
• Impact
• Mitigation
What’s a Cloud Shell ?
3
• A web-based CLI terminal window
• Preloaded with utilities such as gcloud, gsutil or other
CSP-specific command-line tools
• A developer-ready environment
• Few Gigs of persistent disk storage (Session Life: 40 mins - 12 hrs)
Recon - Nmap (public IP v. private IP)
4
-------------- Public IP --------------
22/tcp open ssh OpenSSH 9.6 (protocol 2.0)
6000/tcp open ssh OpenSSH 8.9p1 Ubuntu 3ubuntu0.10 (Ubuntu Linux; protocol 2.0)
-------------- Private IP -------------
22/tcp open ssh OpenSSH 8.9p1 Ubuntu 3ubuntu0.10 (Ubuntu Linux; protocol 2.0)
900/tcp open http BaseHTTPServer 0.6 (Python 3.9.2)
922/tcp open ssh OpenSSH 8.9p1 Ubuntu 3ubuntu0.10 (Ubuntu Linux; protocol 2.0)
970/tcp open unknown
980/tcp open ssl/unknown
981/tcp open http Golang net/http server (Go-IPFS json-rpc or InfluxDB API)
3000/tcp open ppp?
Path to Exposed Service
5
Web Preview in GCP Cloud Shell
6
• https://8080-cs-xxxxxx-default.cs-asia-east1-jnrc.cloudshell.dev
⎻ HTTPS frendend to the HTTP backend
⎻ Not public accessible (auth needed)
Passing OAuth token
7
Simplified Path to Exposed Services
8
9
The Abuse
Port Redirection
10
cidr_ssh="A.B.C.D/32"
cidr_socks="A.B.C.0/28"
cidr_web="0.0.0.0/0"
iptables -t nat -I PREROUTING -p tcp -s $cidr_web --dport 922 -j REDIRECT --to-port 8080
iptables -t nat -I PREROUTING -p tcp -s $cidr_socks --dport 922 -j REDIRECT --to-port 1080
iptables -t nat -I PREROUTING -p tcp -s $cidr_ssh --dport 922 -j REDIRECT --to-port 22
• NAT table’s PREROUTING chain
• First match wins
⎻ Insert to the top
https://www.frozentux.net/iptables-tutorial/chunkyhtml/c962.html
Redirected Paths
11
IAP Auth Bypass
12
IAP Auth Bypass (cont.)
13
• Official URL (auth required)
⎻ https://8080-cs-xxxxx-default.cs-asia-east1-vger.cloud
shell.dev
• New URL (public access, over port 6000)
⎻ http://x.x.x.x.bc.googleusercontent.com:6000
⎻ https://your.dns.domain:6000
14
Impacts and Mitigation
Impact
15
• Web Preview auth bypass
⎻ Public access without Google authentication
⎻ Malware distribution
⎻ Data exfiltration
Impact
16
• Web Preview auth bypass
⎻ Public access without Google authentication
⎻ Malware distribution
⎻ Data exfiltration
• Direct cloud shell access
⎻ By appending extra ssh pubkey to /etc/ssh/keys/authorized_keys
Impact
17
• Web Preview auth bypass
⎻ Public access without Google authentication
⎻ Malware distribution
⎻ Data exfiltration
• Direct cloud shell access
⎻ By appending extra ssh pubkey to /etc/ssh/keys/authorized_keys
• (Malicious) traffic pivoting through the Google network
⎻ Access restriction bypass
⎻ Indirect access to C2 server infrastructure
Mitigation
18
1. MFA hardening:
a. TOTP (phishable!)
b. Hardware security keys (✔)
Mitigation
19
1. MFA hardening:
a. TOTP (phishable!)
b. Hardware security keys (✔)
2. Cloud Shell access control (at Org or OU levels)
Mitigation
20
1. MFA hardening:
a. TOTP (phishable!)
b. Hardware security keys (✔)
2. Cloud Shell access control (at Org or OU levels)
3. More restricted access to current exposed open ports
22/tcp open ssh OpenSSH 9.6 (protocol 2.0)
6000/tcp open ssh OpenSSH 8.9p1 Ubuntu 3ubuntu0.10 (Ubuntu Linux; protocol 2.0)
Mitigation
21
1. MFA hardening:
a. TOTP (phishable!)
b. Hardware security keys (✔)
2. Cloud Shell access control (at Org or OU levels)
3. More restricted access to current exposed open ports
4. Principle of least privilege
a. IAM Policy Analyzer
b. IAM Recommender
Disclosure Timeline
22
• Apr. 23 - Disclosed abuse methodology to Google VRP
⎻ Possible disclosure date set to Aug 8 (~ 110 days)
• June 21 - Ticket severity changed from S4 to S2
• July 19 - Bar of financial award not met. Will decide if a fix is required
Questions?
23
Contact:
Hubert Lin
hlin@netskope.com
References
24
• https://cloud.google.com/shell
• https://cloud.google.com/shell/docs/how-cloud-shell-works
• https://cloud.google.com/shell/docs/resetting-cloud-shell
• https://cloud.google.com/storage/docs/gcsfuse-quickstart-mount-bucket
• https://cloud.google.com/policy-intelligence/docs/role-recommendations-overview
• http://www.faqs.org/docs/iptables/targets.html#REDIRECTTARGET
• https://www.inet.no/dante/doc/1.4.x/config/server.html

More Related Content

PDF
Gray Cover_ The dangers of cloudshells.pdf
PDF
PPT
Bh usa-01-kaminsky
PPTX
Ssh (The Secure Shell)
PPT
Secure shell ppt
PPT
PPTX
Build Your Own CloudShell
PPTX
Ssh tunnel
Gray Cover_ The dangers of cloudshells.pdf
Bh usa-01-kaminsky
Ssh (The Secure Shell)
Secure shell ppt
Build Your Own CloudShell
Ssh tunnel

Similar to One Port to Serve Them All - Google GCP Cloud Shell Abuse (20)

PDF
IBCAST 2021: Observations and lessons learned from the APNIC Community Honeyn...
PPT
Secure shell protocol
PPTX
Network tunneling techniques
PPTX
Europe Cloud Summit - Security hardening of public cloud services
PPTX
Network Penetration Testing
PDF
Windowshadoop
PDF
Using Secure Shell on Linux: What Everyone Should Know
PDF
They Ought to Know Better: Exploiting Security Gateways via Their Web Interfaces
PDF
Scripting for infosecs
PDF
tutorial-ssh.pdf
PDF
IBM Ported Tools for z/OS: OpenSSH User's Guide
PPTX
Pentesting ssh
PDF
Securing Your Resources with Short-Lived Certificates!
PDF
Information System Security
PDF
Defeating The Network Security Infrastructure V1.0
PDF
BlueHat v18 || The matrix has you - protecting linux using deception
PDF
business
PPTX
Metasploit for Web Workshop
PDF
SSH.pdf
IBCAST 2021: Observations and lessons learned from the APNIC Community Honeyn...
Secure shell protocol
Network tunneling techniques
Europe Cloud Summit - Security hardening of public cloud services
Network Penetration Testing
Windowshadoop
Using Secure Shell on Linux: What Everyone Should Know
They Ought to Know Better: Exploiting Security Gateways via Their Web Interfaces
Scripting for infosecs
tutorial-ssh.pdf
IBM Ported Tools for z/OS: OpenSSH User's Guide
Pentesting ssh
Securing Your Resources with Short-Lived Certificates!
Information System Security
Defeating The Network Security Infrastructure V1.0
BlueHat v18 || The matrix has you - protecting linux using deception
business
Metasploit for Web Workshop
SSH.pdf
Ad

More from Cloud Village (18)

PPTX
Unexpected Leaks in AWS Transit Gateways
PDF
The Rise of the Planet of the Agents: LLM-based AI Agents and Cloud Security ...
PDF
Creating Azure Policy Compliant Backdoor
PPTX
Kicking in the Door to the Cloud: Exploiting Cloud Provider Vulnerabilities f...
PDF
Cloud Tripwires: fighting stealth with stealth
PPTX
Connecting the Dots - Mastering Alert Correlation for Proactive Defense in th...
PDF
Runtime Reachability: Prioritizing Vulnerabilities with eBPF & Continuous Pro...
PPTX
Revealing Choke Points - Practical Tactics for Boosting Cloud Security
PDF
Finding Holes in Conditional Access Policies
PPTX
One Click, Six Services - Abusing The Dangerous Multi-service Orchestration P...
PDF
Terraform Unleashed - Crafting Custom Provider Exploits for Ultimate Control
PPTX
Workshop: Hands-On Container Image Security Mastering Sigstore for Unbreachab...
PDF
DC 32: Epyon - Attacking DevOps environments
PDF
Exploit K8S via Misconfiguration .YAML in CSP environments
PDF
Cloud Offensive Breach and Risk Assessment (COBRA)
PDF
The Oracle Awakens: Demystifying Privilege Escalation in the cloud
PDF
Catch them all! Detection engineering and purple teaming in the cloud
PDF
Gone in 60 Seconds… How Azure AD/Entra ID Tenants are Compromise
Unexpected Leaks in AWS Transit Gateways
The Rise of the Planet of the Agents: LLM-based AI Agents and Cloud Security ...
Creating Azure Policy Compliant Backdoor
Kicking in the Door to the Cloud: Exploiting Cloud Provider Vulnerabilities f...
Cloud Tripwires: fighting stealth with stealth
Connecting the Dots - Mastering Alert Correlation for Proactive Defense in th...
Runtime Reachability: Prioritizing Vulnerabilities with eBPF & Continuous Pro...
Revealing Choke Points - Practical Tactics for Boosting Cloud Security
Finding Holes in Conditional Access Policies
One Click, Six Services - Abusing The Dangerous Multi-service Orchestration P...
Terraform Unleashed - Crafting Custom Provider Exploits for Ultimate Control
Workshop: Hands-On Container Image Security Mastering Sigstore for Unbreachab...
DC 32: Epyon - Attacking DevOps environments
Exploit K8S via Misconfiguration .YAML in CSP environments
Cloud Offensive Breach and Risk Assessment (COBRA)
The Oracle Awakens: Demystifying Privilege Escalation in the cloud
Catch them all! Detection engineering and purple teaming in the cloud
Gone in 60 Seconds… How Azure AD/Entra ID Tenants are Compromise
Ad

Recently uploaded (20)

PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPTX
Programs and apps: productivity, graphics, security and other tools
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
A comparative analysis of optical character recognition models for extracting...
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PPTX
A Presentation on Artificial Intelligence
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
MYSQL Presentation for SQL database connectivity
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPT
Teaching material agriculture food technology
Dropbox Q2 2025 Financial Results & Investor Presentation
Programs and apps: productivity, graphics, security and other tools
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Encapsulation_ Review paper, used for researhc scholars
Network Security Unit 5.pdf for BCA BBA.
A comparative analysis of optical character recognition models for extracting...
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Digital-Transformation-Roadmap-for-Companies.pptx
The AUB Centre for AI in Media Proposal.docx
Assigned Numbers - 2025 - Bluetooth® Document
Building Integrated photovoltaic BIPV_UPV.pdf
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
A Presentation on Artificial Intelligence
Advanced methodologies resolving dimensionality complications for autism neur...
MYSQL Presentation for SQL database connectivity
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Teaching material agriculture food technology

One Port to Serve Them All - Google GCP Cloud Shell Abuse

  • 2. Agenda 2 • Cloud Shell in a glimpse • Recon • The Abuse • Impact • Mitigation
  • 3. What’s a Cloud Shell ? 3 • A web-based CLI terminal window • Preloaded with utilities such as gcloud, gsutil or other CSP-specific command-line tools • A developer-ready environment • Few Gigs of persistent disk storage (Session Life: 40 mins - 12 hrs)
  • 4. Recon - Nmap (public IP v. private IP) 4 -------------- Public IP -------------- 22/tcp open ssh OpenSSH 9.6 (protocol 2.0) 6000/tcp open ssh OpenSSH 8.9p1 Ubuntu 3ubuntu0.10 (Ubuntu Linux; protocol 2.0) -------------- Private IP ------------- 22/tcp open ssh OpenSSH 8.9p1 Ubuntu 3ubuntu0.10 (Ubuntu Linux; protocol 2.0) 900/tcp open http BaseHTTPServer 0.6 (Python 3.9.2) 922/tcp open ssh OpenSSH 8.9p1 Ubuntu 3ubuntu0.10 (Ubuntu Linux; protocol 2.0) 970/tcp open unknown 980/tcp open ssl/unknown 981/tcp open http Golang net/http server (Go-IPFS json-rpc or InfluxDB API) 3000/tcp open ppp?
  • 5. Path to Exposed Service 5
  • 6. Web Preview in GCP Cloud Shell 6 • https://8080-cs-xxxxxx-default.cs-asia-east1-jnrc.cloudshell.dev ⎻ HTTPS frendend to the HTTP backend ⎻ Not public accessible (auth needed)
  • 8. Simplified Path to Exposed Services 8
  • 10. Port Redirection 10 cidr_ssh="A.B.C.D/32" cidr_socks="A.B.C.0/28" cidr_web="0.0.0.0/0" iptables -t nat -I PREROUTING -p tcp -s $cidr_web --dport 922 -j REDIRECT --to-port 8080 iptables -t nat -I PREROUTING -p tcp -s $cidr_socks --dport 922 -j REDIRECT --to-port 1080 iptables -t nat -I PREROUTING -p tcp -s $cidr_ssh --dport 922 -j REDIRECT --to-port 22 • NAT table’s PREROUTING chain • First match wins ⎻ Insert to the top https://www.frozentux.net/iptables-tutorial/chunkyhtml/c962.html
  • 13. IAP Auth Bypass (cont.) 13 • Official URL (auth required) ⎻ https://8080-cs-xxxxx-default.cs-asia-east1-vger.cloud shell.dev • New URL (public access, over port 6000) ⎻ http://x.x.x.x.bc.googleusercontent.com:6000 ⎻ https://your.dns.domain:6000
  • 15. Impact 15 • Web Preview auth bypass ⎻ Public access without Google authentication ⎻ Malware distribution ⎻ Data exfiltration
  • 16. Impact 16 • Web Preview auth bypass ⎻ Public access without Google authentication ⎻ Malware distribution ⎻ Data exfiltration • Direct cloud shell access ⎻ By appending extra ssh pubkey to /etc/ssh/keys/authorized_keys
  • 17. Impact 17 • Web Preview auth bypass ⎻ Public access without Google authentication ⎻ Malware distribution ⎻ Data exfiltration • Direct cloud shell access ⎻ By appending extra ssh pubkey to /etc/ssh/keys/authorized_keys • (Malicious) traffic pivoting through the Google network ⎻ Access restriction bypass ⎻ Indirect access to C2 server infrastructure
  • 18. Mitigation 18 1. MFA hardening: a. TOTP (phishable!) b. Hardware security keys (✔)
  • 19. Mitigation 19 1. MFA hardening: a. TOTP (phishable!) b. Hardware security keys (✔) 2. Cloud Shell access control (at Org or OU levels)
  • 20. Mitigation 20 1. MFA hardening: a. TOTP (phishable!) b. Hardware security keys (✔) 2. Cloud Shell access control (at Org or OU levels) 3. More restricted access to current exposed open ports 22/tcp open ssh OpenSSH 9.6 (protocol 2.0) 6000/tcp open ssh OpenSSH 8.9p1 Ubuntu 3ubuntu0.10 (Ubuntu Linux; protocol 2.0)
  • 21. Mitigation 21 1. MFA hardening: a. TOTP (phishable!) b. Hardware security keys (✔) 2. Cloud Shell access control (at Org or OU levels) 3. More restricted access to current exposed open ports 4. Principle of least privilege a. IAM Policy Analyzer b. IAM Recommender
  • 22. Disclosure Timeline 22 • Apr. 23 - Disclosed abuse methodology to Google VRP ⎻ Possible disclosure date set to Aug 8 (~ 110 days) • June 21 - Ticket severity changed from S4 to S2 • July 19 - Bar of financial award not met. Will decide if a fix is required
  • 24. References 24 • https://cloud.google.com/shell • https://cloud.google.com/shell/docs/how-cloud-shell-works • https://cloud.google.com/shell/docs/resetting-cloud-shell • https://cloud.google.com/storage/docs/gcsfuse-quickstart-mount-bucket • https://cloud.google.com/policy-intelligence/docs/role-recommendations-overview • http://www.faqs.org/docs/iptables/targets.html#REDIRECTTARGET • https://www.inet.no/dante/doc/1.4.x/config/server.html