พบช่องโหว่ Azure Cloud Shell ที่สามารถขโมย access token ของ tenants อื่นได้

Azure Cloud Shell เป็น interactive shell ใช้สำหรับจัดการ resources บน azure โดยจะเป็น url iframe “ux.console.azure.com” ที่ถูกฝังอยู่ใน Console azure

ทุกครั้งที่มีการเรียกใช้งาน Azure cloud shell จะมีการตรวจสอบ trustedAuthority domain ว่าตรงกับ whitelist domain หรือไม่ แต่ว่ามีหนึ่ง domain ใน whitelist ที่ยังไม่ได้ถูก register นั้นก็คือ “cloudshell-df.azurewebsites.net"

ทำให้นักวิจัยสามารถ register domain และ take over service domain แล้วสามารถ bypass การตรวจสอบ trustedAuthority domain ของ ux.console.azure.com ได้

เมื่อนักวิจัยเป็นเจ้าของ cloudshell-df.azurewebsites.net แล้ว นักวิจัยสามารถจะส่ง command อะไรไปให้ ux.console.azure.com ก็ได้ แต่ยังขาดการ authenticate จาก azure อยู่ ทำให้ command ที่ถูกส่งไปจะไม่ถูก execute

นักวิจัยจึงคิดขั้นตอนในการขโมย user access token โดยใช้ช่องโหว่ดังนี้:

  1. หลอกให้ user ที่ login console azure อยู่ คลิก link [https[:]//cloudshell-df[.]azurewebsites[.]net|about:blank]
  2. [https[:]//cloudshell-df[.]azurewebsites[.]net|about:blank] จะส่ง shell command ให้ ux.console.azure.com ไปเก็บไว้ใน browser local storage
  3. [https[:]//cloudshell-df[.]azurewebsites[.]net|about:blank] redirect ไปที่ https://portal.azure.com/#cloudshell/ ที่เป็นหน้า cloud shell ตัวจริง
  4. เมือ ux.console.azure.com ถูก load ขึ้น จะทำการ execute command ที่เคยถูกเก็บไว้ใน browser local storage
  5. shell command จะส่ง access token ของ user กลับไปที่ server ของนักวิจัย


Mitigation:

นักวิจัยได้รายงานช่องโหว่ไปยัง Microsoft Security Response Center (MSRC) และ Microsoft ได้ Deployed patch แก้ไขช่องโหว่ดังกล่าวแล้ว


ที่มา:
blog.lightspin