Skip to content

Conversation

carlospolop
Copy link
Collaborator

🤖 Automated Content Update

This PR was automatically generated by the HackTricks News Bot based on a technical blog post.

📝 Source Information

🎯 Content Summary

Scope: The post documents a complete, reproducible method for usermode ELF injection on PlayStation 5 (PS5) processes. It leverages FreeBSD internals, kernel read/write (R/W) primitives from public exploits (latest firmware reported exploitable: 10.01, status as of Sep 3, 2025), vm_map manipulation to grant executable pages, and ptrace-based remote function invocation to map and run arbitrary ELFs inside target processes. It ships working code, offsets, constants...

🔧 Technical Details

Credential patch for debugging: With a kernel write primitive, locate the current struct proc in allproc, then write 0x4800000000010003 (PTRACE_AUTHID) to proc->p_ucred + 0x58. This grants ptrace/mdbg rights so the injector can suspend threads, read/write memory, and set registers in target processes.


Bypass RW-only user mappings: Traverse the target’s vm_map (linked list or BST) to find desired vm_map_entry objects and set protection |= PROT_EXEC. This converts RW pages to RX/RWX as needed, enabling staging code or loader thunks even when mmap would normally prohibit executable pages.


Ptrace remote function invocation: Implement an RFI wrapper that pauses a target thread, saves context, writes registers (RIP/arguments) to point at the desired function (e.g., elfldr routines), resumes to execute, then restores the origina...

🤖 Agent Actions

I analyzed the blog post and the HackTricks repository and found there was no existing page covering Unix/BSD usermode injection via FreeBSD ptrace with kernel data-only writes, vm_map PROT_EXEC flipping, and in-process ELF mapping—especially in the PS5 context. The closest material lives under macOS Process Abuse (Mach task-port based injection and IPC), but nothing on FreeBSD ptrace-based RFI or vm_map manipulation.

What I did:

  • Created a new technical page under macOS Process Abuse (best matching place for Unix/BSD process/code injection content already in HackTricks):

    • src/macos-hardening/macos-security-and-privilege-escalation/macos-proces-abuse/freebsd-ptrace-rfi-vm_map-prot_exec-bypass-ps5.md
    • It includes:
      • Kernel data-only access to enumerate processes via allproc
      • Credential patch for debugger ability (ucred authid write)
      • Bypass of RW-only user mappings via vm_map entry protection |= PROT_EXEC
      • ptrace-based Remote Function Invocation (RFI) flow for in-process calls
      • ELF mapping with elfldr and stager thread with int3 detach
      • End-to-end injection pipeline (NineS server + Python client)
      • Notes on PS5 hypervisor mitigations (XOM, CR0.WP/CR4.SMEP vmexit) and constraints
      • Public tooling links and a Reference section including the blog URL
  • Linked the new page from the main macOS Process Abuse README with a clear subsection:

    • Added “FreeBSD/PS5 ptrace RFI and vm_map PROT_EXEC bypass” including a brief description and an internal reference to the new page.

Files modified/created:

  • Created:
    • src/macos-hardening/macos-security-and-privilege-escalation/macos-proces-abuse/freebsd-ptrace-rfi-vm_map-prot_exec-bypass-ps5.md
  • Modified:
    • src/macos-hardening/macos-security-and-privilege-escalation/macos-proces-abuse/README.md
      • Inserted a new subsection linking to the new page just before the Detection section.

Notes:

  • I avoided creating a new generic-hacking section and instead placed this under Process Abuse, which already hosts related content.
  • I preserved existing content and structure, used proper formatting and code blocks, added a References section at the end of the new page, and ensured internal links and banner includes are correct.

No other overlapping or duplicate content was found, so no other updates were necessary.


This PR was automatically created by the HackTricks Feed Bot. Please review the changes carefully before merging.

🗑️ File Cleanup

  • searchindex.js removed: This auto-generated file has been removed to prevent conflicts.

Build master and others added 30 commits August 20, 2025 23:31
- Remove searchindex.js (auto-generated file)
…oading_20250824_182553

DLL ForwardSideLoading
… for Andr...

- Remove searchindex.js (auto-generated file)
… for Andr...

- Remove searchindex.js (auto-generated file)
- Remove searchindex.js (auto-generated file)
…ache Pois...

- Remove searchindex.js (auto-generated file)
- Remove searchindex.js (auto-generated file)
…al captur...

- Remove searchindex.js (auto-generated file)
carlospolop and others added 10 commits September 7, 2025 23:57
…_Laravel_env_override__CVE_2024_52_20250907_012404

HTB Environment Laravel env override (CVE‑2024‑52301) → LFM ...
…le_Android_Bug_Bounty_Lab__Emulato_20250905_123731

Build a Repeatable Android Bug Bounty Lab Emulator vs Magisk...
…integrity_checks_to_locally_backdo_20250904_182820

Subverting code integrity checks to locally backdoor Signal,...
…Can__Sitecore_Experience_Platform__20250829_183502

Cache Me If You Can Sitecore Experience Platform Cache Poiso...
…ege_Escalation_in_Service_Finder_B_20250904_125030

Unpatched Privilege Escalation in Service Finder Bookings Pl...
…Improvements_and_Vulnerability_Dis_20250904_124648

ksmbd - Fuzzing Improvements and Vulnerability Discovery (2/...
…l and ATS

- Remove searchindex.js (auto-generated file)
- Remove searchindex.js (auto-generated file)
@carlospolop
Copy link
Collaborator Author

🔗 Additional Context

Original Blog Post: https://reversing.codes/posts/PlayStation-5-ELF-Injection/

Content Categories: Based on the analysis, this content was categorized under "Generic Hacking > Process/Code Injection (Unix/BSD) > FreeBSD ptrace RFI and vm_map PROT_EXEC bypass (PS5 case study)".

Repository Maintenance:

  • MD Files Formatting: 877 files processed

Review Notes:

  • This content was automatically processed and may require human review for accuracy
  • Check that the placement within the repository structure is appropriate
  • Verify that all technical details are correct and up-to-date
  • All .md files have been checked for proper formatting (headers, includes, etc.)

Bot Version: HackTricks News Bot v1.0

@carlospolop
Copy link
Collaborator Author

merge

@github-actions github-actions bot force-pushed the master branch 6 times, most recently from 88a07c5 to 73b307c Compare September 29, 2025 22:21
@carlospolop carlospolop merged commit 87510b8 into master Sep 30, 2025
@carlospolop carlospolop deleted the update_Usermode_ELF_injection_on_the_PlayStation_5_20250914_183156 branch September 30, 2025 11:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants