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

update!: Windows guide #1659

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added docs/assets/img/windows/EFS.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/img/windows/UWP-in-MS-Store.webp
Binary file not shown.
Binary file added docs/assets/img/windows/Win32-in-MS-Store.webp
Binary file not shown.
Binary file added docs/assets/img/windows/autoplay.webp
Binary file not shown.
Binary file added docs/assets/img/windows/disable-telemetry.webp
Binary file not shown.
Binary file added docs/assets/img/windows/drive-restriction.webp
Binary file not shown.
Binary file not shown.
Binary file added docs/assets/img/windows/online-speech.webp
Binary file not shown.
Binary file added docs/assets/img/windows/privacy-settings.webp
Binary file not shown.
Binary file added docs/assets/img/windows/signin-one-app.webp
Binary file not shown.
Binary file added docs/assets/img/windows/user-account.webp
Binary file not shown.
Binary file added docs/assets/img/windows/voice-activation.webp
Binary file not shown.
272 changes: 272 additions & 0 deletions docs/os/windows/hardening.md

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions docs/os/windows/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ You can enhance your privacy and security on Windows without downloading any thi

- Initial Installation (coming soon)
- [Group Policy Settings](group-policies.md)
- Privacy Settings (coming soon)
- Application Sandboxing (coming soon)
- Security Hardening (coming soon)
- [Privacy Settings](privacy.md)
- [Application Sandboxing](sandboxing.md)
- [Security Hardening](hardening.md)

<div class="admonition example" markdown>
<p class="admonition-title">This section is new</p>
Expand Down
86 changes: 86 additions & 0 deletions docs/os/windows/privacy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
---
title: Achieving Privacy
icon: material/incognito
---

## Using Microsoft account

You should avoid sign in to Windows with a Microsoft account. As signing in to applications like Microsoft Office (which some users are required to do for their school or company) will trigger a dark pattern offering you to sign in to Windows, which will connect your device to your Microsoft account, and compels sending data to Microsoft servers and it is critical to reject this offer.

It’s worth noting that according to [this study](https://www.autoriteitpersoonsgegevens.nl/sites/default/files/atoms/files/public_version_dutch_dpa_informal_translation_summary_of_investigation_report.pdf) it seems that Windows collects more telemetry when signed into a Microsoft Account.

![Using account for specific app](/docs/assets/img/windows/signin-one-app.webp)

You should log in to that specific app only if you need to.

or

Create another standard user account and connect it to Microsoft account if you are required for School or Work and keep the apps to that account alone. By restricting other data drive access, it is fully isolated from other profiles.

## Telemetry

To disable telemetry at full level, Open Group policy and navigate to `Computer Configuration` > `Administrative Templates` > `Windows Components` > `Data Collection and Preview builds` and choose as required

![Disable telemetry](/docs/assets/img/windows/disable-telemetry.webp)

The above works only if you use Enterprise or Education edition. If Professional, It will send required (Basic) data.

If you read this article - [https://www.softscheck.com/en/blog/windows-10-enterprise-telemetry-analysis/](https://www.softscheck.com/en/blog/windows-10-enterprise-telemetry-analysis/), Enterprise even sends data even though telemetry is disabled. But there is no updated info about this available.

Disabling full telemetry or sending basic data to Microsoft is totally upto the user's threat model.

- [ ] Disable `Automatic Sample Submission` in Windows Defender, as the feature will send your files as a sample for Signature Database and might leak your data. You can do it via the below Group Policy so to not prompt you again and again constantly.

```text
Computer Configuration > Administrative Templates > Windows Components > Microsoft Defender Antivirus > MAPS > Send file samples when further analysis is required to Never Send.
```

- [ ] Disable Windows spotlight by navigating to `User Configuration` > `Administrative Templates` > `Windows Components` > `Cloud Content` and setting **Turn off all Windows Spotlight features** policy to enabled.

<div class="admonition note" markdown>
<p class="admonition-title">Note</p>

This explicitly disables Windows spotlight features in Lockscreen and Desktop to sever unnecessary connections between Microsoft servers and the device.

</div>

- [ ] Disable Bing integration in Windows search, by navigating to `Computer Configuration\Administrative Templates\Windows Components\Search\Don't search the web or display web results`. This way your search queries for local indexed data is not sent to Microsoft.

- [ ] Disable notification in the Lock screen in Windows settings
![Lock screen notification](/docs/assets/img/windows/lock-screen-notifications.webp)

- [ ] Disable Online Speech recognition and Voice activation
![Alt text](/docs/docs/assets/img/windows/online-speech.webp)
![Alt text](/docs/assets/img/windows/voice-activation.webp)

- [ ] Disable delivery optimization in Windows Update settings.

- Check all the App permissions and allow only necessary ones.

## Hide MAC Address

Go to `Settings` > `Network & Internet` > `Wifi`

Enable **Random hardware addresses**

## Restrict access to data drives

To prevent other users from accessing your secondary data drives. Type `gpedit.msc` in Windows Run dialog box.

Go to `User Configuration` > `Administrative Templates` > `Windows Components` > `File Explorer` and set the Group Policy as below.

![Restrict-drive](/docs/assets/img/windows/drive-restriction.webp)

The above configuration will restrict other users to the OS drive where Windows is installed. Making total isolation between your Account and other user account.

If it's a shared drive with another person but you don't want the user to access sensitive data then use EFS. EFS encrypts the documents so that the user who encrypted it can only access it and not others.

![EFS](/docs/assets/img/windows/EFS.gif)

It is better to export the Private key certificate and store in a safe place so as to use the file later in other devices. To do so,

Press, ++win+r++, Then type `certmgr.msc`, Under `Personal` > `Certificates`. Click the certificate that contains your username. Right Click and choose export. If you find this too tricky, then after using EFS for first time. You will see an encrypted locker Icon in system tray which help you in exporting on clicking it.

To import in another device, simply open and install this certificate in that device and choose the above location. Then you can access EFS encrypted files in other system too.

*[EFS]: Encrypted File System
155 changes: 155 additions & 0 deletions docs/os/windows/sandboxing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
---
title: Application Sandboxing
icon: octicons/apps-16
---

## Native Application Sandboxing

### Application Packaging by Windows

Windows has two types of application packaging such as `.exe`/`.msi` (Win32) and `.appx`/`.msix` (UWA).

#### Universal Windows Application (UWA)

UWAs are processes that operate within the `AppContainer` is an application sandbox environment, which implements mechanisms for the restriction of `AppContainer` processes in terms of what system resources they can access. Basically, Application that is fully isolated and only given access to certain resources.

#### Win32 Apps

Win32 is the application platform of choice for developing and running classic Windows applications, that
is, Win32 applications, that require direct access to Windows and hardware.

The core of Win32 is the Win32 API implemented in the Windows SubDLLs (DLLs) and the ntdll.dll library file. With the combination of `SubDLLs` and `ntdll.dll`, the Win32 application has direct access to full system resources.

#### A comparison between UWA and Win32

| UWAs | Windows |
| :--------- | :---------------------------------- |
|UWAs run as restricted, containerized `AppContainer` processes that run by accessing the WinRT API, a subset of COM functionalities and the Win32 API. They have specific properties that define process restrictions in terms of the system resources that processes can access.| Win32 applications run as Windows native, traditional processes that run by accessing the Win32 API and COM functionalities to their full extent and a subset of the WinRT API to directly access all system resources. They do not run as restricted processes, all system functionalities are by design directly available to them.|
|Only a single instance of a given UWA may run at a given time. | Any number of instances of a given Win32 application may run simultaneously. |
|UWAs are distributed as application packages, archive files with a pre-defined format and required content that is necessary for the deployment and operation of UWAs |The way in which Win32 applications are distributed is not restricted by the operating system. It is defined by the application vendors. |

The above comparison gives a clear cut that UWA/UWP apps are the best ones to use in terms of sandboxing the app.

### Choosing the way to install software

UWA apps are primarily distributed through Microsoft store and are counter-signed by Microsoft while as third party UWA's are signed by the vendor without Microsoft's signature.

It is recommended to use the UWA apps as they are sandboxed into their own containers.

And for Win32 apps. If you are required to use Win32 apps. Install the application in the host and run it using [Windows Sandbox](/windows/sandboxing/#run-programs-instantly-in-sandbox).

It is **recommended** to install in host and use in Sandbox to reduce your time installing the software again and again in Windows Sandbox.

### Finding Win32 and UWP apps in Windows Store

Generally, apps available in Microsoft store was UWP only before Windows 11 was launched but after the launch both Win32 and UWP apps co-exist in the store.

At this point, it is difficult to differentiate between Win32 and UWP apps. To find which is UWP or Win32. Read below:

When you see an app in store and scroll down to *Additional Information* section and see if it asks for certain permissions like in the image below:

![UWP in store](/assets/img/windows/UWP-in-MS-Store.webp)

If the Win32 App, Microsoft store will explicitly state that it is Provided and Updated by `****` and `Uses all System resources` as in the image below:

![Win32 in store](/assets/img/windows/Win32-in-MS-Store.webp)

<div class="admonition note" markdown>
<p class="admonition-title">Un-sandboxed UWP apps</p>

Some UWP apps in the store due to the lift of restrictions in Microsoft store developers can submit the app with a property named `runFullTrust` which disables sandboxing of that UWP application and shows that `Uses all System Resources` in *Additional Information* section such as Firefox. By this you can know if a UWP app is sandboxed or not.

If it is sandboxed, it will show only certain permissions in *Additional Information* section.
</div>

<div class="admonition abstract" markdown>
<p class="admonition-title">Note</p>

Most apps will ask that if the app needs to be used for all users or just for your user account. It is best you keep the app to your user Account. So, We achieve better sandboxing between different user accounts.

</div>

#### Another way to find

[rg-adguard.net](https://store.rg-adguard.net/) is a third party Microsoft store app which can be used to download `.appx` files (Installer for UWP) and install UWP apps. You can use this site to download Age Restricted apps in store and Install it. **Note** that paid apps don't work unless you connect a Microsoft Account.

## Using Winget to Install Sofware

Windows Package Manager winget command-line tool is bundled with Windows 11 and modern versions of Windows 10 by default as the App Installer.

The winget command line tool enables users to discover, install, upgrade, remove and configure applications on Windows 10 and Windows 11 computers. This tool is the client interface to the Windows Package Manager service.

More information here : [https://learn.microsoft.com/en-us/windows/package-manager/winget/](https://learn.microsoft.com/en-us/windows/package-manager/winget/)

The Winget tool is a powerful tool to install apps that are safe, trusted and official ones. This should be used to avoid sketchy installers.

Even you have apps installed via the traditional installer setup. You can continue using winget

A Quick demo by ThioJoe - [https://youtu.be/uxr7m8wDeGA](https://youtu.be/uxr7m8wDeGA)

Detailed info about the tool by Microsoft - [https://youtu.be/Lk1gbe_JTpY](https://youtu.be/Lk1gbe_JTpY)

If you understood about Winget, then this tool - [https://winstall.app/](https://winstall.app/) is suggested to bulk install apps.

Note : Be sure to install via Winget or using MSI installer to upgrade the app easily.

### Benefits of winget

There are general advantages in having a package manager regardless of the operating system.

- Security : The packages that the package manager includes are usually safe because they’re verified by maintainers.
- Automation : It’s easier to install or uninstall N applications using a package manager. No need to do it manually.
- Maintenance : With a package manager usually you can update all your applications, including configurations.
Exploration. Instead of searching manually in a browser for an application you can use the package manager. Since it’s centralized it should be easier to find what you want.

## Windows Sandbox

Windows Sandbox provides a lightweight desktop environment to safely run applications in isolation. Software installed inside the Windows Sandbox environment remains "sandboxed" and runs separately from the host machine.

The sandbox is temporary like TailsOS running on a USB drive. When it's closed, all the software and files and the state are deleted. You get a brand-new instance of the sandbox every time you open it.

You can know more from the Official [Documentation](https://docs.microsoft.com/en-us/windows/security/threat-protection/windows-sandbox/windows-sandbox-overview).

**Use case of Sandbox:** The Windows Sandbox can be used to run unknown software or if you want to isolate your Workspace from the host with only Specific set of apps, etc.

### Using Sandbox

To use Sandbox, you can create a configuration file as per the official Microsoft [Documentation](https://docs.microsoft.com/en-us/windows/security/threat-protection/windows-sandbox/windows-sandbox-configure-using-wsb-file) for your needs.

So, when opening the file, sandbox opens with the Configurations you had set up in your file.

If you do not understand the documentation, you can use [Windows Sandbox Editor](https://github.com/damienvanrobaeys/Windows_Sandbox_Editor) instead. It is a GUI application that can be used to create configuration files easily.

<div class="admonition note" markdown>
<p class="admonition-title">Regarding Windows Sandbox Editor</p>

The repository doesn't provide a package. So, you need to download the whole codebase. After, extracting the zip Windows Defender or other Antivirus software may flag the [exe](https://github.com/damienvanrobaeys/Windows_Sandbox_Editor/tree/master/EXE) file as a malware. So, it is recommended to install it via the [Powershell Script](https://github.com/damienvanrobaeys/Windows_Sandbox_Editor/tree/master/Install%20on%20desktop%20(in%20case%20of%20issue%20with%20EXE)) they provide.

By default, You cannot execute Scripts in Powershell and it is restricted to commands only. It is recommend you allow the Terminal to `Unrestricted` mode and use it to install the editor via Script after that change it back to `Restricted` [execution policy](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_execution_policies?view=powershell-7.2) to prevent accidental execution of malicious scripts in the future.

</div>

### Run programs instantly in Sandbox

[Run in Sandbox](https://github.com/damienvanrobaeys/Run-in-Sandbox) is a tool to quickly run files in Windows Sandbox with a right click.

We recommend you to use this software as it is convenient and easy to use and even credited by Microsoft.

A full guide on How to use it can be found here: [https://www.systanddeploy.com/2021/11/run-in-sandbox-quick-way-to-runextract.html](https://www.systanddeploy.com/2021/11/run-in-sandbox-quick-way-to-runextract.html)

Note: The same note of installing sandbox editor via PowerShell also applies here except this doesn't provide an `exe` at all.

This page is based on the German BSI project - [SiSyPHuS Win10](https://www.bsi.bund.de/EN/Topics/Cyber-Security/Recommendations/SiSyPHuS_Win10/SiSyPHuS_node.html)'s Work Package 9 Dcoument.

**For Advanced Users :**

Sandboxie Plus, is a Sandboxing tool which uses File system and registry Virtualization techniques to sandbox every apps and at the same data not being lost like Windows Sandbox.

Use this at your own Risk !

*[UWA]:Universal Windows Applications
*[UWP]:Universal Windows Platform
*[SubDLLs]: Subsystem Dynamic link libraries
*[ntdll.dll]: A core Windows library file that implements functions for interaction with the kernel.
*[WinRT]: Windows Runtime
*[COM]: Component Object Model
Loading
Loading