Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Command-Privilege-management_test.ps1 #21477

Closed
wants to merge 5 commits into from

Conversation

AbishekPonmudi
Copy link

@AbishekPonmudi AbishekPonmudi commented Apr 16, 2024

PR Context

This pull request introduces a new feature for PowerShell, focusing on Command Privilege Management. The feature enhances security by allowing authorized users to run admin commands and access PowerShell. It functions in both admin and non-admin PowerShell environments, safeguarding against unauthorized activity by requiring credentials, including both username and password, to access PowerShell.

Script Details

The PowerShell script included in this pull request checks whether it is running with administrative privileges and prompts the user for credentials if necessary. It also sets registry values to enable command prompt and PowerShell with user authentication, ensuring a secure environment for script execution.

How It Works

  1. The script first checks if it is running with administrative privileges.
  2. If not, and if the specified choice is to apply only for admin PowerShell sessions, the script exits.
  3. The script defines variables for registry key and value names.
  4. Functions are provided to set registry values, close the PowerShell window, and prompt for credentials.
  5. When executed, the script prompts the user for credentials, allowing access only to authorized users with correct credentials.
  6. Additional operations can be performed after successful authentication.

PR Checklist

  • PR has a meaningful title
    • Implement command privilege management feature
  • Summarized changes
    • Added PowerShell script for command privilege management
  • Make sure all .ps1 files have the correct copyright header
  • This PR is ready to merge and is not Work in Progress
  • Breaking changes
    • None
  • User-facing changes
    • Not Applicable
  • Testing - New and feature
    • N/A or can only be tested interactively
  • Tooling
    • I have considered the user experience from a tooling perspective and don't believe tooling will be impacted.

You can find the original project here.

Screenshot 2024-04-16 182100
Screenshot 2024-04-16 222045
Screenshot 2024-04-16 222244

@AbishekPonmudi
Copy link
Author

Command Privilege is a security enhancement feature developed for Windows PowerShell. It grants users permission to access the PowerShell terminal while blocking unauthorized access attempts, including exploits, payload execution, reverse shells, and backdoors. With Command Privilege enabled, unauthorized attempts to gain access to PowerShell are unsuccessful.

@AbishekPonmudi
Copy link
Author

AbishekPonmudi commented Apr 16, 2024 via email

@microsoft-github-policy-service microsoft-github-policy-service bot added the Review - Needed The PR is being reviewed label Apr 24, 2024
@AbishekPonmudi
Copy link
Author

Thanks for the notification. I'll review the pull request promptly and provide feedback. If there are any outstanding issues, I'll mark it as Waiting on Author accordingly."

@SteveL-MSFT
Copy link
Member

You should publish this as a module to PSGallery. I don't think this feature as a script should be part of PowerShell

@microsoft-github-policy-service microsoft-github-policy-service bot removed the Review - Needed The PR is being reviewed label Apr 29, 2024
@SteveL-MSFT SteveL-MSFT added Review - Needed The PR is being reviewed Resolution-Declined The proposed feature is declined. labels Apr 29, 2024
Copy link
Contributor

microsoft-github-policy-service bot commented Apr 29, 2024

📣 Hey @AbishekPonmudi, how did we do? We would love to hear your feedback with the link below! 🗣️

🔗 https://aka.ms/PSRepoFeedback

@microsoft-github-policy-service microsoft-github-policy-service bot removed the Review - Needed The PR is being reviewed label Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution-Declined The proposed feature is declined.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants