Skip to content

Computer use CLI for AI agents

13.5 KB
Raw Blame
{
    "question":  "does UIPI block SendInput and window messages from a Medium-integrity process into a High-integrity target, and are UIA reads still allowed",
    "invariant":  "Engineering Invariant #6 (UIPI)",
    "stack":  "managed (UIA reads) + raw Win32 SendInput/SendMessage/PostMessage",
    "scope":  "api-contract",
    "boundaryOrigin":  "manufactured by common.ps1 Start-MediumIntegrityProcess (DuplicateTokenEx + SetTokenInformation(TokenIntegrityLevel, S-1-16-8192) + CreateProcessAsUser), label asserted on read-back",
    "boundaryRuledOut":  [
                             "Start-Process -Verb RunAs: AAM off on this box (FilterAdministratorToken unset, RID 500 full token) so it yields High-vs-High",
                             "runas.exe /trustlevel:0x20000: restricts the token but leaves the mandatory label at S-1-16-12288"
                         ],
    "uacPolicy":  {
                      "EnableLUA":  1,
                      "FilterAdministratorToken":  "\u003cvalue not present\u003e",
                      "ConsentPromptBehaviorAdmin":  5,
                      "EnableInstallerDetection":  1,
                      "sessionIntegritySid":  "S-1-16-12288",
                      "adminApprovalModeActive":  false
                  },
    "target":  {
                   "process":  "notepad.exe",
                   "processId":  7156,
                   "integritySid":  "S-1-16-12288",
                   "windowHandle":  6948082,
                   "editChild":  {
                                     "className":  "Edit",
                                     "windowHandle":  5243138
                                 },
                   "launchedByThisProbe":  true
               },
    "arms":  [
                 {
                     "arm":  "high",
                     "workerIntegritySid":  "S-1-16-12288",
                     "workerLaunchError":  "",
                     "marker":  "HHH",
                     "parentForegroundHandoff":  "target foreground restored by parent ShowWindow(SW_MINIMIZE-\u003eSW_RESTORE) on the probe-launched window; SetForegroundWindow never called",
                     "targetStateBeforeInjection":  "U8-BASE",
                     "targetStateAfterInjection":  "HHHPU8-BASE",
                     "targetStateChanged":  true,
                     "markerPresentInTargetAfterwards":  true,
                     "observedBy":  "parent High-integrity WM_GETTEXT on the notepad Edit child, independent of SendInput return",
                     "worker":  {
                                    "arm":  "high",
                                    "processId":  7916,
                                    "addTypeCompilationAvailable":  true,
                                    "selfIntegritySid":  "S-1-16-12288",
                                    "targetIntegritySid":  "S-1-16-12288",
                                    "uiaRead":  {
                                                    "fromHandle":  "ok",
                                                    "name":  "Untitled - Notepad",
                                                    "className":  "Notepad",
                                                    "controlType":  "Window",
                                                    "ownerProcessId":  7156,
                                                    "boundingRectangle":  {
                                                                              "Left":  476,
                                                                              "Top":  100,
                                                                              "Width":  768,
                                                                              "Height":  525
                                                                          },
                                                    "rawViewNodes":  3,
                                                    "editPatterns":  [

                                                                     ],
                                                    "editValueSeenByThisProcess":  "\u003cno value/text pattern: Exception calling \"GetCurrentPattern\" with \"1\" argument(s): \"Unsupported Pattern.\"\u003e"
                                                },
                                    "wmGetTextFromWorker":  {
                                                                "returned":  "U8-BASE",
                                                                "sendMessageResult":  7,
                                                                "lastError":  0
                                                            },
                                    "foregroundOwnerAtAssert":  {
                                                                    "processId":  7156
                                                                },
                                    "foregroundAssertPre":  "ok",
                                    "sendInputEventsAccepted":  6,
                                    "sendInputLastError":  0,
                                    "sendInputStructSize":  40,
                                    "foregroundAssertPost":  "ok",
                                    "postMessageWmChar":  {
                                                              "returned":  true,
                                                              "lastError":  203
                                                          },
                                    "wmGetTextAfterFromWorker":  {
                                                                     "returned":  "HHHPU8-BASE",
                                                                     "sendMessageResult":  11,
                                                                     "lastError":  0
                                                                 },
                                    "uiaReadAfter":  {
                                                         "fromHandle":  "ok",
                                                         "name":  "Untitled - Notepad",
                                                         "className":  "Notepad",
                                                         "controlType":  "Window",
                                                         "ownerProcessId":  7156,
                                                         "boundingRectangle":  {
                                                                                   "Left":  476,
                                                                                   "Top":  100,
                                                                                   "Width":  768,
                                                                                   "Height":  525
                                                                               },
                                                         "rawViewNodes":  3,
                                                         "editPatterns":  [

                                                                          ],
                                                         "editValueSeenByThisProcess":  "\u003cno value/text pattern: Exception calling \"GetCurrentPattern\" with \"1\" argument(s): \"Unsupported Pattern.\"\u003e"
                                                     }
                                }
                 },
                 {
                     "arm":  "medium",
                     "workerIntegritySid":  "S-1-16-8192",
                     "workerLaunchError":  "",
                     "marker":  "MMM",
                     "parentForegroundHandoff":  "target foreground restored by parent ShowWindow(SW_MINIMIZE-\u003eSW_RESTORE) on the probe-launched window; SetForegroundWindow never called",
                     "targetStateBeforeInjection":  "U8-BASE",
                     "targetStateAfterInjection":  "U8-BASE",
                     "targetStateChanged":  false,
                     "markerPresentInTargetAfterwards":  false,
                     "observedBy":  "parent High-integrity WM_GETTEXT on the notepad Edit child, independent of SendInput return",
                     "worker":  {
                                    "arm":  "medium",
                                    "processId":  7508,
                                    "addTypeCompilationAvailable":  false,
                                    "addTypeCompilationError":  "A required privilege is not held by the client",
                                    "selfIntegritySid":  "S-1-16-8192",
                                    "targetIntegritySid":  "S-1-16-12288",
                                    "uiaRead":  {
                                                    "fromHandle":  "ok",
                                                    "name":  "Untitled - Notepad",
                                                    "className":  "Notepad",
                                                    "controlType":  "Window",
                                                    "ownerProcessId":  7156,
                                                    "boundingRectangle":  {
                                                                              "Left":  476,
                                                                              "Top":  100,
                                                                              "Width":  768,
                                                                              "Height":  525
                                                                          },
                                                    "rawViewNodes":  3,
                                                    "editPatterns":  [

                                                                     ],
                                                    "editValueSeenByThisProcess":  "\u003cno value/text pattern: Exception calling \"GetCurrentPattern\" with \"1\" argument(s): \"Unsupported Pattern.\"\u003e"
                                                },
                                    "wmGetTextFromWorker":  {
                                                                "returned":  "U8-BASE",
                                                                "sendMessageResult":  7,
                                                                "lastError":  0
                                                            },
                                    "foregroundOwnerAtAssert":  {
                                                                    "processId":  7156
                                                                },
                                    "foregroundAssertPre":  "ok",
                                    "sendInputEventsAccepted":  6,
                                    "sendInputLastError":  0,
                                    "sendInputStructSize":  40,
                                    "foregroundAssertPost":  "ok",
                                    "postMessageWmChar":  {
                                                              "returned":  false,
                                                              "lastError":  5
                                                          },
                                    "wmGetTextAfterFromWorker":  {
                                                                     "returned":  "U8-BASE",
                                                                     "sendMessageResult":  7,
                                                                     "lastError":  0
                                                                 },
                                    "uiaReadAfter":  {
                                                         "fromHandle":  "ok",
                                                         "name":  "Untitled - Notepad",
                                                         "className":  "Notepad",
                                                         "controlType":  "Window",
                                                         "ownerProcessId":  7156,
                                                         "boundingRectangle":  {
                                                                                   "Left":  476,
                                                                                   "Top":  100,
                                                                                   "Width":  768,
                                                                                   "Height":  525
                                                                               },
                                                         "rawViewNodes":  3,
                                                         "editPatterns":  [

                                                                          ],
                                                         "editValueSeenByThisProcess":  "\u003cno value/text pattern: Exception calling \"GetCurrentPattern\" with \"1\" argument(s): \"Unsupported Pattern.\"\u003e"
                                                     }
                                }
                 }
             ],
    "findings":  {
                     "uiaReadFromMediumAgainstHigh":  "ok",
                     "sendInputFromHighLanded":  true,
                     "sendInputFromMediumLanded":  false,
                     "sendInputReturnIsNotEvidence":  "SendInput reports the event count it accepted in both arms; only the re-read of the target distinguishes them",
                     "wmGetTextFromMediumBlocked":  false
                 }
}