Skip to content

Commit

Permalink
Build 0.3 / 5.42
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidXanatos committed Jul 4, 2020
1 parent f00ef56 commit 55832bd
Show file tree
Hide file tree
Showing 69 changed files with 1,693 additions and 341 deletions.
43 changes: 43 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,49 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).


## [0.2.5 / 5.42] - 2020-07-04

### Added
- API_QUERY_PROCESS_INFO can be now used to get the original process token of sandboxed processes
-- Note: this capability is used by TaskExplorer to allow inspecting sandbox internal tokens
- Added option "KeepTokenIntegrity=y" to make the sbie token keep its initial integrity level (debug option)
-- Note: Do NOT USE Debug Options if you dont know their security implications (!)
- Added process id to log messages very usefull for debugging
- Added finder to resource log
- Added option to hide host processes "HideHostProcess=[name]"
-- Note: Sbie hides by default processes from other boxes, this behavioure can now be controlled with "HideOtherBoxes=n"
- Sandboxed RpcSs and DcomLaunch can now be run as system with the option "ProtectRpcSs=y" howeever tht breaks sandboxed explorer and other
- BuiltIn Clsid whitelist can now be disabled with "OpenDefaultClsid=n"
- Processes can be now terminated with the del key, and require a confirmation
- Added sandboxed window border display to SandMan.exe
- Added notification for sbie log messages
- Added Sandbox Presets sub menu allowing to quickly change some settings
-- Enable/Disable API logging, logapi_dll's are now distributed with SbiePlus
-- And other: Drop admin rights; Block/Allow internet access; Block/Allow access to files on te network
- Added more info to the sandbox status column
- Added path column to SbieModel
- Added info tooltips in SbieView

### Changed
- Reworked ApiLog, added pid and pid filter
- Auto config reload on in change is now delayed by 500ms to not reload multiple times on incremental changes
- Sandbox names now replace "_" witn " " for display allowing to use names that are build of separated words

### Fixed
- added mising PreferExternalManifest itialization to portable mode
- fixed permission issues with sandboxed system processes
-- Note: you can use "ExposeBoxedSystem=y" for the old behaviour (debug option)
- fixed missing SCM access check for sandboxed services
-- Note: to disable the access check use "UnrestrictedSCM=y" (debug option)
- fixed missing initialization in serviceserver that caused sandboxed programs to crash when querying service status
- fixed many bugs that caused the SbieDrv.sys to BSOD when run with MSFT Driver Verifier active
-- 0xF6 in GetThreadTokenOwnerPid and File_Api_Rename
-- missing non optional parameter for FltGetFileNameInformation in File_PreOperation
-- 0xE3 in Key_StoreValue and Key_PreDataInject



## [0.2.2 / 5.41.2] - 2020-06-19

### Added
Expand Down
4 changes: 2 additions & 2 deletions Sandboxie/apps/control/AboutDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ BOOL CAboutDialog::OnInitDialog()
U_PDF = L' ';
}
text.Format(L"%S %c(%d-bit)%c",
MY_VERSION_STRING_EX, U_LRO, _bitness, U_PDF);
MY_VERSION_STRING, U_LRO, _bitness, U_PDF);

CString ver = CMyMsg(MSG_3302, text);
GetDlgItem(ID_ABOUT_VERSION)->SetWindowText(ver);
Expand All @@ -152,7 +152,7 @@ BOOL CAboutDialog::OnInitDialog()
//
//

text.Format(L"%S", MY_COPYRIGHT_STRING);
text.Format(L"%S\r\n%S", MY_COPYRIGHT_STRING, MY_COPYRIGHT_STRING_OLD);
GetDlgItem(ID_ABOUT_COPYRIGHT)->SetWindowText(text);

GetDlgItem(IDOK)->SetWindowText(CMyMsg(MSG_3001));
Expand Down
2 changes: 1 addition & 1 deletion Sandboxie/apps/control/InitWait.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ CInitWait::CInitWait(CWinApp *myApp)

m_pMenu = NULL;

m_app_ver.Format(L"%S", MY_VERSION_STRING);
m_app_ver.Format(L"%S", MY_VERSION_COMPAT);
m_svc_ver = L"?";
m_drv_ver = L"?";

Expand Down
3 changes: 2 additions & 1 deletion Sandboxie/apps/control/MessageDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,8 @@ void CMessageDialog::OnTimer()
ULONG len = m_buf_len;
ULONG message_number = m_last_message_number;
ULONG code = -1;
LONG status = SbieApi_GetMessage(&message_number, CMyApp::m_session_id, &code, m_buf, len);
ULONG pid = 0;
LONG status = SbieApi_GetMessage(&message_number, CMyApp::m_session_id, &code, &pid, m_buf, len);
if (status != 0)
break; // error or no more entries

Expand Down
Binary file modified Sandboxie/apps/control/SbieControl.rc
Binary file not shown.
19 changes: 1 addition & 18 deletions Sandboxie/apps/control/resource.h
Original file line number Diff line number Diff line change
@@ -1,20 +1,3 @@
/*
* Copyright 2004-2020 Sandboxie Holdings, LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by SbieControl.rc
Expand Down Expand Up @@ -264,7 +247,7 @@
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 103
#define _APS_NEXT_RESOURCE_VALUE 104
#define _APS_NEXT_COMMAND_VALUE 40013
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 103
Expand Down
11 changes: 6 additions & 5 deletions Sandboxie/common/my_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,19 @@
#ifndef _MY_VERSION_H
#define _MY_VERSION_H

#define MY_VERSION_BINARY 5,41
#define MY_VERSION_STRING "5.41"
#define MY_VERSION_STRING_EX "5.41.2"
#define MY_VERSION_BINARY 5,42,0
#define MY_VERSION_STRING "5.42.0"
#define MY_VERSION_COMPAT "5.42"

// These #defines are used by either Resource Compiler, or by NSIC installer
#define SBIE_INSTALLER_PATH "..\\Bin\\"
#define SBIE_INSTALLER_PATH_32 "..\\Bin\\Win32\\SandboxieInstall32.exe"
#define SBIE_INSTALLER_PATH_64 "..\\Bin\\x64\\SandboxieInstall64.exe"

#define MY_PRODUCT_NAME_STRING "Sandboxie"
#define MY_COMPANY_NAME_STRING "Sandboxie Holdings, LLC"
#define MY_COPYRIGHT_STRING "Copyright © 2004-2020 by Sandboxie Holdings, LLC"
#define MY_COMPANY_NAME_STRING "xanasoft.com"
#define MY_COPYRIGHT_STRING "Copyright © 2020 by David Xanatos (xanasoft.com)"
#define MY_COPYRIGHT_STRING_OLD "Copyright © 2004-2020 by Sandboxie Holdings, LLC"

#define SANDBOXIE L"Sandboxie"
#define SBIE L"SBIE"
Expand Down
110 changes: 109 additions & 1 deletion Sandboxie/common/win32_ntddk.h
Original file line number Diff line number Diff line change
Expand Up @@ -1367,6 +1367,113 @@ typedef enum _SYSTEM_INFORMATION_CLASS {
SystemProcessorMicrocodeUpdateInformation,
SystemProcessorBrandString,
SystemVirtualAddressInformation,
SystemLogicalProcessorAndGroupInformation,
SystemProcessorCycleTimeInformation,
SystemStoreInformation,
SystemRegistryAppendString,
SystemAitSamplingValue,
SystemVhdBootInformation,
SystemCpuQuotaInformation,
SystemNativeBasicInformation,
SystemErrorPortTimeouts,
SystemLowPriorityIoInformation,
SystemTpmBootEntropyInformation,
SystemVerifierCountersInformation,
SystemPagedPoolInformationEx,
SystemSystemPtesInformationEx,
SystemNodeDistanceInformation,
SystemAcpiAuditInformation,
SystemBasicPerformanceInformation,
SystemQueryPerformanceCounterInformation,
SystemSessionBigPoolInformation,
SystemBootGraphicsInformation,
SystemScrubPhysicalMemoryInformation,
SystemBadPageInformation,
SystemProcessorProfileControlArea,
SystemCombinePhysicalMemoryInformation,
SystemEntropyInterruptTimingInformation,
SystemConsoleInformation,
SystemPlatformBinaryInformation,
SystemPolicyInformation,
SystemHypervisorProcessorCountInformation,
SystemDeviceDataInformation,
SystemDeviceDataEnumerationInformation,
SystemMemoryTopologyInformation,
SystemMemoryChannelInformation,
SystemBootLogoInformation,
SystemProcessorPerformanceInformationEx,
SystemCriticalProcessErrorLogInformation,
SystemSecureBootPolicyInformation,
SystemPageFileInformationEx,
SystemSecureBootInformation,
SystemEntropyInterruptTimingRawInformation,
SystemPortableWorkspaceEfiLauncherInformation,
SystemFullProcessInformation,
SystemKernelDebuggerInformationEx,
SystemBootMetadataInformation,
SystemSoftRebootInformation,
SystemElamCertificateInformation,
SystemOfflineDumpConfigInformation,
SystemProcessorFeaturesInformation,
SystemRegistryReconciliationInformation,
SystemEdidInformation,
SystemManufacturingInformation,
SystemEnergyEstimationConfigInformation,
SystemHypervisorDetailInformation,
SystemProcessorCycleStatsInformation,
SystemVmGenerationCountInformation,
SystemTrustedPlatformModuleInformation,
SystemKernelDebuggerFlags,
SystemCodeIntegrityPolicyInformation,
SystemIsolatedUserModeInformation,
SystemHardwareSecurityTestInterfaceResultsInformation,
SystemSingleModuleInformation,
SystemAllowedCpuSetsInformation,
SystemVsmProtectionInformation,
SystemInterruptCpuSetsInformation,
SystemSecureBootPolicyFullInformation,
SystemCodeIntegrityPolicyFullInformation,
SystemAffinitizedInterruptProcessorInformation,
SystemRootSiloInformation,
SystemCpuSetInformation,
SystemCpuSetTagInformation,
SystemWin32WerStartCallout,
SystemSecureKernelProfileInformation,
SystemCodeIntegrityPlatformManifestInformation,
SystemInterruptSteeringInformation,
SystemSupportedProcessorArchitectures,
SystemMemoryUsageInformation,
SystemCodeIntegrityCertificateInformation,
SystemPhysicalMemoryInformation,
SystemControlFlowTransition,
SystemKernelDebuggingAllowed,
SystemActivityModerationExeState,
SystemActivityModerationUserSettings,
SystemCodeIntegrityPoliciesFullInformation,
SystemCodeIntegrityUnlockInformation,
SystemIntegrityQuotaInformation,
SystemFlushInformation,
SystemProcessorIdleMaskInformation,
SystemSecureDumpEncryptionInformation,
SystemWriteConstraintInformation,
SystemKernelVaShadowInformation,
SystemHypervisorSharedPageInformation,
SystemFirmwareBootPerformanceInformation,
SystemCodeIntegrityVerificationInformation,
SystemFirmwarePartitionInformation,
SystemSpeculationControlInformation,
SystemDmaGuardPolicyInformation,
SystemEnclaveLaunchControlInformation,
SystemWorkloadAllowedCpuSetsInformation,
SystemCodeIntegrityUnlockModeInformation,
SystemLeapSecondInformation,
SystemFlags2Information,
SystemSecurityModelInformation,
SystemCodeIntegritySyntheticCacheInformation,
SystemFeatureConfigurationInformation,
SystemFeatureConfigurationSectionInformation,
SystemFeatureUsageSubscriptionInformation,
SystemSecureSpeculationControlInformation,
MaxSystemInfoClass
} SYSTEM_INFORMATION_CLASS;

Expand Down Expand Up @@ -1405,7 +1512,8 @@ typedef struct _SYSTEM_MODULE_INFORMATION {
typedef struct _SYSTEM_PROCESS_INFORMATION {
ULONG NextEntryOffset;
BYTE Reserved1[52];
PVOID Reserved2[3];
UNICODE_STRING ImageName;
PVOID Reserved2[1];
HANDLE UniqueProcessId;
HANDLE InheritedFromProcessId;
ULONG HandleCount;
Expand Down
2 changes: 2 additions & 0 deletions Sandboxie/core/dll/com.c
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ _FX BOOLEAN SbieDll_IsOpenClsid(
// check against list of built-in CLSID exclusions
//

if (SbieApi_QueryConfBool(BoxName, L"OpenDefaultClsid", TRUE))
if (memcmp(rclsid, &CLSID_WinMgmt, sizeof(GUID)) == 0 ||
memcmp(rclsid, &CLSID_NetworkListManager, sizeof(GUID)) == 0 ||
memcmp(rclsid, &CLSID_ShellServiceHostBrokerProvider, sizeof(GUID)) == 0 ||
Expand Down Expand Up @@ -408,6 +409,7 @@ _FX BOOLEAN SbieDll_IsOpenClsid(
}
}

if (SbieApi_QueryConfBool(BoxName, L"OpenDefaultClsid", TRUE))
if (Com_IsFirewallClsid(rclsid, BoxName))
return TRUE;

Expand Down
12 changes: 6 additions & 6 deletions Sandboxie/core/dll/dllmain.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ ULONG Dll_Windows = 0;
CRITICAL_SECTION VT_CriticalSection;
#endif

const UCHAR *SbieDll_Version = MY_VERSION_STRING;
const UCHAR *SbieDll_Version = MY_VERSION_COMPAT;

//extern ULONG64 __security_cookie = 0;

Expand Down Expand Up @@ -389,11 +389,11 @@ _FX void Dll_InitInjected(void)
if (! Dll_RestrictedToken)
CustomizeSandbox();

/*while (! IsDebuggerPresent()) {
OutputDebugString(L"BREAK\n");
Sleep(500);
}
__debugbreak();*/
/*while (! IsDebuggerPresent()) {
OutputDebugString(L"BREAK\n");
Sleep(500);
}
__debugbreak();*/

/*if (_wcsicmp(Dll_ImageName, L"iexplore.exe") == 0) {
WCHAR *cmd = GetCommandLine();
Expand Down
13 changes: 11 additions & 2 deletions Sandboxie/core/dll/ipc_start.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,17 @@ _FX BOOLEAN Ipc_StartServer(const WCHAR *TruePath, BOOLEAN Async)
WCHAR *fullpath = Dll_AllocTemp(512 * sizeof(WCHAR));
Sbie_swprintf(fullpath, L"\"%s\\%s\"", homedir, program);

if (! SbieDll_RunSandboxed(
L"*THREAD*", fullpath, homedir, 0, &si, &pi))
//
// Note: many proesses started by DcomLaunch must be started as user this is currently a bit broken,
// see Proc_CreateProcessInternalW_RS5 so for successfull operation in most cases we can't run RpcSs with a system token
// Fix-Me: fix Proc_CreateProcessInternalW_RS5 and make prtected RpcSs and subsequently DcomLaunch the deault
//
// Note: ServiceServer::CanAccessSCM has a special case to permit DcomLaunch to start services without being system
//
const WCHAR* box_name = SbieApi_QueryConfBool(NULL, L"ProtectRpcSs", FALSE) ? L"*SYSTEM*" : L"*THREAD*";

if (! SbieDll_RunSandboxed(//L"*THREAD*",
box_name, fullpath, homedir, 0, &si, &pi))
errnum = GetLastError();
else
errnum = -1;
Expand Down
25 changes: 25 additions & 0 deletions Sandboxie/core/dll/proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,20 @@ typedef BOOL(*P_GetTokenInformation)(
_In_ DWORD TokenInformationLength,
_Out_ PDWORD ReturnLength);

typedef BOOL(*P_SetTokenInformation)(
_In_ HANDLE TokenHandle,
_In_ TOKEN_INFORMATION_CLASS TokenInformationClass,
_In_reads_bytes_(TokenInformationLength) LPVOID TokenInformation,
_In_ DWORD TokenInformationLength);

typedef BOOL(*P_AddAccessAllowedAceEx)(
_Inout_ PACL pAcl,
_In_ DWORD dwAceRevision,
_In_ DWORD AccessMask,
_In_ PSID pSid);

typedef BOOL(*P_GetLengthSid)(
_In_ _Post_readable_byte_size_(return) PSID pSid);

//---------------------------------------------------------------------------

Expand All @@ -255,6 +269,12 @@ static P_NtQueryInformationProcess __sys_NtQueryInformationProcess = NULL;
static P_NtCreateProcessEx __sys_NtCreateProcessEx = NULL;

static P_GetTokenInformation __sys_GetTokenInformation = NULL;
/*static P_SetTokenInformation __sys_SetTokenInformation = NULL;
static P_AddAccessAllowedAceEx __sys_AddAccessAllowedAceEx = NULL;
static P_GetLengthSid __sys_GetLengthSid = NULL;*/



//---------------------------------------------------------------------------
Expand Down Expand Up @@ -381,6 +401,11 @@ _FX BOOLEAN Proc_Init_AdvApi(HMODULE module)
}

__sys_GetTokenInformation = (P_GetTokenInformation) GetProcAddress(module, "GetTokenInformation");
/*__sys_SetTokenInformation = (P_SetTokenInformation) GetProcAddress(module, "SetTokenInformation");
__sys_AddAccessAllowedAceEx = (P_AddAccessAllowedAceEx) GetProcAddress(module, "AddAccessAllowedAceEx");
__sys_GetLengthSid = (P_GetLengthSid) GetProcAddress(module, "GetLengthSid");*/

return TRUE;
}
Expand Down
2 changes: 2 additions & 0 deletions Sandboxie/core/dll/sbieapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ _FX LONG SbieApi_GetMessage(
ULONG* MessageNum,
ULONG SessionId,
ULONG *MessageId,
ULONG *Pid,
wchar_t *Buffer,
ULONG Length)
{
Expand All @@ -302,6 +303,7 @@ _FX LONG SbieApi_GetMessage(
args->session_id.val = SessionId;
args->msgid.val = MessageId;
args->msgtext.val = &msgtext;
args->process_id.val = Pid;

status = SbieApi_Ioctl(parms);

Expand Down
1 change: 1 addition & 0 deletions Sandboxie/core/dll/sbieapi.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ LONG SbieApi_GetMessage(
ULONG* MessageNum,
ULONG SessionId,
ULONG *MessageId,
ULONG *Pid,
wchar_t *Buffer,
ULONG Length);

Expand Down
Loading

0 comments on commit 55832bd

Please sign in to comment.