Skip to content

Conversation

azurelinux-security
Copy link
Contributor

@azurelinux-security azurelinux-security commented Oct 7, 2025

Auto Patch openssh for CVE-2025-61985, CVE-2025-61984.

Autosec pipeline run -> https://dev.azure.com/mariner-org/mariner-chatbot/_build/results?buildId=947824&view=results

Merge Checklist

All boxes should be checked before merging the PR (just tick any boxes which don't apply to this PR)

  • The toolchain has been rebuilt successfully (or no changes were made to it)
  • The toolchain/worker package manifests are up-to-date
  • Any updated packages successfully build (or no packages were changed)
  • Packages depending on static components modified in this PR (Golang, *-static subpackages, etc.) have had their Release tag incremented.
  • Package tests (%check section) have been verified with RUN_CHECK=y for existing SPEC files, or added to new SPEC files
  • All package sources are available
  • cgmanifest files are up-to-date and sorted (./cgmanifest.json, ./toolkit/scripts/toolchain/cgmanifest.json, .github/workflows/cgmanifest.json)
  • LICENSE-MAP files are up-to-date (./LICENSES-AND-NOTICES/SPECS/data/licenses.json, ./LICENSES-AND-NOTICES/SPECS/LICENSES-MAP.md, ./LICENSES-AND-NOTICES/SPECS/LICENSE-EXCEPTIONS.PHOTON)
  • All source files have up-to-date hashes in the *.signatures.json files
  • sudo make go-tidy-all and sudo make go-test-coverage pass
  • Documentation has been updated to match any changes to the build system
  • Ready to merge

Summary

What does the PR accomplish, why was it needed?

Change Log
Does this affect the toolchain?

YES/NO

Associated issues
  • N/A
Links to CVEs
Test Methodology

@microsoft-github-policy-service microsoft-github-policy-service bot added Packaging 3.0-dev PRs Destined for AzureLinux 3.0 labels Oct 7, 2025
Updated release number and added patches for CVE-2025-61984 and CVE-2025-61985.
@Kanishk-Bansal
Copy link
Contributor

Buddy Build

Updated version number and added patch for CVE-2025-61985 and CVE-2025-61984.
characters in url-encoded strings. Suggested by David Leadbeater, ok deraadt@

Signed-off-by: Azure Linux Security Servicing Account <[email protected]>
Upstream-reference: AI Backport of https://github.com/openssh/openssh-portable/commit/43b3bff47bb029f2299bacb6a36057981b39fdb0.patch
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fix is for CVE-2025-61985, would request for swapping the patch filenames. This patch looks fine.

if (isspace((u_char)s[i]) && s[i + 1] == '-')
return 0;
- /* Disallow \ in last position */
+ /* Disallow \\ in last position */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment change not required

if (*s == '-')
return 0;
for (i = 0; s[i] != 0; i++) {
+ if (iscntrl((u_char)s[i]))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only change in valid_ruser() looks sufficient to fix CVE-2025-61984. Rest all changes are not required as we are not expanding user in the openssh-9.8p1 version.

struct ssh *ssh = NULL;
int i, r, opt, exit_status, use_syslog, direct, timeout_ms;
int was_addr, config_test = 0, opt_terminated = 0, want_final_pass = 0;
+ int user_on_commandline = 0, user_was_default = 0, user_expanded = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As per my understanding the changes in main() in ssh,c and macro in sshconnect.h not required.

@mayankfz
Copy link
Contributor

@mayankfz
Copy link
Contributor

Patch applies cleanly with modification

  • Buddy Build
  • patch applied during the build (check rpm.log)
  • patch include an upstream reference
  • PR has security tag
  • ptest regression
14827

@Kanishk-Bansal Kanishk-Bansal marked this pull request as ready for review October 10, 2025 08:04
@Kanishk-Bansal Kanishk-Bansal requested a review from a team as a code owner October 10, 2025 08:04
@mayankfz mayankfz added the ready-for-stable-review PR has passed initial review and is now ready for a second-level stable maintainer review label Oct 10, 2025
if (*s == '-')
return 0;
for (i = 0; s[i] != 0; i++) {
+ if (iscntrl((u_char)s[i]))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As per the CVE description,
ssh in OpenSSH allows control characters in usernames that originate from certain possibly untrusted sources, potentially leading to code execution when a ProxyCommand is used. The untrusted sources are the command line and %-sequence expansion of a configuration file.
(A configuration file that provides a complete literal username is not categorized as an untrusted source.). As we haven't changed,

		if (!valid_ruser(options.user))
			fatal("remote username contains invalid characters");

Shouldn't we check the same way as it was done in the upstream patch like when user_expanded is not true, then we should allow that username?

	if ((user_on_commandline || user_expanded) &&
	    !valid_ruser(options.user))
		fatal("remote username contains invalid characters");

Which will allow complete literal username from configuration file. Or, @mayankfz, as per your analysis, that will be taken care by iscntrl((u_char)s[i]) itself?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the present code we are not expanding username, so that's why we do not need to use that code only, this code would have been introduced in some later version, so that's why we do not need the complete code. These changes are to only expand trusted sources only but we are not expanding in the current version, so in my opinion, changes are not required, only the valid_ruser will take care of it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3.0-dev PRs Destined for AzureLinux 3.0 AI Backport AutoPR-Security Packaging ready-for-stable-review PR has passed initial review and is now ready for a second-level stable maintainer review security

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants