Offensive Security
258 subscribers
101 photos
10 videos
23 files
120 links
I post what I read; I'm a low-level programmer with a focus on offensive security and redteam development.
Download Telegram
#Linux structure
CVE-2025-39727

CVE-2025-39727 is a security vulnerability in the Linux kernel, specifically within the memory management (mm) subsystem, affecting the swap handling mechanism. The issue occurs due to a potential buffer overflow in the setup_clusters() function. In the setup_swap_map() function, only bad pages within the range (0, last_page] are checked. However, if maxpages is less than last_page, setup_clusters() may access memory beyond its allocated buffer when processing a badpage with an index greater than or equal to maxpages. This can lead to undefined behavior, including system crashes, memory corruption, or privilege escalation under certain conditions.



Potential Impact

This vulnerability is serious because it resides in the Linux kernel, which operates at ring 0, giving full control over system resources. Potential consequences include:
1. Local Privilege Escalation (LPE):
• A user with local access could exploit this vulnerability to overwrite kernel memory structures, potentially gaining root privileges.
• Example: Modifying the cred structure of a process to escalate a low-privilege account to full administrative rights.
2. Denial of Service (DoS):
• The overflow may trigger a kernel panic, crashing the system.
• Example: A server handling swap-intensive workloads could become unavailable until rebooted.
3. Memory Corruption / Data Leakage:
• The buffer overflow could corrupt adjacent kernel memory, leading to unpredictable behavior. In some scenarios, it may allow reading sensitive kernel data.

Note: Unlike some other kernel vulnerabilities, remote exploitation is highly unlikely without local code execution, as attackers must influence the swap system or memory directly.



Technical Details

The vulnerability arises from improper bounds checking in setup_clusters():

// simplified conceptual example
for (i = 0; i < nr_badpages; i++) {
page = badpages[i];
// no check if page >= maxpages
clusters[page / CLUSTER_SIZE]++;
}


If badpages[i] >= maxpages, clusters[] is accessed out-of-bounds, leading to a heap or stack memory corruption.

This memory corruption can have multiple outcomes:
• Overwriting critical kernel structures → privilege escalation.
• Overwriting control data → kernel panic (DoS).
• In rare cases, manipulating data to execute code in kernel context (requires bypassing SMEP/SMAP/KASLR).



Example Scenario

1. A Linux server (e.g., Ubuntu 24.04) is running a vulnerable kernel.
2. An attacker has local access (low-privilege user or compromised process).
3. The attacker runs a crafted program that injects invalid badpage entries into the swap system, triggering the overflow in setup_clusters().
4. Consequences may include:
• Escalating privileges to root.
• Crashing the system (DoS).
• Potentially corrupting kernel memory or leaking sensitive data.





Reference:
https://nvd.nist.gov/vuln/detail/CVE-2025-39727
https://git.kernel.org/stable/c/152c1339dc13ad46f1b136e8693de15980750835

#Kernel #Linux
🔥1
Exploiting an array-Out-Of-Bounds vulnerability in the Linux network packet scheduler (CVE-2025-37752)

https://syst3mfailure.io/two-bytes-of-madness/

#CVE #Linux
usenix25-tlbsidechannel.pdf
1.1 MB
This is a research paper and it shows that some Linux kernel hardening tricks accidentally create TLB side-channel leaks that let an unprivileged attacker find where critical kernel objects live, for example heap objects, page tables and kernel stacks. The authors use allocator shaping plus Evict+Reload-style TLB measurements and show practical results on recent Intel CPUs and kernels.

این یه مقالهٔ تحقیقاتیه که نشون می‌ده چندتا از مکانیزم‌های سخت‌سازی کرنل لینوکس به صورت ناخواسته الگوهای نشتی توی TLB درست می‌کنن و با این کار می‌شه آدرس اشیای حساس کرنل مثل ساختارهای heap، جداول صفحه و استک کرنل رو لو داد. روش‌شون ترکیبیه از دستکاری تخصیص‌دهنده‌ها و اندازه‌گیری‌های شبیه Evict+Reload روی TLB و تو آزمایش‌ها روی پردازنده‌های جدید اینتل و کرنل‌های مدرن کار کرده.


#kernel #linux
👍2
Media is too big
VIEW IN TELEGRAM
100 Linux think you need to know

#kernel #linux
👍2
x86 Protection Rings Model

CPU Security Layers for Privilege Separation
In x86 architecture, Protection Rings divide code execution into 4 levels (from Ring 0 with highest CPL to Ring 3 with lowest) to prevent unauthorized access to sensitive resources. This model operates via segment descriptors in the GDT and privilege checks (e.g., DPL).

Ring 0 (Kernel Mode):
Full access to CPU and memory; manages scheduler, paging, and interrupts. Only trusted code executes here.

Ring 1 (Driver Mode):
Medium privilege for device drivers; access to I/O ports and DMA, but limited to secure transitions.

Ring 2:
Legacy and rare; for specific execution domains.

Ring 3 (User Mode):
User applications; restricted to non-privileged instructions and system calls (via SYSCALL/INT).


@GoSecurity
#os #linux #cpu #ring_model #privilege
👍3
Linux-basic.pdf
822.4 KB
Linux Tutorial

This research used the ALICE High Performance Computing Facility at the University of Leicester

@GoSecurity
#linux #lpic
Offensive Security
ریپوی زیر یک رودمپ خوب و عملی برای یادگیری C ارائه می‌ده؛ از پروژه‌های کوچک تا مفاهیم عمیق. برای رسیدن به جایگاه سنیور در ردتیمینگ، تسلط روی یه زبان سطح پایین یک الزام واقعیه. اگر از امروز شروع کنی، تا پایان سال ۴۰۴ به درک قابل‌قبولی از زبان‌های سطح‌پایین…
تو یادگیری C با گرایش offensive، تمرکز اصلی روی systems programming و exploit development هستش.
چندتا مثال از مباحثی‌هایی که باید بلد باشید میزنم ولی قطعا کامل نیست و باید برید دنبالش و خودتون تهشو دربیارید اما بهتون یک دید نسبی میده.





1) Memory Management and Pointers

• مدل حافظه: stack، heap، data segments
• ساختار stack frame و چیدمان متغیرها
• pointer arithmetic و مدیریت ایمن پوینتر
• انواع خطاهای حافظه: UAF، OOB، double free، heap corruption
• رفتار allocatorها: glibc malloc، ptmalloc، Windows Heap
• اصول PIC و کدنویسی غیر وابسته به آدرس
• ASLR bypass
• DEP bypass
• ROP chain basics



2) Syscalls and Direct Kernel Interaction

• تفاوت API سطح‌بالا با syscall
• استفاده از raw syscall
• الگوهای indirect syscall و syscall stubbing
• رجیسترها و calling convention ویندوز در syscall
• رجیسترها و calling convention لینوکس در syscall
• inline assembly برای کنترل مسیر اجرای سطح پایین



3) Assembly and Reverse Engineering

• تسلط بر x86/x64 در Intel و AT&T
• تفاوت inline asm در GCC/Clang/MSVC
• تفاوت calling convention در ویندوز و لینوکس
• ساخت کد PIC و شل‌کد
• تحلیل خروجی اسمبلی کامپایلر
• شناسایی Hookها در DLLها و تفاوت IAT/Inline
• IDA Pro
• Ghidra
• Binary Ninja
• DWARF / PDB basics



4) Networking and Protocols

• کار با Winsock و Berkeley Sockets
• ساخت و استفاده از Raw Sockets
• طراحی پروتکل باینری اختصاصی
• ایجاد Covert Channels
• تنظیم beacon jitter
• الگوهای Traffic Shaping و domain fronting
• TLS/SSL
• crypto libs در C
• shared library hijacking (LD_PRELOAD / LD_AUDIT)
• DLL search‑order hijacking
• systemd service persistence
• cron + at jobs



5) File I/O and Persistence

• memory mapping با mmap / MapViewOfFile
• ذخیره‌سازی در : ADS، cache، Registry
• پایدار کردن دسترسی در سطح یوزر اسپیس
• مفهوم rootkit در یوزر اسپیس
• ساختارهای کلی روتکیت تو کرنل اسپیس
و DKOM
• CreateRemoteThread
• APC injection
• process hollowing
• reflective DLL injection



6) Executable File Formats (PE / ELF)

• ساختارهای PE و ELF
• manual mapping
• reflective loading
• relocation و import resolution
• اجرای memory-only



7) Code Obfuscation

• string encryption
• API hashing
• control flow flattening
• opaque predicates
• MBA transformations
• junk code insertion
• anti-debugging techniques
• timing checks
• hardware breakpoints detection
• anti-VM / anti-sandbox
• exception-based checks




8)
Linux Internals

• ساختار ELF زمان load شدن و نقش ld.so در dynamic linking
• جریان resolve شدن symbol از طریق PLT/GOT
• لایه‌ی syscall در لینوکس (glibc wrapper، direct syscall، VDSO)
• مدل memory layout پروسه‌ها شامل stack، heap، anon maps، VDSO
• رفتار ptrace و سطح دسترسی debugger نسبت به رجیسترها و memory
• مکانیزم seccomp-bpf و محدودیت‌های syscalls در sandbox
• معماری LSM مثل AppArmor و SELinux و نقش آن‌ها در enforcement
• ساختار audit subsystem و eventهای قابل مانیتور
• رفتار loader در اجرای باینری‌های PIE و نحوهٔ ASLR لینوکس
• فایل‌های کلیدی procfs برای enumeration و injection
• مدل threading لینوکسی مبتنی بر NPTL
• ساختار cgroup و namespaceها برای isolation و evasion
• تکنیک‌های user-mode hooking در لینوکس
• سطح حملهٔ kernel شامل syscall table، kprobes، eBPF، module loading
• تعامل با /dev/mem و /proc/kcore برای RE و memory analysis
• basic filesystem internals



9) Windows Internals

• تفاوت Win32 API و NTAPI
• دسترسی مستقیم به NTAPI
• ساختار PEB و TEB و روش‌های دسترسی مستقیم
• رفتار loader در بارگذاری PE
• تعامل ETW با رفتار پردازه
• مکانیزم‌های AMSI و WLDP
• مبانی kernel debugging (WinDbg)
• driver development
• SSDT hooking
• Ring 0 exploits
• Thread hiding techniques




10) Multithreading

• ایجاد thread در Win32 API و NTAPI
• استفاده از TLS
• sync: mutex، semaphore، critical section، atomic ops
• ‌I/O: blocking، non‑blocking، overlapped، IOCP
• thread-based vs event-driven


ساختار می‌تونه بسته به هدف شما تغییر کنه و حتی بعضی از مبحث‌ها حذف یا چیزهای جدیدی بهش اضافه بشه. اول باید مشخص کنید دقیقاً دنبال چه کاری هستید، بعد بر اساس اون مسیر مناسب رو انتخاب کنید.

@GoSecurity
#exploit
#low_level
#linux #windows
#security
🚨 آسیب‌پذیری اجرای کد از راه دور (RCE) در ابزار امنیتی ImunifyAV / Imunify360 میلیون‌ها وب‌سایت میزبانی‌شده روی لینوکس را در معرض خطر قرار داده است.

ImunifyAV چیست؟

ابزاری امنیتی برای سرورهای لینوکسی است که کارهای زیر را انجام می‌دهد:

• اسکن و پاک‌سازی بدافزار
• تشخیص فایل‌های مخرب، backdoorها و web‑shellها
• محافظت از سرورهای cPanel، DirectAdmin و محیط‌های هاست اشتراکی
• استفاده توسط شرکت‌های هاستینگ برای امن نگه‌داشتن سایت‌های مشتری‌ها

این ابزار توسط ده‌ها میلیون سایت استفاده می‌شود و یکی از Anti-Malwareهای سمت سرور لینوکس است.


جزئیات آسیب‌پذیری

یک باگ خطرناک در کامپوننت AI‑Bolit (موتور اسکن بدافزار زیرمجموعه Imunify) شناسایی شده که باعث می‌شود مهاجم بتواند:
• کد دلخواه را روی سرور اجرا کند (RCE)
• فایل‌ها را تغییر دهد یا برنامه اجرا کند
• کل محیط هاست یا حتی چندین سایت روی یک سرور را compromise کند

مشکل از جایی می‌آید که موتور deobfuscation فایل‌های مشکوک، تابع‌هایی را اجرا می‌کند که مهاجم می‌تواند خودش تعیین کند؛ بدون هیچ‌گونه بررسی امنیتی.
این یعنی مهاجم قادر است توابع خطرناک PHP مانند:
system, exec, shell_exec, passthru, eval
را از طریق اسکنر فراخوانی کند.

در نسخهٔ مستقل AI‑Bolit این قابلیت خاموش است، اما وقتی داخل Imunify360 فعال می‌شود، در همهٔ حالت‌های اسکن به‌صورت پیش‌فرض فعال است.


• ابزار Imunify روی بیش از ۵۶ میلیون وب‌سایت نصب است.
• شدت آسیب‌پذیری Critical (امتیاز CVSS حدود ۸.۱–۸.۲) گزارش شده است.

آسیب‌پذیری در AI‑Bolit قبل از نسخهٔ v32.7.4.0 وجود دارد.
برای رفع مشکل باید به v32.7.4.0 یا بالاتر آپدیت شود.


اگر آپدیت امکان پذیر نیست:
• اجرای اسکنر با کمترین مجوزها
• محدود کردن دسترسی شبکه
• بررسی لاگ برای رفتارهای مشکوک توصیه می‌شود.

جزئیات بیشتر:

bleepingcomputer.com
patchstack.com
esecurityplanet.com

@GoSecurity
#Linux #ImunifyAV #RCE #ServerSecurity #CVE #Infosec
Linux Reverse Engineering and Exploitation



❗️Key Learning Objectives

Linux Architecture & Security: processes, memory,
permissions, protections

Vulnerability Types: buffer overflows, integer overflows, format strings, privilege escalations

Reverse Engineering:
assembly basics, binary disassembly, decompilation

Practical Exploitation:
bypassing ASLR, stack canaries, NX, and RELRO

ROP & Shellcoding: return-oriented programming techniques and writing basic shellcodes

Hands-on CTF Challenges:
PicoCTF, TryHackMe, OverTheWire (Narnia), ROP Emporium


https://github.com/akazemi67/Linux-Exploit-Development-Course
https://t.iss.one/OxAA55


@GoSecurity
#Linux #exploit #RE #linux_internals
Media is too big
VIEW IN TELEGRAM
Linux File System Structure Explained From Root (/) to /usr

Topics covered in this video include:

1. What the root directory (/) is and how the Linux filesystem tree is structured
2. The role of essential folders like /bin and /sbin for core system commands
3. The importance of the /etc directory for configuration and system settings
4. How user-specific files and personal data are organized inside /home
5. Why /var stores logs, databases, caches, and other changing system data
6. The purpose of /tmp for temporary files and safe-to-delete data
7. A detailed look at /usr, one of the largest and most important directories in Linux
8. What lives inside /dev and how Linux represents hardware as files
9. Why /boot is required for the system to start properly
10. How all these directories interact to create a stable, flexible, and secure Linux environment


@GoSecurity
#Linux #FHS #FileSystem #root
2
This is why Linux succeeded as an open source project.

@GoSecurity
#linux
This cve addresses a vulnerability in sudo versions 1.9.14 to 1.9.17, enabling unauthorized local privilege escalation to root access.

https://github.com/Nowafen/CVE-2025-32463

@GoSecurity
#CVE #LPE #Linux #exploit
👾2
Linux Malware Sample Archive including various types of malicious ELF binaries and viruses. Be careful!

https://github.com/MalwareSamples/Linux-Malware-Samples

@GoSecurity
#Linux #malware
👾2
SHA256:
13d2a8cc4f0371786724a1c76452ef1b819de90455b80ef01461f09cf8ae5f87



@GoSecurity
#analysis #source #trojan #elf #linux #persistence #malware