Commit Graph

68 Commits

Author SHA1 Message Date
Florian Bruhin 8cf9cc9f1b nsis: Check for newer Windows build
Follow-up to #8321, so we only claim to support what Qt actually officially does.
2024-10-15 11:52:34 +02:00
bitraid 52a8576d7c Simplify OS version checks in nsis installer
22000 is the earliest win11 build, so no need to check for that
separately.
AtLeastWin11 is from https://github.com/kichik/nsis/blob/master/Include/WinVer.nsh#L552
Remove fail label since all failures fall through.
2024-10-09 21:40:37 +13:00
toofar d24a4c5ab0 Remove Qt5 switches from release building scripts etc
I just searched for qt5 and deleted stuff. EZ.
Will leave on a branch for a bit and see if I feel like testing this at
all, otherwise maybe leave this stuff in here and make it not called.

Not 100% sure that we need to remove all this stuff when we just want
the CI to go green. But tbh if we don't need to make Qt5 releases then
we don't need it. Better to be bold and pull it out than have to work
around it in the future. And we can always revert the commit.
2024-10-05 13:55:15 +13:00
Evan Chen 310c865f29
Fix some spelling errors 2024-05-09 10:58:04 -04:00
bitraid 7599dbc209 nsis: custom error message for Qt5 OS version check
The CheckPlatform macro will prompt the user user to use the 32bit installer
if they are on a 32bit system. But we don't provide a 32bit installer anymore.

This commit changes the OS version check for Qt5 builds to be based on checking
version numbers ourselves too, so that we can have our own error message.

Also moves the Qt5 conditionals to be compile time ones.
2023-08-13 15:14:24 +12:00
toofar 6f7b76f066 nsis: allow Win10 versions back to 1607 2023-08-13 15:14:24 +12:00
toofar c1841c7948 nsis: remove arch from binary path string
We dropped 32bit support in #7804 and as a result removed the arch
suffix from the binary that pyinstaller produces. This commit removes it
form the lookup path in the installer too.

Note that we are leaving the arch string in the installer itself for
now. Mostly because it'll be removed as part of a later change when the
installer itself is refreshed. But it might also be useful to clarify in
the installer names what the arch is? Maybe, that reasoning might not
fit with the previous change to remove the arch strings.
2023-08-13 15:14:24 +12:00
bitraid f903ae4985 nsis: minimum OS version check for Qt6
The Qt docs for 6.5 say that the minimum supported version is Windows 10
1809.

Experimentally it seems qutebrowser and it's dependencies work fine on a
version as early 1607.

There should be no change in OS version requirements for the Qt5 build,
although we've dropped 32 bit support already and in a future version of
the installer we may bring the minimum OS version support in line with
the Qt6 requirements for simplicity too.

Added a new QT5 version into the NSIS scripts so we can do the different
version check per installer build. It just uses the python bool
serialization format so should always be "True" or "False", but I've
added a fallback anyway for consistency.
2023-08-13 15:14:24 +12:00
Florian Bruhin 8ddaef35d0 reuse: Fix more copyright headers
See previous commit, forgot ? after year range
2023-07-23 12:56:13 +02:00
Florian Bruhin d2975c6d09 reuse: Get files in misc/nsis/ to use SPDX
reuse annotate --license="GPL-3.0-or-later" --style python \
    misc/nsis/uninstall_pages.nsh \
    misc/nsis/install.nsh \
    misc/nsis/uninstall.nsh

And fixing qutebrowser.nsi manually as that uses iso-8859-1 and the reuse tool
doesn't like that apparently.
2023-07-23 12:19:27 +02:00
Florian Bruhin 8c887bdba3 Merge remote-tracking branch 'origin/pr/7124' 2022-06-13 12:24:16 +02:00
Florian Bruhin 488dc175e0 doc: Adjust some PyQt5 references 2022-04-14 13:40:31 +02:00
bitraid 6bf7907c19
NSIS: Base icon choices on previous install
Closes #7109
2022-04-13 12:54:26 +03:00
bitraid a97ffe0bd0
NSIS: Get interface colors from system.
Fixes #7112
2022-04-13 12:43:54 +03:00
Florian Bruhin 58e64d28c4 Don't register qutebrowserurl: as URL protocol
This was originally intended as a fix for CVE-2021-41146, but it turned out the
same exploit works via e.g. https:// just as well. Still, it makes sense to
remove it.
2021-10-21 16:01:54 +02:00
Florian Bruhin 8f46ba3f6d CVE-2021-41146: Add --untrusted-args to avoid argument injection
On Windows, if an application is registered as an URL handler like this:

    HKEY_CLASSES_ROOT
        https
            URL Protocol = ""
            [...]
            shell
                open
                    command
                    (Default) = ".../qutebrowser.exe" "%1"

one would think that Windows takes care of making sure URLs can't inject
arguments by containing a quote. However, this is not the case, as
stated by the Microsoft docs:
https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/aa767914(v=vs.85)

    Security Warning: Applications that handle URI schemes must consider how to
    respond to malicious data. Because handler applications can receive data
    from untrusted sources, the URI and other parameter values passed to the
    application may contain malicious data that attempts to exploit the handling
    application.

and

    As noted above, the string that is passed to a pluggable protocol handler
    might be broken across multiple parameters. Malicious parties could use
    additional quote or backslash characters to pass additional command line
    parameters. For this reason, pluggable protocol handlers should assume that
    any parameters on the command line could come from malicious parties, and
    carefully validate them. Applications that could initiate dangerous actions
    based on external data must first confirm those actions with the user. In
    addition, handling applications should be tested with URIs that are overly
    long or contain unexpected (or undesirable) character sequences.

Indeed it's trivial to pass a command to qutebrowser this way - given how
trivial the exploit is to recreate given the information above, here's a PoC:

    https:x" ":spawn calc

(or qutebrowserurl: instead of https: if qutebrowser isn't registered as a
default browser)

Some applications do escape the quote characters before calling
qutebrowser - but others, like Outlook Desktop or .url files, do not.

As a fix, we add an --untrusted-args flag and some early validation of the raw
sys.argv, before parsing any arguments or e.g. creating a QApplication (which
might already allow injecting Qt flags there).

We assume that there's no way for an attacker to inject flags *before* the %1
placeholder in the registry, and add --untrusted-args as the last argument of
the registry entry. This way, it'd still be possible for users to customize
their invocation flags without having to remove --untrusted-args.

After --untrusted-args, however, we have some rather strict checks:

- There should be zero or one arguments, but not two (or more)
- Any argument may not start with - (flag) or : (qutebrowser command)

We also add the --untrusted-args flag to the Linux .desktop file, though it
should not be needed there, as the specification there is sane:

https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#exec-variables

    Implementations must take care not to expand field codes into multiple
    arguments unless explicitly instructed by this specification. This means
    that name fields, filenames and other replacements that can contain spaces
    must be passed as a single argument to the executable program after
    expansion.

There is no comparable mechanism on macOS, which opens the application without
arguments and then sends an "open" event to it:
https://doc.qt.io/qt-5/qfileopenevent.html

This issue was introduced in qutebrowser v1.7.0 which started registering it as
URL handler: baee288890 / #4086

This is by no means an issue isolated to qutebrowser. Many other projects have
had similar trouble with Windows' rather unexpected behavior:

Electron / Exodus Bitcoin wallet:
- http://web.archive.org/web/20190702112128/https://medium.com/0xcc/electrons-bug-shellexecute-to-blame-cacb433d0d62
- https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-1000006
- https://medium.com/hackernoon/exploiting-electron-rce-in-exodus-wallet-d9e6db13c374

IE/Firefox:

- https://bugzilla.mozilla.org/show_bug.cgi?id=384384
- https://bugzilla.mozilla.org/show_bug.cgi?id=1572838

Others:
- http://web.archive.org/web/20210930203632/https://www.vdoo.com/blog/exploiting-custom-protocol-handlers-in-windows
- https://parsiya.net/blog/2021-03-17-attack-surface-analysis-part-2-custom-protocol-handlers/
- etc. etc.

See CVE-2021-41146 / GHSA-vw27-fwjf-5qxm:
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41146
https://github.com/qutebrowser/qutebrowser/security/advisories/GHSA-vw27-fwjf-5qxm

Thanks to Ping Fan (Zetta) Ke of Valkyrie-X Security Research Group
(VXRL/@vxresearch) for finding and responsibly disclosing this issue.
2021-10-21 16:01:04 +02:00
bitraid 74cf64a063
Windows Uninstaller: Fix silent uninstall (again) 2021-06-01 18:57:54 +03:00
bitraid 78d4a9d41b
Windows Installer: Allow elevation when silent 2021-05-31 14:06:09 +03:00
bitraid 92178e8152
Windows Installer: Update minimum OS version 2021-05-25 18:00:15 +03:00
Florian Bruhin 1a4fff1a42 doc: Switch URLs to https 2021-01-26 15:19:01 +01:00
Florian Bruhin a78442bb67 Rewrite file collection in misc_checks.py
Now collects all (non-ignored) files via `git ls-files` and only skips
some binary formats.

Also adds some type annotations and fixes some newly unconvered
UK-spellings.
2020-09-06 17:23:03 +02:00
Florian Bruhin 8a1768a41a Windows: Fix Desktop typo in installer 2019-10-20 21:29:03 +02:00
bitraid 22d1f978dd
Fix jump value in CheckOldNSIS 2019-01-19 09:55:44 +02:00
bitraid 73a368d166
Fix SetRegView condition of 052d07d37 2019-01-18 09:26:42 +02:00
bitraid cfe51c4b82
Update comments, strip trailing whitespace
Also, use uppercase for the first letters of the default browser string.
2019-01-17 20:29:53 +02:00
bitraid 9cf44ef534
Use full paths when calling cmd and msiexec 2019-01-17 19:57:03 +02:00
bitraid 052d07d371
Delete leftover reg key after elevation 2019-01-17 19:46:05 +02:00
bitraid 756bd21111
Use ExecShellWait instead of cmd when calling the old uninstallers 2019-01-17 18:31:28 +02:00
bitraid cc7ab995af
NSIS: remove icons and reg right after the exe
Remove the program's registry and icons right after the main exe, so if
it fails to remove another file and aborts, it won't leave invalid
entires. The user could run the uninstaller at another time (a restart
should fix any file locking issues).
2018-11-06 12:30:34 +02:00
bitraid 7452327850
NSIS: use DeleteRetryAbort for all files
Even if qutebrowser.exe is successfully deleted, other files might
still be locked (QtWebEngineProcess.exe hang).
2018-11-06 12:22:52 +02:00
bitraid 05bf18d4c8
NSIS: show shield icon on install button
Show the shield icon on install button if elevation is only needed by
the uninstaller.
2018-10-30 14:31:05 +02:00
bitraid 4e6c3b8866
NSIS: Use cmd.exe by uninstaller to delete itself
Use cmd.exe when uninstaller is called with _? because the installer
will fail to remove it when elevation is required but is running as
standard user.
2018-10-30 14:14:57 +02:00
bitraid c87e3b7f73
Always run the uninstaller as the correct user
When a standard user uses an admin account for elevation to change an
existing single-user installation to all-users, the uninstaller is now
run for the correct (standard) user (instead of the admin).
2018-10-30 14:06:10 +02:00
bitraid bf51ad8d78
NSIS: fix typo in comments 2018-10-23 14:10:29 +03:00
bitraid c69ca21ff9
NSIS: change 'Default browser' text after Win7 2018-10-23 13:02:42 +03:00
bitraid 0f690b5793
NSIS: workaround for Windows buggy execution of uninstallers
Includes StdUtils plugin and makes use of ExecShellAsUser to restart
the uninstaller when started as administrator. This stops the
uninstaller from failing for single-user installations of standard
users, when executed elevated by 'Apps & features' of Win10. It also
gets the correct user directories when executed by a standard user from
'Add/Remove Programs' or 'Apps & features' of an all-users installation.
This has the drawback of the uninstaller having to elevate if it needs
to, even when it's started as administrator. So the user gets the UAC
prompt twice in this case.
2018-10-23 10:36:24 +03:00
bitraid 6ca7dfd614
NSIS: always call RefreshShellIcons on uninstall 2018-10-20 11:23:31 +03:00
bitraid 35c38e9562
NSIS: group uninstaller sections and display username 2018-10-20 10:06:57 +03:00
bitraid 24f02b1d48
NSIS: change CRCCheck 'force' to 'on' 2018-10-19 18:56:51 +03:00
bitraid 538d417e69
NSIS: always remove the correct config/cache dirs
The uninstaller now removes the files of the user that started it, even
when it's using another account for elevation. The user has to run the
uninstaller directly though, because through Windows, it's starting
elevated from the get-go.
2018-10-19 14:11:49 +03:00
bitraid 97e7efba42
NSIS: remove underscores from function names 2018-10-17 13:59:11 +03:00
bitraid a992c015c1
NSIS: use builtin function to refresh shell icons 2018-10-17 13:58:02 +03:00
bitraid 1fe1641f7b
NSIS: add missing curly brackets 2018-10-17 10:24:52 +03:00
bitraid 3e9a239911
NSIS: use correct HKCU when using another account for elevation. 2018-10-11 19:59:08 +03:00
bitraid 2cd71b5382
NSIS: fix uninstaller check 2018-10-07 23:28:00 +03:00
bitraid 7fb0c858bc
NSIS: don't try to run the uninstaller if missing 2018-10-06 23:59:37 +03:00
bitraid b1876c4755
NSIS: don't write properties, safemode reg keys 2018-10-06 12:56:25 +03:00
bitraid 8af8105678
NSIS: expand Shortcuts group 2018-10-06 12:52:16 +03:00
bitraid 4afa2f83c7
NSIS: register PDF support 2018-10-06 12:20:09 +03:00
bitraid b1a33d63fa
NSIS: don't use UPX by default 2018-10-06 12:12:11 +03:00