Support Forums

Issue executing elevated package script via Registry Run Key

Support for all customers who have purchased a PrimalScript product license. This forum does not offer a response time guarantee.
Forum rules
DO NOT POST SUBSCRIPTION NUMBERS, LICENSE KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.
User avatar
UCPocoAPocoToo
Posts: 30
Joined: Sun Mar 03, 2013 12:45 pm

Issue executing elevated package script via Registry Run Key

Postby UCPocoAPocoToo » Sat Oct 17, 2015 12:59 pm

Software: 64 bit PrimalScript 2015 version 7.1.67.0 installed on windows 8.1 X64.

Target OS: Windows 10 X64.

Hi,

I came across an odd issue using PrimalScript 2015 Ver 7.1.67.0 on Windows 10 X64 bit OS. As an example, I compiled the below VBscript as a WSH X64 in script packager (last selectable option in script packager). When I run the compiled exe, it does not create the Registry Key “My_Test_Key”.
I then went back into script packager and change the manifest from “embed a default manifest” to “embed a default manifest for elevation”. Now, when I double click the compiled exe, the Registry key, “My_Test_Key” is added to the registry. So far so good.

Now, when point the compiled exe from the registry runKey (HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run) It does not execute the script after a reboot. If I revert the manifest to “embed a default manifest” the compiled script launches from the registry RunKey BUT does not add the “My_Test_Key”.

I need for the compiled exe to run form the runkey and add the registry key “My_Test_Key”. I spent almost two days and can’t figure this out. ANY help of suggestion will be grateful.
Thanks in advance.

VBScript Code
Double-click the code block to select all.
Const HKEY_LOCAL_MACHINE = &H80000002
Const HKEY_CURRENT_USER = &H80000001

Wscript.echo "Start"
Set objNetwork = CreateObject("WScript.Network")
strComputer = objNetwork.ComputerName
Set oReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")


Test = "SOFTWARE\My_Test_Key"
oReg.CreateKey HKEY_LOCAL_MACHINE, Test

Wscript.echo "Done"
User avatar
SAPIEN Support Forums
Posts: 945
Joined: Wed Dec 03, 2014 2:26 pm

Issue executing elevated package script via Registry Run Key

Postby SAPIEN Support Forums » Sat Oct 17, 2015 12:59 pm

This is an automated post. A real person will respond soon.

Thank you for posting, UCPocoAPocoToo.

Did you remember to include the following?
    1. Product, version and build (e.g. Product: PrimalScript 2014, Version & Build: 7.0.46. Version and build information can be found in the product's About box accessed by clicking the blue icon with the 'i' in the upper right hand corner of the ribbon.)
    2. Specify if you are running a 32 or 64 bit version
    3. Specify your operating system and if it is 32 or 64 bit.
    4. Attach a screenshot if your issue can be seen on the screen
    5. Attach a zip file if you have multiple files (crash reports, log entries, etc.) related to your issue.

If not, please take a moment to edit your original post or reply to this one.

*** Make sure you do not post any licensing information ***
User avatar
Alexander Riedel
Posts: 5791
Joined: Tue May 29, 2007 4:43 pm

Re: Issue executing elevated package script via Registry Run

Postby Alexander Riedel » Sat Oct 17, 2015 1:47 pm

This really has nothing to do with PrimalScript. The "Run" registry key simply does not use the "RunAs" verb when executing the process. Hence no elevation. A process requiring elevation will simply not run, as you experienced.
All this is part of the UAC (User Access Control) and is a security measure. Imagine if someone could schedule an elevated process to run each time a machine starts without your knowledge....

You can try this: http://wiredhut.blogspot.com/2012/03/startup-program-with-admin-privileges.html
Alexander Riedel
SAPIEN Technologies, Inc.
User avatar
UCPocoAPocoToo
Posts: 30
Joined: Sun Mar 03, 2013 12:45 pm

Re: Issue executing elevated package script via Registry Run

Postby UCPocoAPocoToo » Sat Oct 17, 2015 4:48 pm

In windows 7x32, 7x64 and 8.1 x64 I was able to run any compiled script with "default manifest" via the run key, which works without issues. Unfortunately I cannot do the same with windows 10 X64.

I have UAC turned off to the lowest settings(never notify) but this does not seem to work.

Do you know of a way to lower the security(like 7x32,7x64 and 8.1 x64) to be able to run compiled scripts via the run key in windows 10?
User avatar
Alexander Riedel
Posts: 5791
Joined: Tue May 29, 2007 4:43 pm

Re: Issue executing elevated package script via Registry Run

Postby Alexander Riedel » Sat Oct 17, 2015 5:47 pm

No, sorry.
Just to make sure that this is understood: This has nothing to do with packaged scripts or PrimalScript. This is a Windows question. It affects every process or executable. I think a Microsoft forum dedicated to Windows 10 might be a better place to ask.
Alexander Riedel
SAPIEN Technologies, Inc.
User avatar
UCPocoAPocoToo
Posts: 30
Joined: Sun Mar 03, 2013 12:45 pm

Re: Issue executing elevated package script via Registry Run

Postby UCPocoAPocoToo » Sat Oct 17, 2015 6:13 pm

Totally agree. This has nothing to do with PrimalScript Packager. This is a windows 10 X64 bit security issue. Just thought that development might have seen the security issue and have a fix or a workaround.

Perhaps an option to run with "highest privileges" like schedule task might be a good feature to add.

P.S. when executing from the Runonce key with elevated manifest, it work's, but not via the Run key.
User avatar
UCPocoAPocoToo
Posts: 30
Joined: Sun Mar 03, 2013 12:45 pm

Re: Issue executing elevated package script via Registry Run

Postby UCPocoAPocoToo » Sun Oct 18, 2015 3:55 pm

Well, As I look more into this, there is an issue. When I compile using script packager with or without elevated manifest, it extract my entire code in clear text under c:\temp like FC00B.vbs before running it. I though it was executed in memory. This definitely need to be fixed.
User avatar
Alexander Riedel
Posts: 5791
Joined: Tue May 29, 2007 4:43 pm

Re: Issue executing elevated package script via Registry Run

Postby Alexander Riedel » Sun Oct 18, 2015 5:53 pm

That depends on what script engine you choose for packaging.
This has been out there for a while....
https://www.sapien.com/blog/2010/01/19/how-safe-are-my-scripts-in-primalscriptprimalforms-packages/
Alexander Riedel
SAPIEN Technologies, Inc.

Return to “PrimalScript”

Who is online

Users browsing this forum: No registered users and 2 guests