@bo-agent/sandbox-windows-acl 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/.tsbuildinfo +1 -0
- package/lib/acl.d.ts +83 -0
- package/lib/acl.d.ts.map +1 -0
- package/lib/acl.js +255 -0
- package/lib/acl.js.map +1 -0
- package/lib/errors.d.ts +15 -0
- package/lib/errors.d.ts.map +1 -0
- package/lib/errors.js +20 -0
- package/lib/errors.js.map +1 -0
- package/lib/ffi.d.ts +252 -0
- package/lib/ffi.d.ts.map +1 -0
- package/lib/ffi.js +382 -0
- package/lib/ffi.js.map +1 -0
- package/lib/grant.d.ts +60 -0
- package/lib/grant.d.ts.map +1 -0
- package/lib/grant.js +102 -0
- package/lib/grant.js.map +1 -0
- package/lib/index.d.ts +168 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +349 -0
- package/lib/index.js.map +1 -0
- package/lib/invariant.d.ts +15 -0
- package/lib/invariant.d.ts.map +1 -0
- package/lib/invariant.js +17 -0
- package/lib/invariant.js.map +1 -0
- package/lib/path-boundary.d.ts +20 -0
- package/lib/path-boundary.d.ts.map +1 -0
- package/lib/path-boundary.js +37 -0
- package/lib/path-boundary.js.map +1 -0
- package/lib/runner.d.ts +47 -0
- package/lib/runner.d.ts.map +1 -0
- package/lib/runner.js +222 -0
- package/lib/runner.js.map +1 -0
- package/lib/spawn.d.ts +103 -0
- package/lib/spawn.d.ts.map +1 -0
- package/lib/spawn.js +307 -0
- package/lib/spawn.js.map +1 -0
- package/lib/token.d.ts +91 -0
- package/lib/token.d.ts.map +1 -0
- package/lib/token.js +200 -0
- package/lib/token.js.map +1 -0
- package/lib/win32-abi.d.ts +178 -0
- package/lib/win32-abi.d.ts.map +1 -0
- package/lib/win32-abi.js +230 -0
- package/lib/win32-abi.js.map +1 -0
- package/lib/workspace-sid.d.ts +41 -0
- package/lib/workspace-sid.d.ts.map +1 -0
- package/lib/workspace-sid.js +52 -0
- package/lib/workspace-sid.js.map +1 -0
- package/package.json +33 -0
package/lib/spawn.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spawn.js","sourceRoot":"","sources":["../src/spawn.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,WAAW,EAAE,SAAS,EAAE,iBAAiB,EAAE,YAAY,EAAE,iBAAiB,EAAE,SAAS,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAE9L,OAAO,KAAK,GAAG,MAAM,gBAAgB,CAAA;AAErC;;;;;;;;;GASG;AACH,MAAM,UAAU,QAAQ,CAAC,QAAgB;IACvC,IAAI,QAAQ,KAAK,EAAE;QAAE,OAAO,IAAI,CAAA;IAChC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC;QAAE,OAAO,QAAQ,CAAA;IAC7C,IAAI,MAAM,GAAG,GAAG,CAAA;IAChB,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;QACrD,IAAI,WAAW,GAAG,CAAC,CAAA;QACnB,OAAO,KAAK,GAAG,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC;YAClE,WAAW,EAAE,CAAA;YACb,KAAK,EAAE,CAAA;QACT,CAAC;QACD,IAAI,KAAK,KAAK,QAAQ,CAAC,MAAM,EAAE,CAAC;YAC9B,yEAAyE;YACzE,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC,WAAW,GAAG,CAAC,CAAC,CAAA;QACxC,CAAC;aAAM,IAAI,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,GAAG,EAAE,CAAC;YAC1C,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC,WAAW,GAAG,CAAC,G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AS,GAAG,GAAG,CAAC,YAAY,EAAE,CAAA;QACpC,GAAG,CAAC,WAAW,CAAC,YAAY,CAAC,CAAA;QAC7B,GAAG,CAAC,WAAW,CAAC,aAAa,CAAC,CAAA;QAC9B,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,CAAA;QACpB,UAAU,CAAC,GAAG,EAAE,cAAc,EAAE,SAAS,EAAE,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC,CAAA;IACvE,CAAC;IACD,GAAG,CAAC,WAAW,CAAC,YAAY,CAAC,CAAA;IAE7B,OAAO,EAAE,GAAG,EAAE,IAAI,CAAC,WAAW,EAAE,OAAO,EAAE,aAAa,EAAE,GAAG,EAAE,CAAA;AAC/D,CAAC"}
|
package/lib/token.d.ts
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Restricted-token construction: open the current process token, extract its
|
|
3
|
+
* logon SID, build the well-known SIDs, and call CreateRestrictedToken with
|
|
4
|
+
* the POC's restricting-SID allowlist. Every API call is checked; any failure
|
|
5
|
+
* throws with the API name and the exact Win32 code — the original POC ignored
|
|
6
|
+
* all of these and silently ran children with the FULL, unrestricted token.
|
|
7
|
+
* @module @bo-agent/sandbox-windows-acl/token
|
|
8
|
+
*/
|
|
9
|
+
import type { NativePtr, Win32Bindings } from './ffi.ts';
|
|
10
|
+
/**
|
|
11
|
+
* Open the current process's access token with the rights
|
|
12
|
+
* CreateRestrictedToken requires (the POC's OpenProcessToken call; the token
|
|
13
|
+
* handle is obtained through a real OpenProcess handle because the
|
|
14
|
+
* GetCurrentProcess() pseudo-handle is not addressable through koffi).
|
|
15
|
+
* @param api - the binding table.
|
|
16
|
+
* @returns the opened token handle.
|
|
17
|
+
*/
|
|
18
|
+
export declare function openCurrentProcessToken(api: Win32Bindings): NativePtr;
|
|
19
|
+
/**
|
|
20
|
+
* Find and copy the token's logon session SID (S-1-5-5-x-y, attribute
|
|
21
|
+
* SE_GROUP_LOGON_ID). The restricted token needs it for WinSta0/desktop and
|
|
22
|
+
* other per-logon objects; the POC extracts it the same way.
|
|
23
|
+
* @param api - the binding table.
|
|
24
|
+
* @param token - the token whose groups are scanned.
|
|
25
|
+
* @returns a copied logon SID (thrown when the token carries none).
|
|
26
|
+
*/
|
|
27
|
+
export declare function findLogonSid(api: Win32Bindings, token: NativePtr): NativePtr;
|
|
28
|
+
/**
|
|
29
|
+
* Create one well-known SID (68-byte buffer) and assert its validity.
|
|
30
|
+
* @param api - the binding table.
|
|
31
|
+
* @param type - the WELL_KNOWN_SID_TYPE to create.
|
|
32
|
+
* @returns the created SID pointer.
|
|
33
|
+
*/
|
|
34
|
+
export declare function makeWellKnownSid(api: Win32Bindings, type: number): NativePtr;
|
|
35
|
+
/**
|
|
36
|
+
* Merge one full-access allow ACE for `sidPtr` into the token's DEFAULT DACL
|
|
37
|
+
* — the DACL every NEW object the token holder creates (without an explicit
|
|
38
|
+
* security descriptor) takes. The restricted token inherits the user's
|
|
39
|
+
* default DACL verbatim, which names no restricting SID: a new anonymous pipe
|
|
40
|
+
* (child stdio) therefore fails the write pass-2 check at creation
|
|
41
|
+
* (ERROR_ACCESS_DENIED; Node surfaces it as spawn EPERM), breaking every
|
|
42
|
+
* piped-stdio grandchild spawn. The merged ACE names a RESTRICTING SID (the
|
|
43
|
+
* write SID under workspace-write, Everyone under read-only), so each new
|
|
44
|
+
* object's own DACL passes pass-2 while object creation itself stays gated by
|
|
45
|
+
* the parent container's DACL (files outside the granted trees remain
|
|
46
|
+
* uncreatable). Fails closed: any Win32 failure throws before the spawn.
|
|
47
|
+
* @param api - the binding table.
|
|
48
|
+
* @param token - the restricted token to adjust (requires TOKEN_ADJUST_DEFAULT).
|
|
49
|
+
* @param sidPtr - the restricting SID whose full-access ACE joins the default DACL.
|
|
50
|
+
*/
|
|
51
|
+
export declare function setTokenDefaultDaclGrant(api: Win32Bindings, token: NativePtr, sidPtr: NativePtr): void;
|
|
52
|
+
/** The well-known SID packed into every restricted token's restricting list. */
|
|
53
|
+
export interface RestrictingSidSet {
|
|
54
|
+
world: NativePtr;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Create the write-restricted token with the mode-selected restricting list
|
|
58
|
+
* (verified on Win11 26200, see the POC-worktree restrict-variant harness):
|
|
59
|
+
* - read-only: [logon SID, EVERYONE]
|
|
60
|
+
* - workspace-write: [logon SID, EVERYONE, workspace SID, optional temp SID]
|
|
61
|
+
*
|
|
62
|
+
* The logon SID + EVERYONE keep-alive group is shared by both modes: early
|
|
63
|
+
* DLL init dies with 0xC0000142 and CNG (`\Device\CNG` write trustee —
|
|
64
|
+
* pwsh crashes 0xE0434352) fails without them. The write SIDs join ONLY
|
|
65
|
+
* workspace-write — read-only carries no write SID, so a standing grant ACE
|
|
66
|
+
* from an earlier workspace-write period (a `/permission` mode downgrade, or
|
|
67
|
+
* a crash-resumed session) stays INERT under read-only: the WRITE_RESTRICTED
|
|
68
|
+
* pass-2 check grants only what the restricting list carries, keeping that
|
|
69
|
+
* workspace grant inert under read-only while the unrevoked ACE keeps the
|
|
70
|
+
* re-upgrade free (the grant's exact-ACE skip — no re-propagation).
|
|
71
|
+
* Everyone's own ambient grants remain the documented partial boundary.
|
|
72
|
+
* Authenticated Users is absent from BOTH lists: the WMI
|
|
73
|
+
* namespace security check fails (0x80041003), so CIM is unavailable in
|
|
74
|
+
* every confined mode, and the C:\-root tree-creation escape (standing
|
|
75
|
+
* `AU:(AD)` + `AU:(OI)(CI)(IO)(M)` ACEs) is closed in both — documented in
|
|
76
|
+
* README. INTERACTIVE/LOCAL are absent from BOTH lists too — the host's
|
|
77
|
+
* Public tree grants write to INTERACTIVE, so removing it closes that
|
|
78
|
+
* escape. S-1-2-1 (console logon) is intentionally absent: see win32-abi.ts
|
|
79
|
+
* for the verified failure modes. FAILS CLOSED: any failure throws — never
|
|
80
|
+
* spawn unrestricted.
|
|
81
|
+
* @param api - the binding table.
|
|
82
|
+
* @param currentToken - the process token to restrict.
|
|
83
|
+
* @param logonSid - the copied logon session SID.
|
|
84
|
+
* @param writeSids - the distinct write SIDs forming the workspace and
|
|
85
|
+
* optional temp allowlists (workspace-write only; empty under read-only).
|
|
86
|
+
* @param known - the well-known SIDs entering the restricting list.
|
|
87
|
+
* @param mode - selects the restricting list (workspace-write adds the capability SIDs).
|
|
88
|
+
* @returns the restricted token handle.
|
|
89
|
+
*/
|
|
90
|
+
export declare function createRestrictedToken(api: Win32Bindings, currentToken: NativePtr, logonSid: NativePtr, writeSids: readonly NativePtr[], known: RestrictingSidSet, mode: 'read-only' | 'workspace-write'): NativePtr;
|
|
91
|
+
//# sourceMappingURL=token.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token.d.ts","sourceRoot":"","sources":["../src/token.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAIxD;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,aAAa,GAAG,SAAS,CAmBrE;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,aAAa,EAAE,KAAK,EAAE,SAAS,GAAG,SAAS,CAyB5E;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS,CAS5E;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,aAAa,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,GAAG,IAAI,CAiCtG;AAWD,gFAAgF;AAChF,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,SAAS,CAAA;CACjB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,aAAa,EAClB,YAAY,EAAE,SAAS,EACvB,QAAQ,EAAE,SAAS,EACnB,SAAS,EAAE,SAAS,SAAS,EAAE,EAC/B,KAAK,EAAE,iBAAiB,EACxB,IAAI,EAAE,WAAW,GAAG,iBAAiB,GACpC,SAAS,CAoBX"}
|
package/lib/token.js
ADDED
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Restricted-token construction: open the current process token, extract its
|
|
3
|
+
* logon SID, build the well-known SIDs, and call CreateRestrictedToken with
|
|
4
|
+
* the POC's restricting-SID allowlist. Every API call is checked; any failure
|
|
5
|
+
* throws with the API name and the exact Win32 code — the original POC ignored
|
|
6
|
+
* all of these and silently ran children with the FULL, unrestricted token.
|
|
7
|
+
* @module @bo-agent/sandbox-windows-acl/token
|
|
8
|
+
*/
|
|
9
|
+
import { allocBytes, allocPtrSlot, allocUint32, decodePtr, decodePtrAt, decodeUint32, encodeUint32, isNullPtr, ptrAddress, throwLastError, throwWin32 } from "./ffi.js";
|
|
10
|
+
import { buildExplicitAccess } from "./acl.js";
|
|
11
|
+
import * as abi from "./win32-abi.js";
|
|
12
|
+
/**
|
|
13
|
+
* Open the current process's access token with the rights
|
|
14
|
+
* CreateRestrictedToken requires (the POC's OpenProcessToken call; the token
|
|
15
|
+
* handle is obtained through a real OpenProcess handle because the
|
|
16
|
+
* GetCurrentProcess() pseudo-handle is not addressable through koffi).
|
|
17
|
+
* @param api - the binding table.
|
|
18
|
+
* @returns the opened token handle.
|
|
19
|
+
*/
|
|
20
|
+
export function openCurrentProcessToken(api) {
|
|
21
|
+
const processHandle = api.openProcess(abi.PROCESS_QUERY_INFORMATION, 0, process.pid);
|
|
22
|
+
if (isNullPtr(processHandle))
|
|
23
|
+
throwLastError(api, 'OpenProcess', `pid ${process.pid}`);
|
|
24
|
+
const tokenSlot = allocPtrSlot();
|
|
25
|
+
const opened = api.openProcessToken(processHandle, abi.TOKEN_QUERY | abi.TOKEN_DUPLICATE | abi.TOKEN_ADJUST_DEFAULT | abi.TOKEN_ASSIGN_PRIMARY, tokenSlot);
|
|
26
|
+
if (opened === 0) {
|
|
27
|
+
const win32Code = api.getLastError();
|
|
28
|
+
api.closeHandle(processHandle); // best-effort on the error path
|
|
29
|
+
throwWin32(api, 'OpenProcessToken', win32Code, `pid ${process.pid}`);
|
|
30
|
+
}
|
|
31
|
+
if (api.closeHandle(processHandle) === 0)
|
|
32
|
+
throwLastError(api, 'CloseHandle', 'OpenProcess process handle');
|
|
33
|
+
const token = decodePtr(tokenSlot);
|
|
34
|
+
if (token === null)
|
|
35
|
+
throwWin32(api, 'OpenProcessToken', api.getLastError(), 'null token handle');
|
|
36
|
+
return token;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Find and copy the token's logon session SID (S-1-5-5-x-y, attribute
|
|
40
|
+
* SE_GROUP_LOGON_ID). The restricted token needs it for WinSta0/desktop and
|
|
41
|
+
* other per-logon objects; the POC extracts it the same way.
|
|
42
|
+
* @param api - the binding table.
|
|
43
|
+
* @param token - the token whose groups are scanned.
|
|
44
|
+
* @returns a copied logon SID (thrown when the token carries none).
|
|
45
|
+
*/
|
|
46
|
+
export function findLogonSid(api, token) {
|
|
47
|
+
const neededSlot = allocUint32();
|
|
48
|
+
api.getTokenInformation(token, abi.TokenGroups, null, 0, neededSlot); // expected to fail with ERROR_INSUFFICIENT_BUFFER
|
|
49
|
+
const needed = decodeUint32(neededSlot);
|
|
50
|
+
if (needed === 0)
|
|
51
|
+
throwLastError(api, 'GetTokenInformation', 'TokenGroups size query');
|
|
52
|
+
if (needed < abi.TOKEN_GROUPS_OFFSET)
|
|
53
|
+
throwWin32(api, 'GetTokenInformation', api.getLastError(), `implausible TokenGroups size ${needed}`);
|
|
54
|
+
const groups = Buffer.alloc(needed);
|
|
55
|
+
if (api.getTokenInformation(token, abi.TokenGroups, groups, groups.length, neededSlot) === 0) {
|
|
56
|
+
throwLastError(api, 'GetTokenInformation', 'TokenGroups');
|
|
57
|
+
}
|
|
58
|
+
const groupCount = groups.readUInt32LE(0);
|
|
59
|
+
for (let index = 0; index < groupCount; index++) {
|
|
60
|
+
const sidPtr = decodePtrAt(groups, abi.TOKEN_GROUPS_OFFSET + index * abi.SID_AND_ATTRIBUTES_SIZE);
|
|
61
|
+
const attributes = groups.readUInt32LE(abi.TOKEN_GROUPS_OFFSET + index * abi.SID_AND_ATTRIBUTES_SIZE + 8);
|
|
62
|
+
// >>> 0: JS bitwise & is signed 32-bit; SE_GROUP_LOGON_ID has bit 31 set.
|
|
63
|
+
const isLogonId = ((attributes & abi.SE_GROUP_LOGON_ID) >>> 0) === (abi.SE_GROUP_LOGON_ID >>> 0);
|
|
64
|
+
if (sidPtr === null || !isLogonId)
|
|
65
|
+
continue;
|
|
66
|
+
const sidLength = api.getLengthSid(sidPtr);
|
|
67
|
+
if (sidLength === 0)
|
|
68
|
+
throwLastError(api, 'GetLengthSid', `logon SID group ${index}`);
|
|
69
|
+
const copy = allocBytes(sidLength);
|
|
70
|
+
if (api.copySid(sidLength, copy, sidPtr) === 0)
|
|
71
|
+
throwLastError(api, 'CopySid', `logon SID group ${index}`);
|
|
72
|
+
return copy;
|
|
73
|
+
}
|
|
74
|
+
throw new Error(`CreateRestrictedToken prerequisite failed: no logon SID found among ${groupCount} token groups`);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Create one well-known SID (68-byte buffer) and assert its validity.
|
|
78
|
+
* @param api - the binding table.
|
|
79
|
+
* @param type - the WELL_KNOWN_SID_TYPE to create.
|
|
80
|
+
* @returns the created SID pointer.
|
|
81
|
+
*/
|
|
82
|
+
export function makeWellKnownSid(api, type) {
|
|
83
|
+
const sid = allocBytes(abi.SECURITY_MAX_SID_SIZE);
|
|
84
|
+
const sizeSlot = allocUint32();
|
|
85
|
+
encodeUint32(sizeSlot, abi.SECURITY_MAX_SID_SIZE);
|
|
86
|
+
if (api.createWellKnownSid(type, null, sid, sizeSlot) === 0) {
|
|
87
|
+
throwLastError(api, 'CreateWellKnownSid', `type ${type}`);
|
|
88
|
+
}
|
|
89
|
+
if (api.isValidSid(sid) === 0)
|
|
90
|
+
throwLastError(api, 'IsValidSid', `CreateWellKnownSid type ${type}`);
|
|
91
|
+
return sid;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Merge one full-access allow ACE for `sidPtr` into the token's DEFAULT DACL
|
|
95
|
+
* — the DACL every NEW object the token holder creates (without an explicit
|
|
96
|
+
* security descriptor) takes. The restricted token inherits the user's
|
|
97
|
+
* default DACL verbatim, which names no restricting SID: a new anonymous pipe
|
|
98
|
+
* (child stdio) therefore fails the write pass-2 check at creation
|
|
99
|
+
* (ERROR_ACCESS_DENIED; Node surfaces it as spawn EPERM), breaking every
|
|
100
|
+
* piped-stdio grandchild spawn. The merged ACE names a RESTRICTING SID (the
|
|
101
|
+
* write SID under workspace-write, Everyone under read-only), so each new
|
|
102
|
+
* object's own DACL passes pass-2 while object creation itself stays gated by
|
|
103
|
+
* the parent container's DACL (files outside the granted trees remain
|
|
104
|
+
* uncreatable). Fails closed: any Win32 failure throws before the spawn.
|
|
105
|
+
* @param api - the binding table.
|
|
106
|
+
* @param token - the restricted token to adjust (requires TOKEN_ADJUST_DEFAULT).
|
|
107
|
+
* @param sidPtr - the restricting SID whose full-access ACE joins the default DACL.
|
|
108
|
+
*/
|
|
109
|
+
export function setTokenDefaultDaclGrant(api, token, sidPtr) {
|
|
110
|
+
const neededSlot = allocUint32();
|
|
111
|
+
api.getTokenInformation(token, abi.TokenDefaultDacl, null, 0, neededSlot); // expected to fail with ERROR_INSUFFICIENT_BUFFER
|
|
112
|
+
const needed = decodeUint32(neededSlot);
|
|
113
|
+
if (needed === 0)
|
|
114
|
+
throwLastError(api, 'GetTokenInformation', 'TokenDefaultDacl size query');
|
|
115
|
+
const buffer = Buffer.alloc(needed);
|
|
116
|
+
if (api.getTokenInformation(token, abi.TokenDefaultDacl, buffer, buffer.length, neededSlot) === 0) {
|
|
117
|
+
throwLastError(api, 'GetTokenInformation', 'TokenDefaultDacl');
|
|
118
|
+
}
|
|
119
|
+
const currentDacl = decodePtrAt(buffer, 0);
|
|
120
|
+
if (currentDacl === null) {
|
|
121
|
+
throw new Error('setTokenDefaultDaclGrant: the token carries no default DACL to extend');
|
|
122
|
+
}
|
|
123
|
+
const newDaclSlot = allocPtrSlot();
|
|
124
|
+
const result = api.setEntriesInAclW(1, buildExplicitAccess(sidPtr, abi.GRANT_ACCESS, abi.FILE_ALL_ACCESS), currentDacl, newDaclSlot);
|
|
125
|
+
if (result !== abi.ERROR_SUCCESS)
|
|
126
|
+
throwWin32(api, 'SetEntriesInAclW', result, 'default DACL merge');
|
|
127
|
+
const newDacl = decodePtr(newDaclSlot);
|
|
128
|
+
if (newDacl === null)
|
|
129
|
+
throwWin32(api, 'SetEntriesInAclW', result, 'null merged default DACL');
|
|
130
|
+
// TOKEN_DEFAULT_DACL { PACL DefaultDacl; } — the struct is exactly the
|
|
131
|
+
// pointer; SetTokenInformation copies the ACL before returning.
|
|
132
|
+
const info = Buffer.alloc(8);
|
|
133
|
+
info.writeBigUInt64LE(newDacl, 0);
|
|
134
|
+
if (api.setTokenInformation(token, abi.TokenDefaultDacl, info, info.length) === 0) {
|
|
135
|
+
const win32Code = api.getLastError();
|
|
136
|
+
api.localFree(newDacl);
|
|
137
|
+
throwWin32(api, 'SetTokenInformation', win32Code, 'TokenDefaultDacl');
|
|
138
|
+
}
|
|
139
|
+
api.localFree(newDacl);
|
|
140
|
+
}
|
|
141
|
+
/** Pack `SID_AND_ATTRIBUTES[count]` (16-byte stride; Attributes stay 0). */
|
|
142
|
+
function buildRestrictingSids(sids) {
|
|
143
|
+
const buffer = Buffer.alloc(abi.SID_AND_ATTRIBUTES_SIZE * sids.length);
|
|
144
|
+
sids.forEach((sid, index) => {
|
|
145
|
+
buffer.writeBigUInt64LE(ptrAddress(sid), abi.SID_AND_ATTRIBUTES_SIZE * index);
|
|
146
|
+
});
|
|
147
|
+
return buffer;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Create the write-restricted token with the mode-selected restricting list
|
|
151
|
+
* (verified on Win11 26200, see the POC-worktree restrict-variant harness):
|
|
152
|
+
* - read-only: [logon SID, EVERYONE]
|
|
153
|
+
* - workspace-write: [logon SID, EVERYONE, workspace SID, optional temp SID]
|
|
154
|
+
*
|
|
155
|
+
* The logon SID + EVERYONE keep-alive group is shared by both modes: early
|
|
156
|
+
* DLL init dies with 0xC0000142 and CNG (`\Device\CNG` write trustee —
|
|
157
|
+
* pwsh crashes 0xE0434352) fails without them. The write SIDs join ONLY
|
|
158
|
+
* workspace-write — read-only carries no write SID, so a standing grant ACE
|
|
159
|
+
* from an earlier workspace-write period (a `/permission` mode downgrade, or
|
|
160
|
+
* a crash-resumed session) stays INERT under read-only: the WRITE_RESTRICTED
|
|
161
|
+
* pass-2 check grants only what the restricting list carries, keeping that
|
|
162
|
+
* workspace grant inert under read-only while the unrevoked ACE keeps the
|
|
163
|
+
* re-upgrade free (the grant's exact-ACE skip — no re-propagation).
|
|
164
|
+
* Everyone's own ambient grants remain the documented partial boundary.
|
|
165
|
+
* Authenticated Users is absent from BOTH lists: the WMI
|
|
166
|
+
* namespace security check fails (0x80041003), so CIM is unavailable in
|
|
167
|
+
* every confined mode, and the C:\-root tree-creation escape (standing
|
|
168
|
+
* `AU:(AD)` + `AU:(OI)(CI)(IO)(M)` ACEs) is closed in both — documented in
|
|
169
|
+
* README. INTERACTIVE/LOCAL are absent from BOTH lists too — the host's
|
|
170
|
+
* Public tree grants write to INTERACTIVE, so removing it closes that
|
|
171
|
+
* escape. S-1-2-1 (console logon) is intentionally absent: see win32-abi.ts
|
|
172
|
+
* for the verified failure modes. FAILS CLOSED: any failure throws — never
|
|
173
|
+
* spawn unrestricted.
|
|
174
|
+
* @param api - the binding table.
|
|
175
|
+
* @param currentToken - the process token to restrict.
|
|
176
|
+
* @param logonSid - the copied logon session SID.
|
|
177
|
+
* @param writeSids - the distinct write SIDs forming the workspace and
|
|
178
|
+
* optional temp allowlists (workspace-write only; empty under read-only).
|
|
179
|
+
* @param known - the well-known SIDs entering the restricting list.
|
|
180
|
+
* @param mode - selects the restricting list (workspace-write adds the capability SIDs).
|
|
181
|
+
* @returns the restricted token handle.
|
|
182
|
+
*/
|
|
183
|
+
export function createRestrictedToken(api, currentToken, logonSid, writeSids, known, mode) {
|
|
184
|
+
const restrictingSids = buildRestrictingSids(mode === 'read-only'
|
|
185
|
+
? [logonSid, known.world]
|
|
186
|
+
: writeSids.length === 0
|
|
187
|
+
? (() => { throw new Error('createRestrictedToken: workspace-write restricting list requires at least one write SID'); })()
|
|
188
|
+
: [logonSid, known.world, ...writeSids]);
|
|
189
|
+
const tokenSlot = allocPtrSlot();
|
|
190
|
+
const created = api.createRestrictedToken(currentToken, abi.DISABLE_MAX_PRIVILEGE | abi.LUA_TOKEN | abi.WRITE_RESTRICTED, 0, null, // no SIDs disabled
|
|
191
|
+
0, null, // no privileges deleted
|
|
192
|
+
restrictingSids.length / abi.SID_AND_ATTRIBUTES_SIZE, restrictingSids, tokenSlot);
|
|
193
|
+
if (created === 0)
|
|
194
|
+
throwLastError(api, 'CreateRestrictedToken', `restricting SIDs: ${restrictingSids.length / abi.SID_AND_ATTRIBUTES_SIZE}`);
|
|
195
|
+
const token = decodePtr(tokenSlot);
|
|
196
|
+
if (token === null)
|
|
197
|
+
throwWin32(api, 'CreateRestrictedToken', api.getLastError(), 'null token handle');
|
|
198
|
+
return token;
|
|
199
|
+
}
|
|
200
|
+
//# sourceMappingURL=token.js.map
|
package/lib/token.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token.js","sourceRoot":"","sources":["../src/token.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAEvK,OAAO,EAAE,mBAAmB,EA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
|
|
4
|
+
* Every value was verified against the actual MinGW Windows headers on this
|
|
5
|
+
* machine (C:\Strawberry\c\x86_64-w64-mingw32\include\) and cross-checked at
|
|
6
|
+
* runtime by verify/abi-probe.cpp (same numbers; static_asserts passed).
|
|
7
|
+
* Regenerate the probe with:
|
|
8
|
+
* g++ -std=c++20 -municode -O2 -o abi-probe.exe abi-probe.cpp -ladvapi32 && .\abi-probe.exe
|
|
9
|
+
*
|
|
10
|
+
* The port intentionally excludes two pieces of the original POC
|
|
11
|
+
* (github.com/huoyaoyuan/windows-acl-restrict-poc @ 10e4dfb), both verified
|
|
12
|
+
* empirically on Windows 11 build 26200:
|
|
13
|
+
* - S-1-2-1 (console logon SID) in the restricting list: the POC created it
|
|
14
|
+
* via CreateWellKnownSid(WinLocalLogonSid) which fails here with
|
|
15
|
+
* ERROR_INVALID_PARAMETER (87), leaving a garbage SID that makes
|
|
16
|
+
* CreateRestrictedToken fail with ERROR_INVALID_SID (1337); using the
|
|
17
|
+
* correct WinConsoleLogonSid does produce a valid S-1-2-1, but the child
|
|
18
|
+
* then still dies with STATUS_DLL_INIT_FAILED (0xC0000142) whenever
|
|
19
|
+
* CREATE_NO_WINDOW / CREATE_NEW_CONSOLE is used.
|
|
20
|
+
* - Console isolation: under this restriction scheme a hidden console is not
|
|
21
|
+
* attainable, so children share the host console (stdio redirection is
|
|
22
|
+
* pipe-based and unaffected).
|
|
23
|
+
* @module @bo-agent/sandbox-windows-acl/win32-abi
|
|
24
|
+
*/
|
|
25
|
+
/** TOKEN_ASSIGN_PRIMARY: required to create a process with the token (CreateProcessAsUser). */
|
|
26
|
+
export declare const TOKEN_ASSIGN_PRIMARY = 1;
|
|
27
|
+
/** TOKEN_DUPLICATE: required to duplicate a token (DuplicateTokenEx). */
|
|
28
|
+
export declare const TOKEN_DUPLICATE = 2;
|
|
29
|
+
/** TOKEN_QUERY: required to read token information (GetTokenInformation). */
|
|
30
|
+
export declare const TOKEN_QUERY = 8;
|
|
31
|
+
/** TOKEN_ADJUST_DEFAULT: required to change a token's default DACL. */
|
|
32
|
+
export declare const TOKEN_ADJUST_DEFAULT = 128;
|
|
33
|
+
/**
|
|
34
|
+
* SE_GROUP_LOGON_ID: marks a token group SID as the logon SID (compared with
|
|
35
|
+
* `>>> 0` — the flag's high bit makes it negative as a signed 32-bit number).
|
|
36
|
+
*/
|
|
37
|
+
export declare const SE_GROUP_LOGON_ID = 3221225472;
|
|
38
|
+
/** STANDARD_RIGHTS_WRITE (== READ_CONTROL): the standard-rights component of generic write access. */
|
|
39
|
+
export declare const STANDARD_RIGHTS_WRITE = 131072;
|
|
40
|
+
/** FILE_GENERIC_WRITE: every file-write permission bit plus SYNCHRONIZE. */
|
|
41
|
+
export declare const FILE_GENERIC_WRITE = 1179926;
|
|
42
|
+
/** DELETE: remove or rename the object (winnt.h line ~3009). */
|
|
43
|
+
export declare const DELETE = 65536;
|
|
44
|
+
/** FILE_DELETE_CHILD: remove or rename a directory's children (winnt.h line ~5907). */
|
|
45
|
+
export declare const FILE_DELETE_CHILD = 64;
|
|
46
|
+
/**
|
|
47
|
+
* GRANT_MASK: FILE_GENERIC_WRITE minus READ_CONTROL plus DELETE and
|
|
48
|
+
* FILE_DELETE_CHILD — the write+delete access mask the capability-SID ACEs grant
|
|
49
|
+
* (displays as "Modify" in Explorer/icacls). WRITE_DAC/WRITE_OWNER are
|
|
50
|
+
* deliberately excluded: they would let the confined child take ownership or
|
|
51
|
+
* rewrite DACLs.
|
|
52
|
+
*/
|
|
53
|
+
export declare const GRANT_MASK: number;
|
|
54
|
+
/**
|
|
55
|
+
* FILE_ALL_ACCESS (winnt.h line ~2789: STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE
|
|
56
|
+
* | 0x1FF): full file-object access. The mask of the ACE merged into the
|
|
57
|
+
* restricted token's DEFAULT DACL — the token holder must keep full access to
|
|
58
|
+
* every NEW object it creates (pipes included), and the ACE must name a
|
|
59
|
+
* restricting SID so the write pass-2 check passes at creation.
|
|
60
|
+
*/
|
|
61
|
+
export declare const FILE_ALL_ACCESS = 2032127;
|
|
62
|
+
/** DISABLE_MAX_PRIVILEGE: strip the token's maximum-privilege elevation so the confined child cannot escalate. */
|
|
63
|
+
export declare const DISABLE_MAX_PRIVILEGE = 1;
|
|
64
|
+
/** LUA_TOKEN: produce a limited-user (filtered admin) token. */
|
|
65
|
+
export declare const LUA_TOKEN = 4;
|
|
66
|
+
/** WRITE_RESTRICTED: intersect write access with the restricting SIDs' ACL grants — the sandbox's core mechanism. */
|
|
67
|
+
export declare const WRITE_RESTRICTED = 8;
|
|
68
|
+
/** WinWorldSid: S-1-1-0 (Everyone) — the only well-known SID the restricted tokens use (keep-alive group; see token.ts). */
|
|
69
|
+
export declare const WinWorldSid = 1;
|
|
70
|
+
/** TokenGroups: GetTokenInformation class returning the token's group SIDs. */
|
|
71
|
+
export declare const TokenGroups = 2;
|
|
72
|
+
/** TokenDefaultDacl: the token's default DACL — the DACL every NEW object created without an explicit SD takes. */
|
|
73
|
+
export declare const TokenDefaultDacl = 6;
|
|
74
|
+
/** DACL_SECURITY_INFORMATION: read/write only the DACL of a security descriptor. */
|
|
75
|
+
export declare const DACL_SECURITY_INFORMATION = 4;
|
|
76
|
+
/** PROCESS_QUERY_INFORMATION: read exit status and times of a process handle. */
|
|
77
|
+
export declare const PROCESS_QUERY_INFORMATION = 1024;
|
|
78
|
+
/** SE_FILE_OBJECT: the trustee path names a filesystem object. */
|
|
79
|
+
export declare const SE_FILE_OBJECT = 1;
|
|
80
|
+
/** TRUSTEE_IS_UNKNOWN: TRUSTEE_TYPE unknown (TrusteeForm carries the shape). */
|
|
81
|
+
export declare const TRUSTEE_IS_UNKNOWN = 0;
|
|
82
|
+
/** TRUSTEE_IS_SID: TRUSTEE_FORM — Trustee.ptstrName is a SID pointer. */
|
|
83
|
+
export declare const TRUSTEE_IS_SID = 0;
|
|
84
|
+
/** NO_MULTIPLE_TRUSTEE: Trustee.pMultipleTrustee is null. */
|
|
85
|
+
export declare const NO_MULTIPLE_TRUSTEE = 0;
|
|
86
|
+
/** GRANT_ACCESS: SetEntriesInAclW adds the entry as an allow ACE. */
|
|
87
|
+
export declare const GRANT_ACCESS = 1;
|
|
88
|
+
/** REVOKE_ACCESS: SetEntriesInAclW removes the matching allow ACE. */
|
|
89
|
+
export declare const REVOKE_ACCESS = 4;
|
|
90
|
+
/**
|
|
91
|
+
* SUB_CONTAINERS_AND_OBJECTS_INHERIT: the ACE applies to the directory, its
|
|
92
|
+
* subdirectories, and files (OBJECT_INHERIT_ACE | CONTAINER_INHERIT_ACE).
|
|
93
|
+
*/
|
|
94
|
+
export declare const SUB_CONTAINERS_AND_OBJECTS_INHERIT = 3;
|
|
95
|
+
/**
|
|
96
|
+
* STARTF_USESTDHANDLES: STARTUPINFOW dwFlags — the child uses the hStd*
|
|
97
|
+
* handles, required because Node clears stdio inheritability at startup.
|
|
98
|
+
*/
|
|
99
|
+
export declare const STARTF_USESTDHANDLES = 256;
|
|
100
|
+
/** HANDLE_FLAG_INHERIT: SetHandleInformation flag re-enabling handle inheritance for the spawned child's stdio handles. */
|
|
101
|
+
export declare const HANDLE_FLAG_INHERIT = 1;
|
|
102
|
+
/** INFINITE: never-timeout wait value. */
|
|
103
|
+
export declare const INFINITE = 4294967295;
|
|
104
|
+
/** MAX_PATH: legacy path length bound. */
|
|
105
|
+
export declare const MAX_PATH = 260;
|
|
106
|
+
/** CREATE_SUSPENDED: create the child with its primary thread suspended until ResumeThread. */
|
|
107
|
+
export declare const CREATE_SUSPENDED = 4;
|
|
108
|
+
/** STD_INPUT_HANDLE: GetStdHandle selector for the standard input. */
|
|
109
|
+
export declare const STD_INPUT_HANDLE = -10;
|
|
110
|
+
/** STD_OUTPUT_HANDLE: GetStdHandle selector for the standard output. */
|
|
111
|
+
export declare const STD_OUTPUT_HANDLE = -11;
|
|
112
|
+
/** STD_ERROR_HANDLE: GetStdHandle selector for the standard error. */
|
|
113
|
+
export declare const STD_ERROR_HANDLE = -12;
|
|
114
|
+
/** FORMAT_MESSAGE_FROM_SYSTEM: format the message from the system message table. */
|
|
115
|
+
export declare const FORMAT_MESSAGE_FROM_SYSTEM = 4096;
|
|
116
|
+
/** FORMAT_MESSAGE_IGNORE_INSERTS: skip insert-sequence substitution. */
|
|
117
|
+
export declare const FORMAT_MESSAGE_IGNORE_INSERTS = 512;
|
|
118
|
+
/** ERROR_SUCCESS: the operation succeeded. */
|
|
119
|
+
export declare const ERROR_SUCCESS = 0;
|
|
120
|
+
/** ERROR_INSUFFICIENT_BUFFER: a size-probe call succeeded but needs a larger buffer. */
|
|
121
|
+
export declare const ERROR_INSUFFICIENT_BUFFER = 122;
|
|
122
|
+
/** ERROR_BROKEN_PIPE: the pipe's other end has closed. */
|
|
123
|
+
export declare const ERROR_BROKEN_PIPE = 109;
|
|
124
|
+
/** ERROR_NO_DATA: the pipe is being closed. */
|
|
125
|
+
export declare const ERROR_NO_DATA = 232;
|
|
126
|
+
/** ERROR_LOCK_VIOLATION: a byte-range lock conflicts with an existing lock (winerror.h line ~78). */
|
|
127
|
+
export declare const ERROR_LOCK_VIOLATION = 33;
|
|
128
|
+
/** GENERIC_READ: generic read access (winnt.h line ~3028). */
|
|
129
|
+
export declare const GENERIC_READ = 2147483648;
|
|
130
|
+
/** GENERIC_WRITE: generic write access (winnt.h line ~3029). */
|
|
131
|
+
export declare const GENERIC_WRITE = 1073741824;
|
|
132
|
+
/** FILE_SHARE_READ: other opens may read (winnt.h line ~5949). */
|
|
133
|
+
export declare const FILE_SHARE_READ = 1;
|
|
134
|
+
/** FILE_SHARE_WRITE: other opens may write (winnt.h line ~5950). */
|
|
135
|
+
export declare const FILE_SHARE_WRITE = 2;
|
|
136
|
+
/** FILE_SHARE_DELETE: other opens may delete (winnt.h line ~5951) — deliberately NOT used for lock files. */
|
|
137
|
+
export declare const FILE_SHARE_DELETE = 4;
|
|
138
|
+
/** OPEN_ALWAYS: create the lock file if absent, open it otherwise (fileapi.h line ~21). */
|
|
139
|
+
export declare const OPEN_ALWAYS = 4;
|
|
140
|
+
/** LOCKFILE_EXCLUSIVE_LOCK: request an exclusive byte-range lock. */
|
|
141
|
+
export declare const LOCKFILE_EXCLUSIVE_LOCK = 2;
|
|
142
|
+
/** LOCKFILE_FAIL_IMMEDIATELY: fail with ERROR_LOCK_VIOLATION instead of waiting. */
|
|
143
|
+
export declare const LOCKFILE_FAIL_IMMEDIATELY = 1;
|
|
144
|
+
/** ACCESS_ALLOWED_ACE_TYPE: an access-allowed ACE granting the mask to the trustee. */
|
|
145
|
+
export declare const ACCESS_ALLOWED_ACE_TYPE = 0;
|
|
146
|
+
/** SID_MAX_SUB_AUTHORITIES: the most subauthorities a SID may carry. */
|
|
147
|
+
export declare const SID_MAX_SUB_AUTHORITIES = 15;
|
|
148
|
+
/** INHERITED_ACE: the ACE was inherited from the parent object, not stored explicitly. */
|
|
149
|
+
export declare const INHERITED_ACE = 16;
|
|
150
|
+
/** JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE: the child dies when the runner's last job handle closes — the orphan-child backstop. */
|
|
151
|
+
export declare const JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE = 8192;
|
|
152
|
+
/** JobObjectExtendedLimitInformation: JOBOBJECTINFOCLASS for the extended limit structure. */
|
|
153
|
+
export declare const JobObjectExtendedLimitInformation = 9;
|
|
154
|
+
/** sizeof(JOBOBJECT_EXTENDED_LIMIT_INFORMATION), verified by abi-probe. */
|
|
155
|
+
export declare const JOBOBJECT_EXTENDED_LIMIT_SIZE = 144;
|
|
156
|
+
/**
|
|
157
|
+
* LimitFlags offset inside JOBOBJECT_EXTENDED_LIMIT_INFORMATION
|
|
158
|
+
* (BasicLimitInformation@0 + PerProcessUserTimeLimit@0 +
|
|
159
|
+
* PerJobUserTimeLimit@8), verified by abi-probe.
|
|
160
|
+
*/
|
|
161
|
+
export declare const JOBOBJECT_EXTENDED_LIMIT_FLAGS_OFFSET = 16;
|
|
162
|
+
/** SECURITY_MAX_SID_SIZE: maximum SID byte size. */
|
|
163
|
+
export declare const SECURITY_MAX_SID_SIZE = 68;
|
|
164
|
+
/** SID_AND_ATTRIBUTES stride: { PSID Sid @0 (8); DWORD Attributes @8 (4) } + pad. */
|
|
165
|
+
export declare const SID_AND_ATTRIBUTES_SIZE = 16;
|
|
166
|
+
/** TOKEN_GROUPS.Groups[] starts at offset 8 (GroupCount @0 + alignment). */
|
|
167
|
+
export declare const TOKEN_GROUPS_OFFSET = 8;
|
|
168
|
+
/** sizeof(EXPLICIT_ACCESS_W): perms@0 mode@4 inheritance@8 Trustee@16. */
|
|
169
|
+
export declare const EXPLICIT_ACCESS_W_SIZE = 48;
|
|
170
|
+
/** Trustee offset inside EXPLICIT_ACCESS_W. */
|
|
171
|
+
export declare const TRUSTEE_W_OFFSET = 16;
|
|
172
|
+
/** ptstrName offset inside TRUSTEE_W (=> 40 inside EXPLICIT_ACCESS_W). */
|
|
173
|
+
export declare const TRUSTEE_W_PTSTRNAME_OFFSET = 24;
|
|
174
|
+
/** sizeof(STARTUPINFOW), verified by abi-probe. */
|
|
175
|
+
export declare const STARTUPINFOW_SIZE = 104;
|
|
176
|
+
/** sizeof(PROCESS_INFORMATION), verified by abi-probe. */
|
|
177
|
+
export declare const PROCESS_INFORMATION_SIZE = 24;
|
|
178
|
+
//# sourceMappingURL=win32-abi.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"win32-abi.d.ts","sourceRoot":"","sources":["../src/win32-abi.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAKH,+FAA+F;AAC/F,eAAO,MAAM,oBAAoB,IAAS,CAAA;AAC1C,yEAAyE;AACzE,eAAO,MAAM,eAAe,IAAS,CAAA;AACrC,6EAA6E;AAC7E,eAAO,MAAM,WAAW,IAAS,CAAA;AACjC,uEAAuE;AACvE,eAAO,MAAM,oBAAoB,MAAS,CAAA;AAG1C;;;GAGG;AACH,eAAO,MAAM,iBAAiB,aAAa,CAAA;AAK3C,sGAA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