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

Msi file creates item to registry with wrong path, if run in sandboxie. #2798

Open
RisingYoung-Learn opened this issue Apr 7, 2023 · 7 comments
Labels
Box: Green Application compartment sandboxes More info needed More information is needed to move forward Priority: High To be done as soon as possible ToDo To be done Type: Registry operations Windows Registry

Comments

@RisingYoung-Learn
Copy link

RisingYoung-Learn commented Apr 7, 2023

Describe what you noticed and did

I made a TestService.msi installer (download address: https://github.com/RisingYoung-Learn/TestShare/blob/main/TestService.msi) writing items to registry with path as below:

HKEY_CURRENT_USER\Software\ABC\Test1
HKEY_LOCAL_MACHINE\Software\ABC\Test2

(1) When I ran TestService.msi out of sandboxie, items were written in the registry as follow:

HKEY_CURRENT_USER\Software\ABC\Test1
HKEY_LOCAL_MACHINE\Software\ABC\Test2

(2) Ran TestService.msi in the sandboxie, items were written in the registry is as follows:

HKEY_USERS\Sandbox_Administrator_DefaultBox\user\.DEFAULT\Software\ABC\Test1
HKEY_USERS\Sandbox_Administrator_DefaultBox\machine\software\ABC\Test2

According to the conversion rules, right items paths should be as follows:

HKEY_USERS\Sandbox_Administrator_DefaultBox\user\current\Software\ABC\Test1
HKEY_USERS\Sandbox_Administrator_DefaultBox\machine\software\ABC\Test2

Advanced Installer msi code:
https://github.com/RisingYoung-Learn/TestShare/blob/main/TestService.aip

How often did you encounter it so far?

Appears every time you use.

Affected program

Not relevant

Download link

https://github.com/RisingYoung-Learn/TestShare/blob/main/TestService.msi

Where is the program located?

The program is installed only inside a sandbox (NOT in the real system anyway).

Expected behavior

According to the conversion rules, right items paths should be as follows:

HKEY_USERS\Sandbox_Administrator_DefaultBox\user\current\Software\ABC\Test1
HKEY_USERS\Sandbox_Administrator_DefaultBox\machine\software\ABC\Test2

What is your Windows edition and version?

Windows Server 2016 Standard [Version 1607 (OS Build 14393.5006)]

In which Windows account you have this problem?

A local or Microsoft account without special changes.

Please mention any installed security software

Windows Defender

What version of Sandboxie are you running?

Sandboxie plus 1.8.3 64

Is it a new installation of Sandboxie?

I recently did a new clean installation.

Is it a regression?

No response

In which sandbox type you have this problem?

In an Application Compartment sandbox with no isolation (green sandbox icon).

Can you reproduce this problem on a new empty sandbox?

I can confirm it also on a new empty sandbox.

Did you previously enable some security policy settings outside Sandboxie?

No response

Crash dump

No response

Trace log

No response

Sandboxie.ini configuration

#
# Sandboxie configuration file
#

[GlobalSettings]
DefaultBox=DefaultBox
FileRootPath=\??\%SystemDrive%\Sandbox\%USER%\%SANDBOX%
KeyRootPath=\REGISTRY\USER\Sandbox_%USER%_%SANDBOX%
IpcRootPath=\Sandbox\%USER%\%SANDBOX%\Session_%SESSION%
#Template=WindowsRasMan
#Template=WindowsLive
#Template=OfficeLicensing
#Template=OfficeClickToRun
#Template=AdobeLicensing
#Template=7zipShellEx
Template=WindowsRasMan
Template=WindowsLive
Template=OfficeLicensing
Template=AdobeLicensing
Template=7zipShellEx

[UserSettings_4BC00582]
SbieCtrl_AutoStartAgent=SandMan.exe
SbieCtrl_EnableAutoStart=y

[DefaultBox]
Enabled=y
BlockNetworkFiles=y
BorderColor=#00FFFF,ttl
Template=OpenProtectedStorage
Template=RpcPortBindingsExt
Template=OpenBluetooth
Template=SkipHook
Template=FileCopy
Template=qWave
Template=BlockPorts
Template=LingerPrograms
Template=AutoRecoverIgnore
ConfigLevel=10
#UseFileDeleteV2=y
#UseRegDeleteV2=y
BoxNameTitle=n
BlockNetParam=n
NotifyProcessAccessDenied=y
CopyLimitKb=-1
MsiInstallerExemptions=y
UnrestrictedSCM=y
RunServicesAsSystem=y
ExposeBoxedSystem=y
StripSystemPrivileges=n
OpenDevCMApi=y
OpenSamEndpoint=y
OpenLsaEndpoint=y
DontOpenForBoxed=n
ClosedFilePath=<BlockNetDevices>,InternetAccessDevices
RpcMgmtSetComTimeout=n
AlwaysCloseForBoxed=n
@RisingYoung-Learn RisingYoung-Learn added the Confirmation pending Further confirmation is requested label Apr 7, 2023
@isaak654
Copy link
Collaborator

isaak654 commented Apr 7, 2023

#2373 (comment)

@isaak654 isaak654 added Duplicate This issue or pull request already exists Not a bug Not a Sandboxie bug Type: Registry operations Windows Registry and removed Confirmation pending Further confirmation is requested labels Apr 7, 2023
@RisingYoung-Learn
Copy link
Author

RisingYoung-Learn commented Apr 9, 2023

#2373 (comment)

Hello! I have read #2373 and I understand the registry isolation feature.
Now the problem is after registry isolation, the path in RegHive file is wrong.

Wrong path:

HKEY_USERS\Sandbox_Administrator_DefaultBox\user\.DEFAULT\Software\ABC\Test1
HKEY_USERS\Sandbox_Administrator_DefaultBox\machine\software\ABC\Test2

Right path:

HKEY_USERS\Sandbox_Administrator_DefaultBox\user\current\Software\ABC\Test1
HKEY_USERS\Sandbox_Administrator_DefaultBox\machine\software\ABC\Test2

@RisingYoung-Learn
Copy link
Author

I suspect this is an error when the msi installs the app in the sandboxie.

@DavidXanatos
Copy link
Member

DavidXanatos commented Apr 9, 2023

Well HKEY_USERS\.DEFAULT corresponds to \REGISTRY\USER\.DEFAULT its a reg hive of its own and not related to HKEY_CURRENT_USER so putting .DEFAULT stuff to HKEY_USERS\Sandbox_Administrator_DefaultBox\user\current\ would be wrong as well.
Sandboxie maps the .DEFAULT path under its user path, as long as the mapping works its not relevant where the key physically resides.
Or am I missing some faulty edge case?

@RisingYoung-Learn
Copy link
Author

Sorry, I didn't express clearly.

Run TestService.msi outside Sandboxie (PS: not run in Sandboxie, run directly on the operating system), the registry path written is:
HKEY_CURRENT_USER\Software\ABC\Test1
HKEY_LOCAL_MACHINE\Software\ABC\Test2

According to the Sandboxie registry isolation function, when running TestService.msi in Sandboxie, the registry path written should be:
HKEY_USERS\Sandbox_Administrator_DefaultBox\user\current\Software\ABC\Test1
HKEY_USERS\Sandbox_Administrator_DefaultBox\machine\software\ABC\Test2

However, running TestService.msi in Sandboxie 1.8.2, the registry path actually written is:
HKEY_USERS\Sandbox_Administrator_DefaultBox\user\.DEFAULT\Software\ABC\Test1
HKEY_USERS\Sandbox_Administrator_DefaultBox\machine\software\ABC\Test2

So, I don't think there should be a .DEFAULT item.

@DavidXanatos
Copy link
Member

I see Will check this out, asap, this indeed does not look right on a first glace

@isaak654 isaak654 added Priority: High To be done as soon as possible and removed Duplicate This issue or pull request already exists Not a bug Not a Sandboxie bug labels Apr 22, 2023
@DavidXanatos
Copy link
Member

Sorry for taking so long to check this out, when testing with 1.10.x and your msi file i get the result as expected
HKEY_USERS\Sandbox_DefaultBox\user\current\Software\ABC\Test1
HKEY_USERS\Sandbox_DefaultBox\machine\software\ABC\Test2

could you please re test if the issue is still present.

@DavidXanatos DavidXanatos added the More info needed More information is needed to move forward label Jul 21, 2023
@DavidXanatos DavidXanatos added the ToDo To be done label Aug 11, 2023
@bastik-1001 bastik-1001 added the Box: Green Application compartment sandboxes label Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Box: Green Application compartment sandboxes More info needed More information is needed to move forward Priority: High To be done as soon as possible ToDo To be done Type: Registry operations Windows Registry
Projects
None yet
Development

No branches or pull requests

4 participants