tokenpriv | simple script to check the privileges | Security Testing library

 by   stark0de Python Version: Current License: No License

kandi X-RAY | tokenpriv Summary

kandi X-RAY | tokenpriv Summary

tokenpriv is a Python library typically used in Testing, Security Testing applications. tokenpriv has no bugs, it has no vulnerabilities, it has build file available and it has low support. You can download it from GitHub.

This is a simple Python script to check if the privileges included in your access tokens can be used to perform privilege escalation. Or execute in cmd the compiled version.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              tokenpriv has a low active ecosystem.
              It has 5 star(s) with 2 fork(s). There are 2 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              tokenpriv has no issues reported. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of tokenpriv is current.

            kandi-Quality Quality

              tokenpriv has no bugs reported.

            kandi-Security Security

              tokenpriv has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.

            kandi-License License

              tokenpriv does not have a standard license declared.
              Check the repository for any license declaration and review the terms closely.
              OutlinedDot
              Without a license, all rights are reserved, and you cannot use the library in your applications.

            kandi-Reuse Reuse

              tokenpriv releases are not available. You will need to build from source code and install.
              Build file is available. You can build the component from source.

            Top functions reviewed by kandi - BETA

            kandi has reviewed tokenpriv and discovered the below as its top functions. This is intended to give you an instant insight into tokenpriv implemented functionality, and help decide if they suit your requirements.
            • Check vulnerabilities
            • List all available privileges
            • Check if user is an admin
            • Quits the program
            • Prints information about the current user
            Get all kandi verified functions for this library.

            tokenpriv Key Features

            No Key Features are available at this moment for tokenpriv.

            tokenpriv Examples and Code Snippets

            No Code Snippets are available at this moment for tokenpriv.

            Community Discussions

            QUESTION

            c++ Injector runs but is not injecting DLL
            Asked 2018-Aug-19 at 17:38

            I am using visual studios 2017 on windows 10 and I wrote a c++ program to open a handle to a process. The program runs and opens the process. I ran the program in the debugger and it looks like all the functions passed. However I know the DLL is not injecting because when I run this application on a 32 bit game. I can delete the test.dll I used which means it is not being used. Any suggestions on why this runs fine but is not injecting?

            PS remThread is value 0x0000011c

            ...

            ANSWER

            Answered 2018-Aug-19 at 07:35

            Um, I think the test in getProc should be:

            Source https://stackoverflow.com/questions/51913476

            QUESTION

            Impersonate Access Token with Backup And Restore Privilege for Copying File Across Domain
            Asked 2018-May-08 at 16:08
            • Computer A is on Domain A
            • Computer B is on Domain B
            • Domain A and Domain B have a trust allowing Accounts to connect to the other domain's computers
            • Account A is Admin on Computer A and has Backup&Restore Privileges
            • Account B is Admin on Computer B and has Backup&Restore Privileges
            • Account A IS NOT Admin on Computer B and does not have Backup&Restore Privileges
            • Account B IS NOT Admin on Computer A and does not have Backup&Restore Privileges

            A person owns both Account A and Account B.
            They want to copy a file from Computer A to Computer B.
            They wish to copy this file from and into a folder they do not have permissions for. Therefore, they must both enable Backup&Restore Privileges on their Access Token they got from LogonUser

            It is not allowed to change the DACL to grant these permissions on any folders or files and instead both Account A and Account B must enable B&R privileges which is recognized by the Computer, only then will they be able to copy the file without Access Denied.

            The problem is I have tried using NETWORK, INTERACTIVE, and NEW_CREDENTIALS Access Tokens and enabling privileges on them, but only NETWORK contains the privileges and they are already enabled by default. Then when I try to WindowsIdentity.Impersonate the NETWORK token and then call "CreateFile" to open the file with privileges, it fails and returns an invalid file handle of -1. I can use INTERACTIVE to read an unrestricted file but it didn't have Access Token Privileges needed ( SeBackupPrivilege & SeRestorePrivilege ) when it was returned from LogonUser. I assume once Impersonate happens it generates a Token that "might" have those privileges, but I assume that's based on the machine the code is running on.

            Is there a way to Impersonate Access Token -> Enable Access Token B&R Privileges on the remote computers they would have normally when at that machine running as administrator which could be enabled.

            OR

            Is there a way to use the NETWORK Token with Impersonation to successfully copy the file from Computer on Domain A to Computer on Domain B. If I run the program as Account B who isn't admin trying to impersonate Account A with network credential, it appears to not work on impersonation

            Below is demo code in a Console Application that emulates the situation. You must change parts of it to test it accordingly: You must create the file paths and the file to be read. You must edit permissions on "DENYTHEIMPERSONATINGUSERHERE" folder so the impersonating user account is denied and must use privileges. You must enter an actual account credentials to get an AccessToken.

            ...

            ANSWER

            Answered 2018-May-08 at 16:08

            So after much research it turns out this is locked down in Windows. Unless the current process token has SeTcbPrivilege (Act as Part of Operating System) and it's enabled, you cannot get an unrestricted/elevated token when deciding to impersonate from a non-elevated token.

            Also if you then try to get the LinkedToken/Unrestricted Token of an Access Token but do not have the SeTcbPrivilege enabled, you will end up with a Token that has a SECURITY_IMPERSONATION_LEVEL of SecurityIdentification which cannot be used for impersonation. Without SECURITY_IMPERSONATION_LEVEL being SecurityImpersonation (Local Access) or SecurityDelegation (Local+Remote Access), you cannot impersonate the Unrestricted Access Token and will result in failure with LastError being ERROR_BAD_IMPERSONATION_LEVEL (Either a required impersonation level was not provided, or the provided impersonation level is invalid).

            This means if you do not have SeTcbPrivilege and it is not enable on the token, it is required to have an elevated process token (ex. Run As Admin was used to start the program manually or forcefully via requestedExecutionLevel level="requireAdministrator") then Windows will not strip the privileges on Access Token when you decide to impersonate the Access Token.

            By using a local administrator account that runs the program as administrator, and then using domain account credentials that are an admin on another machine to get an access token using the params of LOGON32_LOGONTYPE.LOGON32_LOGON_NEW_CREDENTIALS and LOGON32_LOGONPROVIDER.LOGON32_PROVIDER_WINNT50. It is then possible to elevate privileges on the NEWCRED token, impersonate the NEWCRED token which will not strip away the privileges, and have it successfully connect to another computer and read from a file and write to a file on another computer to which it has no permissions or is even explicitly denied, proving it was using the token backup and restore privileges!

            Helpful Sources:

            Source https://stackoverflow.com/questions/50143818

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install tokenpriv

            You can download it from GitHub.
            You can use tokenpriv like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/stark0de/tokenpriv.git

          • CLI

            gh repo clone stark0de/tokenpriv

          • sshUrl

            git@github.com:stark0de/tokenpriv.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Explore Related Topics

            Consider Popular Security Testing Libraries

            PayloadsAllTheThings

            by swisskyrepo

            sqlmap

            by sqlmapproject

            h4cker

            by The-Art-of-Hacking

            vuls

            by future-architect

            PowerSploit

            by PowerShellMafia

            Try Top Libraries by stark0de

            nginxpwner

            by stark0dePython

            taller-bugbounty-honeysec

            by stark0dePython