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

Problems with file operations in a sandboxed location that does not have an assigned drive letter #3811

Open
offhub opened this issue Apr 12, 2024 · 3 comments
Labels
Black box Encrypted sandboxes Issue reproduced Issue reproduced without uncertainties ToDo To be done

Comments

@offhub
Copy link
Collaborator

offhub commented Apr 12, 2024

Describe what you noticed and did

  1. Create two sandboxes.
    1. RamBox (or BlackBox)
    2. YellowBox
  2. Create a file in the RamBox.
  3. Try to modify/delete/rename this file using YellowBox.
  4. If the ram disk is not assigned a drive letter, the file cannot be modified/deleted/renamed.

Warning

Do not use outside of a virtual machine!

SAVE IT AS TEST.BAT AND RUN IT FROM THE SANDBOXIE FOLDER
@echo off

set sbiePath=%~dp0
set ramDiskLetter=R:\
set ramBox=RamBox3811
set yellowBox=YellowBox3811
set sandboxRoot=C:\Sandbox\%username%
set testFile=C:\1.txt
set testFile2=C:\2.txt
set testFile3=C:\3.txt
set boxedTestFile=%sandboxRoot%\%ramBox%\drive\C\1.txt
set boxedTestFile2=%sandboxRoot%\%ramBox%\drive\C\2.txt
set boxedTestFile3=%sandboxRoot%\%ramBox%\drive\C\3.txt

cls

cd /d "%SbiePath%"

Start.exe /unmount_all

:: force remove imdisks
imdisk -D -m R:\
if not %errorlevel% == 0 (
	for /f %%i in ('"imdisk -l -n"') do (
		imdisk -D -u %%i
	)
)

cls

:: WITHOUT DRIVE LETTER
SbieIni.exe set GlobalSettings RamDiskLetter ""
Start.exe /reload
timeout 1 >nul

SbieIni.exe set %ramBox% Enabled y
timeout 1 >nul
SbieIni.exe set %ramBox% UseRamDisk y
timeout 1 >nul
SbieIni.exe set %ramBox% UseFileDeleteV2 y
timeout 1 >nul
SbieIni.exe set %ramBox% UseRegDeleteV2 y
echo Please wait...
start "" Start.exe /box:%ramBox% cmd.exe /c "title "%ramBox%" & echo %ramBox% file without letter > "%testFile%" & echo %ramBox% file without letter > "%testFile2%" & echo %ramBox% file without letter > "%testFile3%""
timeout 1 >nul

SbieIni.exe set %yellowBox% Enabled y
timeout 1 >nul
SbieIni.exe set %yellowBox% UseRamDisk n
timeout 1 >nul
SbieIni.exe set %yellowBox% UseFileDeleteV2 y
timeout 1 >nul
SbieIni.exe set %yellowBox% UseRegDeleteV2 y
cls & echo Press any key to change the file & pause >nul
start "" Start.exe /box:%yellowBox% cmd.exe /k "title "%yellowBox% - RamDisk without letter" & echo %yellowBox% file without letter>> "%boxedTestFile%""
cls & echo Press any key to delete the file & pause >nul
start "" Start.exe /box:%yellowBox% cmd.exe /k "title "%yellowBox% - RamDisk without letter" & del "%boxedTestFile2%""
cls & echo Press any key to rename the file & pause >nul
start "" Start.exe /box:%yellowBox% cmd.exe /k "title "%yellowBox% - RamDisk without letter" & ren "%boxedTestFile3%" "renamed.txt_""
timeout 1 >nul

echo Press any key to delete boxes & pause >nul & cls

Start.exe /box:%ramBox% /terminate
timeout 1 >nul
rmdir /s /q "%sandboxRoot%\%ramBox%"
SbieIni.exe set %ramBox% * ""

Start.exe /box:%yellowBox% /terminate
timeout 1 >nul
rmdir /s /q "%sandboxRoot%\%yellowBox%"
SbieIni.exe set %yellowBox% * ""

echo Press any key to countinue & pause >nul && cls

Start.exe /unmount_all

:: force remove imdisks
imdisk -D -m R:\
if not %errorlevel% == 0 (
	for /f %%i in ('"imdisk -l -n"') do (
		imdisk -D -u %%i
	)
)

cls

:: WITH DRIVE LETTER
SbieIni.exe set GlobalSettings RamDiskLetter %ramDiskLetter%
Start.exe /reload
timeout 1 >nul

SbieIni.exe set %ramBox% Enabled y
timeout 1 >nul
SbieIni.exe set %ramBox% UseRamDisk y
timeout 1 >nul
SbieIni.exe set %ramBox% UseFileDeleteV2 y
timeout 1 >nul
SbieIni.exe set %ramBox% UseRegDeleteV2 y
echo Please wait...
start "" Start.exe /box:%ramBox% cmd.exe /c "title "%ramBox%" & echo %ramBox% file without letter > "%testFile%" & echo %ramBox% file without letter > "%testFile2%" & echo %ramBox% file without letter > "%testFile3%""
timeout 1 >nul

SbieIni.exe set %yellowBox% Enabled y
timeout 1 >nul
SbieIni.exe set %yellowBox% UseRamDisk n
timeout 1 >nul
SbieIni.exe set %yellowBox% UseFileDeleteV2 y
timeout 1 >nul
SbieIni.exe set %yellowBox% UseRegDeleteV2 y
cls & echo Press any key to change the file & pause >nul
start "" Start.exe /box:%yellowBox% cmd.exe /k "title "%yellowBox% - RamDisk with letter" & echo %yellowBox% file without letter>> "%boxedTestFile%""
cls & echo Press any key to delete the file & pause >nul
start "" Start.exe /box:%yellowBox% cmd.exe /k "title "%yellowBox% - RamDisk with letter" & del "%boxedTestFile2%""
cls & echo Press any key to rename the file & pause >nul
start "" Start.exe /box:%yellowBox% cmd.exe /k "title "%yellowBox% - RamDisk with letter" & ren "%boxedTestFile3%" "renamed.txt_""
timeout 1 >nul

echo Press any key to delete boxes & pause >nul & cls

Start.exe /box:%ramBox% /terminate
timeout 1 >nul
rmdir /s /q "%sandboxRoot%\%ramBox%"
SbieIni.exe set %ramBox% * ""

Start.exe /box:%yellowBox% /terminate
timeout 1 >nul
rmdir /s /q "%sandboxRoot%\%yellowBox%"
SbieIni.exe set %yellowBox% * ""

echo Press any key to countinue & pause >nul && cls && exit /b

Warning

Do not use outside of a virtual machine!

How often did you encounter it so far?

Every time

Expected behavior

It should behave like a disk with a drive letter assigned to it.

Affected program

CMD, msedge, firefox, etc.

Download link

Not relevant

Where is the program located?

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

Did the program or any related process close unexpectedly?

No, not at all.

Crash dump

No response

What version of Sandboxie are you running now?

Sandboxie-Plus 1.13.5 64-bit

Is it a new installation of Sandboxie?

I recently did a new clean installation.

Is it a regression from previous versions?

No response

In which sandbox type you have this problem?

In an encrypted sandbox (black sandbox icon).

Can you reproduce this problem on a new empty sandbox?

Not relevant to my request.

What is your Windows edition and version?

Windows 10 Pro 22H2 64-bit (19045.4291)

In which Windows account you have this problem?

A local account (Administrator)., A Microsoft account (Administrator)., An account with UAC protection set to Always notify.

Please mention any installed security software

Microsoft Windows Defender

Did you previously enable some security policy settings outside Sandboxie?

No response

Trace log

No response

Sandboxie.ini configuration

[GlobalSettings]


[RamBox3811]
Enabled=y
ConfigLevel=10
UseRamDisk=y
UseFileDeleteV2=y
UseRegDeleteV2=y


[YellowBox3811]
Enabled=y
ConfigLevel=10
UseRamDisk=n
UseFileDeleteV2=y
UseRegDeleteV2=y


###

[GlobalSettings]
RamDiskLetter=R:\

[RamBox3811]
Enabled=y
ConfigLevel=10
UseRamDisk=y
UseFileDeleteV2=y
UseRegDeleteV2=y


[YellowBox3811]
Enabled=y
ConfigLevel=10
UseRamDisk=n
UseFileDeleteV2=y
UseRegDeleteV2=y
@offhub offhub added Confirmation pending Further confirmation is requested Black box Encrypted sandboxes labels Apr 12, 2024
@DavidXanatos DavidXanatos added Issue reproduced Issue reproduced without uncertainties and removed Confirmation pending Further confirmation is requested labels Apr 13, 2024
@DavidXanatos
Copy link
Member

aaaa.... I can reproduce it but why would anyone ever want to do that boxes should not access other boxes root folders.
That will be fun to fix LOL

@offhub
Copy link
Collaborator Author

offhub commented Apr 14, 2024

When applications are configured to run in different sandboxes, direct data transfer between boxes may sometimes be required. (especially for large files)

@DavidXanatos
Copy link
Member

hmm... well for that I would recommend using a shared open file location, but I see the usefulness,
the problem is that with a ram disk we don't have the ability to query the mount manager.
I'll put that on my todo as it certainly is an issue that needs solving, I suspect with VeraCrypt volumes we may also encounter similar problems, although they are always mounted to drive letters.

@DavidXanatos DavidXanatos added the ToDo To be done label Apr 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Black box Encrypted sandboxes Issue reproduced Issue reproduced without uncertainties ToDo To be done
Projects
None yet
Development

No branches or pull requests

2 participants