Commit Graph

4755 Commits

Author SHA1 Message Date
matt335672
d8c8b22589 Disable autologon for empty passwords
Although there is nothing in the specification to prevent automatic
logons with empty passwords, this is not a secure default.

The autologon flag INFO_AUTOLOGON ([MS-RDPBCGR] 2.2.1.11.1.1) is now
ignored for empty passwords.
2022-12-30 10:28:57 +00:00
matt335672
8a0a0249b2 Ignore xrdp-authtest in 'git status' 2022-12-22 11:35:02 +00:00
matt335672
47ace4acfd Fix g_sck_get_peer_cred() on FreeBSD
Socket level should be SOL_LOCAL rather than SOL_SOCKET - See
'man unix'.
2022-12-22 11:35:02 +00:00
matt335672
1a48527df9 Update xrdp for separate AA and session creation
xrdp is updated to use the separate authenticate/authorization (AA) and
command processing interface now provided by sesman.

PAM processing has been removed entirely and moved into the seman PAM
module. As a result, gateway processing for proxy use-cases can be
made use of by non-PAM systems.
2022-12-22 11:35:02 +00:00
matt335672
851bed680c Update sesman tools for new interfaces
The sesman tools sesrun and sesadmin now use the separate
authentication/authorization (AA) interface introduced to
sesman by the previous comment.

sesrun can use either password or UDS authentication. With some
limitations, this can allow for automatic creation of sessions for local
users without a password being needed.

sesadmin now operates using UDS logins only and so a username and
password are not required. To use sesadmin for another user, use
su/sudo/doas to authenticate as the other user.
2022-12-22 11:35:02 +00:00
matt335672
fd99653957 Update sesman authentication processing
Update sesman to cope with separate authentication/authorization (AA) and
command processing.

Also, internally users are now tracked by UID rather thn username.
This addresses a problem found by some users using federated naming
services (e.g. Active Directory) where the same user can be referred to
in more than one way. See https://github.com/neutrinolabs/xrdp/issues/1823

The separation of AA in this way allows for multiple attempts to be made
on one connection to get a password right. This addresses MaxLoginRetry
not working (https://github.com/neutrinolabs/xrdp/issues/1739)
2022-12-22 11:35:02 +00:00
matt335672
c5b6479985 Update authtest utility
This change allows the authtest utility to exercise the updated
auth module interface which includes UDS authentication and
improved error logging.
2022-12-22 11:35:02 +00:00
matt335672
d2a5fcdcd8 Update other auth modules to use new interface
The previous commit introduced a new interface for the auth modules.  This
commit simply updates the other auth modules to use the new interface.

The basic auth module is also updated so that if a user has a shadow
password entry indicated, but the shadow entry cannot be found, an error
is logged rather than silently succeeding.

The BSD authentication module is also updated to allow it to be
compiled on a Linux system for basic testing.
2022-12-22 11:35:02 +00:00
matt335672
2a3cec4125 Update PAM auth module for UDS logins
An extra method auth_uds() is added to the PAM module to
allow a 'struct auth_info' to be created for a UDS login. The PAM stack
is used to check the UDS user can be authorized.

Also, an error code is returned from the auth module rather than a
simple boolean. This allows a more complete status to be communicated
to the user. See https://github.com/neutrinolabs/xrdp/discussions/1921
and also #909 and #642
2022-12-22 11:35:02 +00:00
matt335672
4c4bdc9782 SCP: separate authentication from session creation
Messaging changes:-
- Implement sys_login request message with username, password and
  IP address
- Implement UDS login message for current user connected to sesman
- Implement common login response message for login requests
- Implement logout message so gateway authentications can be handled
- with login/logout messages
- Remove login info from the create session request
- Existing gateway request/response messages removed
- Add close connection message so that sesman can close terminated
  connections without displaying ERROR messages in the log.
- Add a set_peername message so clients can send a name to sesman
  for improved logging.

Other changes:-
- Add status types for logging in and session creation, so that the
  front-end can supply the user with more informative errors in the
  event of an error occurring.
- Users identities are now carried by UID rather than username, as
  xrdp and sesman are guaranteed to be on the same machine.
2022-12-22 11:35:02 +00:00
matt335672
891efed9ad Remove nested includes from sesman.h
The intention is to improve decoupling of the modules making up
sesman.
2022-12-22 11:35:02 +00:00
matt335672
a16e56f711 Add function to get user information by UID
Moving to a uid_t to store the user information makes a lot
of sense. When doing this, we need a function to get information
about a user from the uid_t

As well as creating the function g_getuser_info_by_uid() we also
rename g_getuser_info() to g_getuser_info_by_name() and make the
parameter ordering more usual.
2022-12-22 11:35:02 +00:00
matt335672
752b4bcaa5
Merge pull request #2481 from otaconix/patch-1
Tiny fix in pseudocode description of startwm.sh
2022-12-22 11:16:18 +00:00
otaconix
c04bf92552
Tiny fix in pseudocode description of startwm.sh
I realize there's not much value in this PR, but I noticed this, so I thought I'd fix it 🙂
2022-12-21 11:54:05 +01:00
matt335672
a4fb635a5d
Merge pull request #2453 from matt335672/update_kerberos
Fix the kerberos module
2022-12-14 10:44:31 +00:00
matt335672
a6714225e6 Changes to verify_user_kerberos.c 2022-12-13 11:09:33 +00:00
matt335672
767d861df4 Add authtest
Also, change the sesman Makefile generation to make it easy to pick the
correct authorization module for the authtest utility.
2022-12-13 11:09:33 +00:00
metalefty
36f3c4307c
Merge pull request #2467 from matt335672/fix_slackbuild_missing_file
Add xrdp-sesman.system to distributed files
2022-12-13 09:23:48 +09:00
matt335672
cce78b0698
Merge pull request #2407 from alexpevzner/devel
LogFile=- redirects log to stdout, which is useful for debugging
2022-12-12 20:33:04 +00:00
matt335672
df83fbf9bf Fix const-correctness for g_system() 2022-12-12 19:52:27 +00:00
matt335672
ee8c4ddc2f Add xrdp-sesman.system to distributed files
Distributed file list also now sorted for ease of checking
2022-12-12 19:41:39 +00:00
Alexander Pevzner
5d6123a046 Documentation of log file redirection to <stdout> updated
Since multiple processes can write logs simultaneously, and there
is no explicit synchronization between them, logs redirected to
stdout may interleave. When logging to the disk file, synchronization
is obtained by using a combination of O_APPEND and O_SYNC flags when
log file is being opened, which is not possible when <stdout>
redirection is in use.

So documentation is updated to cleanly notify that this is debug-only
feature, not for regular use
2022-12-12 19:14:54 +03:00
metalefty
321f124c73
Merge pull request #2459 from matt335672/pcscd_sock_permissions
Set permissions on pcsc socket dir to owner only
2022-12-10 21:11:44 +09:00
matt335672
99ca31a546
Merge pull request #2463 from matt335672/cherry_pick_cves
Cherry pick cves
2022-12-09 18:27:38 +00:00
matt335672
6363d85e85 CVE-2022-23493
Check chansrv channel ID on a channel close

Prevent OOB read if an invalid channel ID is sent.
2022-12-09 18:11:03 +00:00
matt335672
7780fd4ccb CVE-2022-23484
Add check for RAIL window text size
2022-12-09 18:11:03 +00:00
matt335672
f2282db410 CVE-2022-23483
Sanitise channel data being passed from application

Avoids OOB read if the size field is incorrect.
2022-12-09 18:11:03 +00:00
matt335672
1e42426db5 CVE-2022-23482
Check minimum length of TS_UD_CS_CORE message
2022-12-09 18:11:03 +00:00
matt335672
bc6b052959 CVE-2022-23481
Add length checks to client confirm active PDU parsing
2022-12-09 18:11:03 +00:00
matt335672
b5b047458e Remove unused g_full_name_for_filesystem
Not only was this unused, the way it was read could lead to a
buffer overflow (CVE-2022-23480)
2022-12-09 18:11:03 +00:00
matt335672
ae7c17e1f6 CVE-2022-23480
Added length checking to redirector response parsing
2022-12-09 18:11:03 +00:00
matt335672
5d1cb432ca Changes to cope with trans->header_size being unsigned 2022-12-09 17:54:53 +00:00
matt335672
b1147f5faa CVE-2022-23479
Detect attempts to overflow input buffer

If application code hasn't properly sanitised the header_size
for a transport, it is possible for read requests to be issued
which overflow the input buffer. This change detects this
at a low level and bounces the read request.
2022-12-09 17:34:25 +00:00
matt335672
cea7313257 CVE-2022-23478
Fix potential OOB write if invalid chansrv channel opened

Also removed an unnecessary dynamic memory allocation
2022-12-09 17:33:54 +00:00
matt335672
96afae1ec5 CVE-2022-23477
Prevent buffer overflow for oversized audio format from client
2022-12-09 17:33:34 +00:00
matt335672
3dab2c23da CVE-2022-23468
Login window - replace g_sprintf() withl g_snprintf() calls
2022-12-09 17:33:06 +00:00
matt335672
89c873e4aa Set permissions on pcsc socket dir to owner only
There is no reason for any user other than the current one to be able
to communicate with the remote smartcard.
2022-12-09 11:55:31 +00:00
matt335672
e05d223462
Merge pull request #2443 from neutrinolabs/metalefty-patch-1
SECURITY.md: mention including GitHub account in vuln report
2022-12-01 09:34:12 +00:00
metalefty
790db4df03
SECURITY.md: mention including GitHub account in vuln report 2022-12-01 15:47:21 +09:00
matt335672
8fc5610dad
Remove unnecesssary data from struct auth_info (#2438)
When using PAM authentication, a copy is made of the username and password in the auth_info structure.

The password copy is not cleared from memory when the structure is deallocated. This could mean the password is revealed to an attacker from a coredump.

One solution is to clear the password when the struct is deallocated. However, the username and password in the auth_info struct are only required for the duration of the PAM conversation function. A better solution is to remove the username and password from the auth_info struct entirely, and just use pointers for the duration of the time the callback function is used.
2022-11-28 10:05:20 +00:00
matt335672
791db0998a
Merge pull request #2437 from matt335672/fix_font_use_after_free
Fix regression use-after-free
2022-11-23 11:13:51 +00:00
matt335672
4c8997f033 Fix regression use-after-free
93d97dcb introduced a use-after-free error. The default_font for the
window manager may be used as the font for the main window manager
painter, and so deleting the default_font may cause the painter to
access deallocated memory.

At the point xrdp_wm_init() is called, the only active painter
should be the window manager one.
2022-11-23 11:02:21 +00:00
matt335672
b0ab1c8529
Merge pull request #2425 from seflerZ/touchpad
Disable touch events on XVNC session
2022-11-21 10:02:53 +00:00
sefler
a2ac6b694a code refactored 2022-11-20 13:31:03 +08:00
sefler
fb34012482 change comments 2022-11-20 13:31:03 +08:00
sefler
94447752f2 use enum 2022-11-20 13:31:03 +08:00
sefler
e97a66593b Disabel touch events on XVNC session 2022-11-20 13:31:03 +08:00
matt335672
a63ce2bacd
Merge pull request #2435 from matt335672/fix_font_leak
Fix memory leak in font handler
2022-11-18 15:45:14 +00:00
matt335672
93d97dcb08 Fix memory leak in font handler
The following sequence of events results in a memory leak as a font
is loaded twice
1) Invoke login screen
2) Try to log in to session, which fails
3) Back to login screen

Fix is to make sure font is deleted before being reloaded.
2022-11-18 14:58:04 +00:00
matt335672
31de86f77a
Merge pull request #2427 from matt335672/check_ft_version
Fix freetype2 version checking
2022-11-16 09:32:08 +00:00