Trust No Program
Reply to topic
(RESOLVED)Weird writing outside the sandbox behavior
nicknomo


Joined: 02 Aug 2010
Posts: 60
Reply with quote
UPDATE: offending actions were performed via network communication between a sandboxed process and a non-sandboxed process. Obviously not a bypass of any kind then...

________________________________-
This occurs on both XP SP3 (32 bit) and Win 7 (x64). It occurs on 3.52 (win 7) and 3.46(xp).

I use the torrent tracker Vuze. I leave Vuze running for long periods of time, outside the Sandbox...

Now, lets say I download and recover a torrent file to My Documents. If I am in a sandboxed app and launch the file, or if I launch the torrent by using the Run Sandboxed feature, the torrent will start downloading in Vuze. The download is not within the sandbox, and can be written anywhere.

Not sure if this really qualifies as a bypass, but someone in another thread mentioned that ntvdm may be doing this when 16 bit applications write outside the sandbox.

If I were to do the same thing with windows media player, it would open up a new process and the new process would be sandboxed. Could this be occurring with processes that can only have a single instance? I can't launch Vuze more than once, and I know there are other programs like this. Not sure if that has anything to do with it, but it is the first thing that came to my mind.


Last edited by nicknomo on Wed Mar 02, 2011 2:26 am; edited 1 time in total
View user's profileSend private message
tzuk


Joined: 22 Jun 2004
Posts: 15004
Reply with quote
If you have Window Access settings (in Sandbox Settings), they may have an effect on this behavior.

_________________
tzuk
View user's profileSend private message
nicknomo


Joined: 02 Aug 2010
Posts: 60
Reply with quote
I just have acrobat and distiller are in there, but they were added by default (compatability template?)..

Could Vuze be watching for .torrent executions, and simply initiating the action on its own? I'm not really sure whats happening, or if it qualifies as a bypass.. but I'm definitely going from sandbox to outside the sandbox without any intervention from me.
View user's profileSend private message
Re: Weird writing outside the sandbox behavior (sorta)
ssj100


Joined: 23 Apr 2009
Posts: 843
Reply with quote
nicknomo wrote:
I use the torrent tracker Vuze. I leave Vuze running for long periods of time, outside the Sandbox...

Now, lets say I download and recover a torrent file to My Documents. If I am in a sandboxed app and launch the file, or if I launch the torrent by using the Run Sandboxed feature, the torrent will start downloading in Vuze. The download is not within the sandbox, and can be written anywhere.


Just installed Vuze in a Windows XP VM and I can reproduce the issue. It only works if Vuze is already running unsandboxed, as is your case. Seems like another one of those similar issues we've been seeing recently (eg. IDM). As mentioned in those threads, one "workaround" would be to force run Vuze sandboxed and/or never run it unsandboxed.

_________________
Sandboxie + LUA + SRP + DEP + SuRun
Windows Firewall + NAT Router + IPSec (on-demand)
VirtualBox (on-demand)
Drive SnapShot (on-demand)
View user's profileSend private message
Re: Weird writing outside the sandbox behavior (sorta)
nicknomo


Joined: 02 Aug 2010
Posts: 60
Reply with quote
ssj100 wrote:
nicknomo wrote:
I use the torrent tracker Vuze. I leave Vuze running for long periods of time, outside the Sandbox...

Now, lets say I download and recover a torrent file to My Documents. If I am in a sandboxed app and launch the file, or if I launch the torrent by using the Run Sandboxed feature, the torrent will start downloading in Vuze. The download is not within the sandbox, and can be written anywhere.


Just installed Vuze in a Windows XP VM and I can reproduce the issue. It only works if Vuze is already running unsandboxed, as is your case. Seems like another one of those similar issues we've been seeing recently (eg. IDM). As mentioned in those threads, one "workaround" would be to force run Vuze sandboxed and/or never run it unsandboxed.


Hopefully this is a case like that of the download manager, where the program outside the sandbox is just monitoring events, and then performing actions based on this monitoring. In this case, there is no real breakout - all of the offending behavior occurs outside the sandbox and there is no communication taking place.

If there is communication between a sandboxed process and an unsandboxed process, such that the sandboxed process can use something like a system process (or even user mode) to write to the drive... then we have a problem.
View user's profileSend private message
Re: Weird writing outside the sandbox behavior (sorta)
ssj100


Joined: 23 Apr 2009
Posts: 843
Reply with quote
nicknomo wrote:
Hopefully this is a case like that of the download manager, where the program outside the sandbox is just monitoring events, and then performing actions based on this monitoring. In this case, there is no real breakout - all of the offending behavior occurs outside the sandbox and there is no communication taking place.

If there is communication between a sandboxed process and an unsandboxed process, such that the sandboxed process can use something like a system process (or even user mode) to write to the drive... then we have a problem.


From my observations, I suspect the unsandboxed Vuze (which is certainly a malware threat-gate and should never be run unsandboxed from a security purist's viewpoint) monitors for torrent files. When running the torrent file with the right click "Run Sandboxed" context menu option, I can see that another Vuze process tries to open sandboxed but then shuts down spontaneously and the torrent download is taken over by the unsandboxed Vuze (presumably because only one instance of the Vuze process can be present). I can't really see any "bypass" here. The way I see it, the key problem is that Vuze is run unsandboxed to start with.

It may be worth testing this issue with other applications like (censored), DefenseWall and GeSWall to see if similar behaviour is observed. Again, the issue would only be reproduced if Vuze was running outside of the "sandbox" to start with.

With regards to your concerns of a sandboxed process potentially starting or hijacking an unsandboxed process/service (and potentially initiate malicious activity), this may be possible? The concern would be most obvious with unsandboxed processes/services which are deemed safe and/or eg. required to run Windows smoothly. However, I think that such an event would only take place if malicious code was able to get on to the system and execute in the first place. I think the attack would need to be fairly targeted and rely on certain already present "holes" in the system. Examples of such "holes" would be running in full blown Administrator mode and/or not enabling Sandboxie's Drop Rights.
View user's profileSend private message
Re: Weird writing outside the sandbox behavior (sorta)
Nicknomo_
Guest

Reply with quote
ssj100 wrote:
nicknomo wrote:
Hopefully this is a case like that of the download manager, where the program outside the sandbox is just monitoring events, and then performing actions based on this monitoring. In this case, there is no real breakout - all of the offending behavior occurs outside the sandbox and there is no communication taking place.

If there is communication between a sandboxed process and an unsandboxed process, such that the sandboxed process can use something like a system process (or even user mode) to write to the drive... then we have a problem.


From my observations, I suspect the unsandboxed Vuze (which is certainly a malware threat-gate and should never be run unsandboxed from a security purist's viewpoint) monitors for torrent files. When running the torrent file with the right click "Run Sandboxed" context menu option, I can see that another Vuze process tries to open sandboxed but then shuts down spontaneously and the torrent download is taken over by the unsandboxed Vuze (presumably because only one instance of the Vuze process can be present). I can't really see any "bypass" here. The way I see it, the key problem is that Vuze is run unsandboxed to start with.


I've tried running Vuze inside the sandbox.. but the problem really comes in with file migration. I'd prefer to normally keep this on a reasonable setting (under 1 GB), but every now and then I get a torrent that is larger than this. While I like to put every internet facing app inside the sandbox, this one is a little impractical if I wish to keep a limit on file migration.

Quote:

With regards to your concerns of a sandboxed process potentially starting or hijacking an unsandboxed process/service (and potentially initiate malicious activity), this may be possible? The concern would be most obvious with unsandboxed processes/services which are deemed safe and/or eg. required to run Windows smoothly. However, I think that such an event would only take place if malicious code was able to get on to the system and execute in the first place. I think the attack would need to be fairly targeted and rely on certain already present "holes" in the system. Examples of such "holes" would be running in full blown Administrator mode and/or not enabling Sandboxie's Drop Rights.


Well, I'd personally like confirmation that Vuze is actually trapping something, and there isn't something else going on here.

I have a lot of apps that are started outside the sandbox, and they don't necessarily have to be malicious to fall victim to malicious payloads. Macro viruses for the office platform is a good example. I actually don't run word / excel unsandboxed for this reason, but if I launched an .xls in the sandbox, I obviously would not ever want it to open in an unsandboxed windows of excel. That is sort of what happened here, and I just want to make sure that something else isn't going on here.

BTW, here is my access monitor code

Code:

(Drive)     \Device\CdRom0
(Drive)     \Device\Floppy0
(Drive)     \Device\HarddiskVolume1
(Drive)     \Device\HarddiskVolume2
(Drive)     \Device\HarddiskVolume3
(Unk)        00000002 \Device\CdRom0
(Unk)        00000002 \Device\Ide\IdeDeviceP1T0L0-5
(Unk)        00000022 \Device\SandboxieDriverApi
(Unk)        00000039 \Device\KsecDD
(Unk)        000000F1 \Device\RasAcd
Clsid       -------------------------------
File/Key    -------------------------------
Image       -------------------------------
Image       *:\program files\azureus\azureus.exe
Image       *:\program files\sandboxie\start.exe
Image       c:\program files\java\jre6\bin\client\jvm.dll
Image       c:\program files\java\jre6\bin\hpi.dll
Image       c:\program files\java\jre6\bin\java.dll
Image       c:\program files\java\jre6\bin\net.dll
Image       c:\program files\java\jre6\bin\verify.dll
Image       c:\program files\java\jre6\bin\zip.dll
Image       c:\windows\system32\advapi32.dll
Image       c:\windows\system32\apphelp.dll
Image       c:\windows\system32\clbcatq.dll
Image       c:\windows\system32\comdlg32.dll
Image       c:\windows\system32\comres.dll
Image       c:\windows\system32\dnsapi.dll
Image       c:\windows\system32\gdi32.dll
Image       c:\windows\system32\hnetcfg.dll
Image       c:\windows\system32\imm32.dll
Image       c:\windows\system32\kernel32.dll
Image       c:\windows\system32\lz32.dll
Image       c:\windows\system32\msctf.dll
Image       c:\windows\system32\msctfime.ime
Image       c:\windows\system32\mslbui.dll
Image       c:\windows\system32\msvcrt.dll
Image       c:\windows\system32\mswsock.dll
Image       c:\windows\system32\netapi32.dll
Image       c:\windows\system32\ntdll.dll
Image       c:\windows\system32\ole32.dll
Image       c:\windows\system32\oleaut32.dll
Image       c:\windows\system32\psapi.dll
Image       c:\windows\system32\rasadhlp.dll
Image       c:\windows\system32\rpcrt4.dll
Image       c:\windows\system32\rsaenh.dll
Image       c:\windows\system32\secur32.dll
Image       c:\windows\system32\setupapi.dll
Image       c:\windows\system32\shell32.dll
Image       c:\windows\system32\shimeng.dll
Image       c:\windows\system32\shlwapi.dll
Image       c:\windows\system32\user32.dll
Image       c:\windows\system32\userenv.dll
Image       c:\windows\system32\uxtheme.dll
Image       c:\windows\system32\version.dll
Image       c:\windows\system32\winmm.dll
Image       c:\windows\system32\winrnr.dll
Image       c:\windows\system32\wldap32.dll
Image       c:\windows\system32\ws2_32.dll
Image       c:\windows\system32\ws2help.dll
Image       c:\windows\system32\wshtcpip.dll
Image       c:\windows\winsxs\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.2600.6028_x-ww_61e65202\comctl32.dll
Image       d:\program files\azureus\msvcr71.dll
Image       d:\program files\sandboxie\sbiedll.dll
Image       d:\program files\sandboxie\sbiemsg.dll
Image       d:\program files\superantispyware\sasseh.dll
Ipc         -------------------------------
Ipc         \BaseNamedObjects\d:_program files_azureus_azureus.exe0
Ipc         \BaseNamedObjects\hsperfdata_nickr_8144
Ipc         \BaseNamedObjects\KAV_INPROCESS_DLL_LOADED
Ipc         \BaseNamedObjects\SBIE_DummyEvent_716
Ipc         \BaseNamedObjects\SBIE_DummyEvent_8144
Ipc         \BaseNamedObjects\SBIE_ServiceInitComplete_cryptsvc
Ipc         \BaseNamedObjects\SBIE_ServiceInitComplete_DcomLaunch
Ipc         \BaseNamedObjects\SBIE_ServiceInitComplete_RpcSs
Ipc         \BaseNamedObjects\shell.{210A4BA0-3AEA-1069-A2D9-08002B30309D}
Ipc         \BaseNamedObjects\shell.{7CB834F0-527B-11D2-9D1F-0000F805CA57}
Ipc         \BaseNamedObjects\shell.{A48F1A32-A340-11D1-BC6B-00A0C90312E1}
Ipc         \BaseNamedObjects\userenv:  User Profile setup event
Ipc      O  \BaseNamedObjects\Sandboxie_DeviceIdList
Ipc      O  \BaseNamedObjects\Sandboxie_DeviceSetupClasses
Ipc      O  \KnownDlls\advapi32.dll
Ipc      O  \KnownDlls\gdi32.dll
Ipc      O  \KnownDlls\kernel32.dll
Ipc      O  \KnownDlls\lz32.dll
Ipc      O  \KnownDlls\msvcrt.dll
Ipc      O  \KnownDlls\rpcrt4.dll
Ipc      O  \KnownDlls\Secur32.dll
Ipc      O  \KnownDlls\shell32.dll
Ipc      O  \KnownDlls\SHLWAPI.dll
Ipc      O  \KnownDlls\user32.dll
Ipc      O  \KnownDlls\USERENV.dll
Ipc      O  \KnownDlls\version.dll
Ipc      O  \KnownDlls\wldap32.dll
Ipc      O  \NLS\NlsSectionCType
Ipc      O  \NLS\NlsSectionLocale
Ipc      O  \NLS\NlsSectionSortkey
Ipc      O  \NLS\NlsSectionSortTbls
Ipc      O  \NLS\NlsSectionUnicode
Ipc      O  \RPC Control\DNSResolver
Ipc      O  \RPC Control\SbieSvcPort
Ipc      O  \Windows\ApiPort
Pipe        -------------------------------
Pipe        \Device\NamedPipe\SBIE_SXSSVC
Pipe        \Device\NamedPipe\Win32Pipes.00001fd0.00000001
Pipe        \Device\NamedPipe\Win32Pipes.00001fd0.00000002
Pipe        \Device\NamedPipe\Win32Pipes.00001fd0.00000003
Pipe     O  \Device\Afd
Pipe     O  \Device\Afd\Endpoint
Pipe     O  \Device\NamedPipe\ShimViewer
Pipe     X  \Device\NamedPipe\lsarpc
Pipe     X  \Device\NamedPipe\SBIE_SXSSVC
Pipe     X  \Device\NamedPipe\wkssvc
WinCls      -------------------------------
WinCls   X  Progman
WinCls   X  SUPERANTISPYWARE
Mike


Joined: 16 Nov 2009
Posts: 592
Reply with quote
Nicknomo_ wrote:
I've tried running Vuze inside the sandbox.. but the problem really comes in with file migration. I'd prefer to normally keep this on a reasonable setting (under 1 GB), but every now and then I get a torrent that is larger than this. While I like to put every internet facing app inside the sandbox, this one is a little impractical if I wish to keep a limit on file migration.

If you always run Vuze sandboxed, there shouldn't be a problem because all your torrents will be created inside the sandbox. There's no size limit. The file migration setting only applies to files already existing on the real system, which must be copied into the sandbox before they can be modified. You should be able to leave it around 50 MB, not 1 GB.

I think you're having file migration problems because you already started torrents on the real system. To transition to a sandbox-only workflow, use Explore Contents to move all your partially downloaded torrents into the sandbox.

For more background info, see File Migration and Guest10's recent post.

nicknomo wrote:
If I am in a sandboxed app and launch the file, or if I launch the torrent by using the Run Sandboxed feature, the torrent will start downloading in Vuze. The download is not within the sandbox, and can be written anywhere.

I tested briefly with Sandboxie 3.53.05 on Windows XP SP3. From what I saw, Vuze always opens sandboxed first, and then the unsandboxed instance picks up the download and the sandboxed instance closes. This happens pretty instantaneously, as ssj100 described.

Steps:
1. Installed and ran Vuze 4.6.0.2 unsandboxed, using all default settings.
2. Downloaded a .torrent file to the Desktop using a sandboxed Firefox.
3. Double-clicked the torrent file from a sandboxed Explorer. Or, used Run Sandboxed from the real Desktop.
4. Result: Another instance of Azureus.exe ran sandboxed. Then:
- If internet access was enabled in the sandbox settings, the unsandboxed Vuze picked up the download and the sandboxed Vuze closed.
- If internet access was disabled in the sandbox settings, nothing happened in the unsandboxed Vuze and the sandboxed Vuze took a minute or two to open.

Btw, you can confirm that a sandboxed instance always runs by excluding Azureus.exe from start/run access - you should get SBIE1308 and a corresponding Application Error, and then nothing else happens.


UPDATE: Think I found the answer. Quote from the VuzeWiki:

VuzeWiki wrote:
6880 TCP: Vuze uses this port for internal communication. When you launch Vuze, it always checks that port for an older instance of Vuze being already active. If there is an active Vuze, then the new Vuze instance passes the possible torrent name as parameter to the old instance already running and then dies. (This happens e.g. when you click a "download torrent" link on a web page. A new second Vuze instance gets launched by the browser, but it dies after passing the argument to the old Vuze.) If there was no active old Vuze, then the new Vuze reserves that TCP port and starts "listening" there.
View user's profileSend private message
Nicknomo_
Guest

Reply with quote
Mike wrote:

nicknomo wrote:
If I am in a sandboxed app and launch the file, or if I launch the torrent by using the Run Sandboxed feature, the torrent will start downloading in Vuze. The download is not within the sandbox, and can be written anywhere.

I tested briefly with Sandboxie 3.53.05 on Windows XP SP3. From what I saw, Vuze always opens sandboxed first, and then the unsandboxed instance picks up the download and the sandboxed instance closes. This happens pretty instantaneously, as ssj100 described.

Steps:
1. Installed and ran Vuze 4.6.0.2 unsandboxed, using all default settings.
2. Downloaded a .torrent file to the Desktop using a sandboxed Firefox.
3. Double-clicked the torrent file from a sandboxed Explorer. Or, used Run Sandboxed from the real Desktop.
4. Result: Another instance of Azureus.exe ran sandboxed. Then:
- If internet access was enabled in the sandbox settings, the unsandboxed Vuze picked up the download and the sandboxed Vuze closed.
- If internet access was disabled in the sandbox settings, nothing happened in the unsandboxed Vuze and the sandboxed Vuze took a minute or two to open.

Btw, you can confirm that a sandboxed instance always runs by excluding Azureus.exe from start/run access - you should get SBIE1308 and a corresponding Application Error, and then nothing else happens.


So, when internet access is disabled, did the torrent still start in the unsandboxed version? I will test this myself.

Quote:

UPDATE: Think I found the answer. Quote from the VuzeWiki:

VuzeWiki wrote:
6880 TCP: Vuze uses this port for internal communication. When you launch Vuze, it always checks that port for an older instance of Vuze being already active. If there is an active Vuze, then the new Vuze instance passes the possible torrent name as parameter to the old instance already running and then dies. (This happens e.g. when you click a "download torrent" link on a web page. A new second Vuze instance gets launched by the browser, but it dies after passing the argument to the old Vuze.) If there was no active old Vuze, then the new Vuze reserves that TCP port and starts "listening" there.


So, this is information passed over the network port? That would obviously be outside the realm of sandboxie.. However, if the parameters would be passed by the actual process (from inside sandbox to out), I would think that might be a (small) security hole.
Mike


Joined: 16 Nov 2009
Posts: 592
Reply with quote
Nicknomo_ wrote:
Mike wrote:
- If internet access was disabled in the sandbox settings, nothing happened in the unsandboxed Vuze and the sandboxed Vuze took a minute or two to open.

So, when internet access is disabled, did the torrent still start in the unsandboxed version?

Nope. For me, nothing happened.
View user's profileSend private message
nicknomo


Joined: 02 Aug 2010
Posts: 60
Reply with quote
Ok, I just tested it, and now I understand what you are saying.. This program does require network access to pass the information, which is outside the realm of sandboxie... So we can close the case on this one..

..and you were right about the file migration. It looks like when I have a large file already in progress outside of the sandbox, it craps out when I open up Vuze in the sandbox. I never quite understood what was going on there, but now its clear to me. I can safely return Vuze to the sandbox now if I kill large unfinished torrents out of the queue.

PS - thanks to everyone for the testing and the help!
View user's profileSend private message
ssj100


Joined: 23 Apr 2009
Posts: 843
Reply with quote
Just an update with other types of programs with an "unsandboxed" Vuze already running and trying to run another ("sandboxed") instance of Vuze via the right click context menu of a torrent file:
1. DefenseWall: successfully opens an "Untrusted" instance of Vuze and downloads the torrent in this "Untrusted" instance.
2. (censored): gives an error - unable to run another instance of Vuze. This appears to be purposeful.
3. GeSWall: same issue as Sandboxie - despite trying to run an isolated instance of Vuze, the torrent starts downloading in the unisolated instance.

So it appears here that DefenseWall is able to do what Sandboxie can't? Any ideas tzuk? If DefenseWall successfully runs another instance of Vuze, surely Sandboxie should be able to as well?
View user's profileSend private message
Nicknomo_
Guest

Reply with quote
Well, one defense I think would be to block sandboxed programs from communicating with the localhost/127.0.0.1 and any local address or port not opened by a sandboxed program.

Not sure what defensewall is doing though...
ssj100


Joined: 23 Apr 2009
Posts: 843
Reply with quote
I think this is a specific problem between Vuze and Sandboxie (and perhaps GeSWall also) - there should be a way to open another instance of Vuze sandboxed. Not being able to do this results in the issue above. DefenseWall shows that it's possible to open more than one instance of Vuze.

With an unsandboxed instance of Vuze open, I am unable to run another instance of Vuze sandboxed. As mentioned at least twice in this thread, Sandboxie tries to run it sandboxed but then spontaneously "gives up" and the unsandboxed instance of Vuze is called instead. This really should be looked at, in my opinion (and the current thread title should be changed).
View user's profileSend private message
Nicknomo_
Guest

Reply with quote
ssj100 wrote:
I think this is a specific problem between Vuze and Sandboxie (and perhaps GeSWall also) - there should be a way to open another instance of Vuze sandboxed. Not being able to do this results in the issue above. DefenseWall shows that it's possible to open more than one instance of Vuze.

With an unsandboxed instance of Vuze open, I am unable to run another instance of Vuze sandboxed. As mentioned at least twice in this thread, Sandboxie tries to run it sandboxed but then spontaneously "gives up" and the unsandboxed instance of Vuze is called instead. This really should be looked at, in my opinion (and the current thread title should be changed).


I would prefer a result like this too... but it appears that all the communication is being done over network protocols. As I'm sure you know, Sandboxie doesn't really control network traffic (other than blocking a few ports).

Vuze is essentially starting a new instance of itself, but it immediately detects that another instance is using the control port. Since it can't seize the control port, it passes along information to this network port telling it what torrent file to open. The unsandboxed Vuze gets this information via the control port and starts the torrent.

I would assume that the only way to really prevent this would be through some network control magic. I would think you'd have to blind the sandboxed app from any open ports on the local system, and disallow communication to any network ports used by a service outside the sandbox. Its sort of like if you had an SSH port open, and a sandboxed utility used SSH to make changes to your system. How do you stop that without initiating controls at the network level?

Maybe there is another and more clever option, but I can't picture it. The only other things I can think of would be Vuze specific, which wouldn't be all that helpful in the grand scheme of things..
(RESOLVED)Weird writing outside the sandbox behavior
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT  
Page 1 of 3  

Use the RSS feed to watch this topic for replies
  
  
 Reply to topic  

Sandboxie is Copyright © 2004-2012 by Sandboxie Holdings LLC.  All rights reserved.
Sandboxie.com | Contact Author
This site has been viewed 208,514,156 times since June 2004