
KASLD एक स्थानीय प्रक्रिया से Linux kernel के virtual और physical memory layout को derandomize करता है, जो भी उसका vantage — privilege, configuration, और confinement — अनुमति देता है, उसका उपयोग करके।
<p align="center">
<img src="https://assets.kitploit.com/production/public/readmes/48542/27960c6a9cf0003d33879e796f71de7930ff461d87e9c6333b9522d822615306.png" alt="KASLD logo generated with Copilot (cropped)"/>
</p>
<p align="center">
<img src="https://github.com/bcoles/kasld/actions/workflows/build.yml/badge.svg" alt="Build Status"/>
<img src="https://github.com/bcoles/kasld/actions/workflows/codeql.yml/badge.svg" alt="CodeQL"/>
<img src="https://img.shields.io/badge/platform-Linux-informational" alt="Platform: Linux"/>
<img src="https://img.shields.io/badge/arch-x86%20%C2%B7%20ARM%20%C2%B7%20MIPS%20%C2%B7%20PPC%20%C2%B7%20RISC--V%20%C2%B7%20LoongArch%20%C2%B7%20s390-blue" alt="Architectures"/>
<img src="https://img.shields.io/badge/C-C99-blue.svg" alt="C99"/>
<img src="https://img.shields.io/github/v/release/bcoles/kasld" alt="Release"/>
<img src="https://img.shields.io/badge/License-MIT-blue.svg" alt="License: MIT"/>
</p>
KASLD एक स्थानीय प्रक्रिया से Linux kernel के virtual और physical memory layout — मुख्य रूप से kernel text base — को पुनः प्राप्त करता है। यह क्या पुनः प्राप्त कर सकता है, यह उस प्रक्रिया के vantage का फलन है: उसके privileges और capabilities, सिस्टम का configuration, और कोई भी container confinement। जहाँ कोई leak या side channel अनुमति देता है, वहाँ यह base को सीधे पुनः प्राप्त कर लेता है, और अन्यथा इसे उन placements के सबसे छोटे समूह तक सीमित कर देता है जिनका उपलब्ध साक्ष्य समर्थन करता है।
inference engine दर्जनों स्वतंत्र तकनीकों के साक्ष्य को architecture के ज्ञात invariants के साथ संयोजित करता है, और kernel के placement को एक residual window तक सीमित कर देता है — जिसे शेष बचे *slots* की संख्या (वे placements जो KASLR चुन सकता था) और उनके द्वारा दर्शाए गए entropy के bits के रूप में रिपोर्ट किया जाता है: इस vantage से KASLR जिस सुरक्षा को बनाए रखता है उस पर एक upper bound, न कि इस बात की गारंटी कि base attacker की पहुँच से बाहर है (देखें
[docs/limitations.md](https://github.com/bcoles/kasld/blob/master/docs/limitations.md))।
एक hardened target पर पूर्ण recovery अक्सर असंभव होती है — ऐसा target जहाँ कोई सीधा kernel-text leak शेष नहीं बचता और उसके architecture और CPU द्वारा उजागर किए गए side channels बंद कर दिए जाते हैं — लेकिन constraint set शायद ही कभी खाली होता है। KASLR रहित architectures पर, engine bootloader द्वारा चुने गए load address का पता लगाता है।
समर्थित:
* x86 (i386+, amd64)
* ARM (armv6, armv7, armv8, aarch64)
* MIPS (mipsbe, mipsel, mips64, mips64el)
* PowerPC (ppc, ppcle, ppc64, ppc64le)
* RISC-V (riscv32, riscv64)
* LoongArch (loongarch64)
* s390
## त्वरित शुरुआत
```sh
sudo apt install libc-dev make gcc binutils git
git clone https://github.com/bcoles/kasld
cd kasld
make
./build/<arch>/kasld
```
`build/<arch>/` निर्देशिका self-contained है और इसे किसी target system पर deploy किया जा सकता है:
```
build/<arch>/
kasld <- run this
components/ <- leak components
```
एक hardened configuration (`kernel.dmesg_restrict=1`,
`kernel.kptr_restrict=1`, `kernel.perf_event_paranoid=2` या उससे अधिक,
`kernel.unprivileged_bpf_disabled=1`, और `%pK` pointer hashing) filesystem-oracle
पथ को संकीर्ण कर देती है, लेकिन यह vantage का केवल एक अक्ष है:
side-channel, weak-entropy, और capability-granted तकनीकें इन sysctls से स्वतंत्र हैं। परीक्षण के लिए,
[extra/weaken-kernel-hardening](https://github.com/bcoles/kasld/blob/master/extra/weaken-kernel-hardening) स्क्रिप्ट
इन सेटिंग्स को अस्थायी रूप से शिथिल कर सकती है (root आवश्यक)।
## उदाहरण आउटपुट
डिफ़ॉल्ट text mode एक answer-first overview प्रिंट करता है:
```
KASLD 0.4.2-dev -- Kernel Address Space Layout Derandomization
Target: x86_64 / 7.0.0
Running 117 of 120 components (3 experimental skipped; use -x to enable)...
[####################] 100% 117/117 40.9s
1 component timed out after 30s and was killed (prefetch_directmap)
Quantity Certainty Window Candidates Grain
------------------- ---------- --------------------------------------- ---------------- -----
Virtual Image Base guaranteed 0xffffffff81000000 - 0xffffffffbd400000 483 of 512 2 MiB
Virtual Image Base likely 0xffffffff93400000 slide +0x12400000 1 2 MiB
Physical Image Base guaranteed 0x1000000 - 0x3d400000 474 2 MiB
Physical Image Base likely 0x1000000 - 0x3c29d000 474 2 MiB
Direct Map Base guaranteed 0xffff800000000000 - 0xffffa4aa80000000 37,547 1 GiB
Vmalloc Base guaranteed 0xffff898000000000 - 0xffffd6d580000000 79,191 of 79,191 1 GiB
Vmemmap Base guaranteed 0xffffa98040000000 - 0xfffffd0000000000 85,504 1 GiB
Module Region Base guaranteed 0xffffffffa0000000 - 0xffffffffff000000 389,121 4 KiB
Module Region Base likely 0xffffffffc0000000 - 0xffffffffc0400000 1,025 4 KiB
Paging Level guaranteed 48 1 of 2 -
Note: physical and virtual text randomize independently
Note: 1 sub-range excluded from the windows above; the counts
already reflect them (-v lists the ranges).
Evidence (1 finding, 2 components)
Region Position Address Sources
----------------- -------- ------------------ -------
virt kernel image base 0xffffffff93400000 2
[-v: detailed results, memory map, system info] [-H: hardening assessment]
```
`Certainty` कॉलम एक ही quantity के बारे में दो भिन्न दावों को अलग करता है। एक **guaranteed** पंक्ति सिद्ध है: वास्तविक मान उस window के भीतर स्थित है। एक **likely** पंक्ति वह एकल सर्वोत्तम अनुमान है जिसका साक्ष्य समर्थन करता है —
हमेशा guaranteed window का एक उपसमुच्चय, और यह गलत हो सकती है, क्योंकि यह soundness floor से नीचे के संकेतों जैसे timing side channels पर आधारित होती है। सीधे कार्रवाई योग्य परिणाम एक `guaranteed` पंक्ति है जो एक candidate तक संकीर्ण हो; एक `likely` मान पुष्टि करने योग्य एक सुराग है, भरोसा करने योग्य तथ्य नहीं।
`-v` पूर्ण verbose readout जोड़ता है (banner, system-config block,
per-component logs, KASLR analysis, memory-layout maps)। `-j` machine-readable JSON उत्सर्जित करता है — पूर्ण structured view, जिसमें हमेशा per-component records और hardening assessment शामिल होते हैं। `-1` एकल shell-pipeable पंक्ति उत्सर्जित करता है। `-m` issue trackers के लिए प्रारूपित करता है। `-H` text/markdown रिपोर्टों में hardening assessment जोड़ता है।
पूर्ण CLI, output-mode विवरण, explain mode, और hardening assessment के लिए [docs/usage.md](https://github.com/bcoles/kasld/blob/master/docs/usage.md) देखें।
## Vantage
KASLD क्या पुनः प्राप्त कर सकता है यह चल रही प्रक्रिया के *vantage* पर निर्भर करता है — एकल privilege स्तर नहीं, बल्कि तीन स्वतंत्र चीज़ों का संयोजन:
* **Privileges, groups, और capabilities** — एक unprivileged uid, किसी समूह जैसे `adm` में सदस्यता (जो `/var/log/` के अंतर्गत kernel logs प्रदान करती है), एक container task जिसके पास अतिरिक्त capability हो, या root। ये एकल सीढ़ी नहीं बनाते, क्योंकि filesystem permissions प्रत्येक स्रोत को स्वतंत्र रूप से gate करती हैं: `CAP_SYS_RAWIO` प्रदान किया गया container उस जाँच के लिए init-namespace root होता है और `/proc/kcore` पढ़ सकता है — एक leak जिस तक साधारण उपयोगकर्ता नहीं पहुँच सकता — जबकि distributions इस बात पर भिन्न होते हैं कि कोई फ़ाइल जैसे `/boot/System.map` world-readable है या नहीं।
* **System configuration** — `kptr_restrict`, `dmesg_restrict`,
`perf_event_paranoid`, unprivileged BPF, kernel lockdown। Configuration privilege से स्वतंत्र है: root `kptr_restrict=2` के अंतर्गत `/proc/kallsyms` नहीं पढ़ सकता, जबकि एक शिथिल sysctl या unprivileged BPF एक साधारण उपयोगकर्ता को वह leak दे सकता है जिसे एक hardened system अस्वीकार कर देगा।
* **Confinement** — एक namespace या seccomp sandbox जो `/proc`
oracles को छिपाता है या syscalls को अवरुद्ध करता है, जिससे किसी भी privilege स्तर का अवलोकन संकीर्ण हो जाता है।
तीनों अक्ष प्रत्येक leak source को स्वतंत्र रूप से gate करते हैं — इसलिए अधिक privilege कम का superset नहीं है: configuration root को एक स्रोत से वंचित कर सकती है, और side channels sysctls को पूरी तरह bypass कर देते हैं। [docs/usage.md](https://github.com/bcoles/kasld/blob/master/docs/usage.md#vantage) में एक leak-source-by-gate matrix है जो दर्शाती है कि प्रत्येक स्रोत को कौन सा अक्ष नियंत्रित करता है।
KASLD डिफ़ॉल्ट रूप से कम privileges मानता है और vantage जो भी प्रदान करता है उसका opportunistically उपयोग करता है। रिपोर्ट किया गया *guaranteed* window कभी privilege पर निर्भर नहीं करता: elevated access या एक कमज़ोर configuration यह विस्तारित कर सकती है कि क्या प्रयास किया जाता है, कभी वह sound layout नहीं जिसे साक्ष्य सिद्ध करता है। verbose (`-v`),
JSON (`-j`), और Markdown (`-m`) आउटपुट पता लगाए गए vantage की रिपोर्ट करते हैं —
container, confinement, readable oracles, और वर्तमान capabilities से पहुँच योग्य capability-gated leaks।
## दस्तावेज़ीकरण
KASLD में नए हैं? क्रम में पढ़ें: [docs/kaslr.md](https://github.com/bcoles/kasld/blob/master/docs/kaslr.md) (KASLR क्या है और
यह क्या randomize करता है) → [docs/architecture.md → A leak from end to
end](https://github.com/bcoles/kasld/blob/master/docs/architecture.md#a-leak-from-end-to-end) (KASLD एक leak को उत्तर में कैसे बदलता है) → [docs/limitations.md](https://github.com/bcoles/kasld/blob/master/docs/limitations.md) (एक परिणाम क्या सिद्ध करता है और क्या नहीं) → [CONTRIBUTING.md](https://github.com/bcoles/kasld/blob/master/CONTRIBUTING.md) (एक leak component या
inference rule जोड़ें)। नीचे दी गई तालिका विषय के अनुसार docs को अनुक्रमित करती है।
| विषय | दस्तावेज़ |
|---|---|
| KASLR प्राइमर | [docs/kaslr.md](https://github.com/bcoles/kasld/blob/master/docs/kaslr.md) — per-arch KASLR history, default text base, vmsplit, FG-KASLR |
| Usage और CLI | [docs/usage.md](https://github.com/bcoles/kasld/blob/master/docs/usage.md) — CLI, output modes, explain mode, hardening assessment |
| परिणामों की व्याख्या | [docs/limitations.md](https://github.com/bcoles/kasld/blob/master/docs/limitations.md) — एक negative या partial परिणाम का क्या अर्थ है: sound-but-not-complete, और क्यों एक विफलता सुरक्षा गारंटी नहीं है |
| Bypass तकनीकें | [docs/bypass-techniques.md](https://github.com/bcoles/kasld/blob/master/docs/bypass-techniques.md) — filesystem leaks, side-channels, syscall / ioctl leaks, weak entropy, patched CVEs, arbitrary read |
| Exploitation | [docs/exploitation.md](https://github.com/bcoles/kasld/blob/master/docs/exploitation.md) — KASLR-defeat एक exploit में कहाँ फिट होता है, control-flow vs data-only, pwntools template, `ksymoff` |
| Footprint और detection | [docs/footprint.md](https://github.com/bcoles/kasld/blob/master/docs/footprint.md) — एक monitored host पर एक run कैसा दिखता है: इसे पहचानने के लिए behavioural signature, और operator की OPSEC लागत; डिज़ाइन से ही मुखर |
| Utilities | [extra/README.md](https://github.com/bcoles/kasld/blob/master/extra/README.md) — `extra/` helper scripts (capture/replay, soundness validation, posture-diff, `ksymoff`) और वे कैसे संयोजित होते हैं |
| Architecture और internals | [docs/architecture.md](https://github.com/bcoles/kasld/blob/master/docs/architecture.md) — inference engine, data-flow seams, tagged-line protocol, cross-region derivation |
| Soundness | [docs/soundness.md](https://github.com/bcoles/kasld/blob/master/docs/soundness.md) — रिपोर्ट किया गया window क्या गारंटी देता है, औपचारिक गुणों के रूप में: प्रत्येक quantity जिस lattice को दर्शाती है, एक rule पर obligation, truth containment, confidence floor, termination bound |
| योगदान | [CONTRIBUTING.md](https://github.com/bcoles/kasld/blob/master/CONTRIBUTING.md) — एक component या rule लिखना, emitter API, exit codes, metadata |
| JSON schema | [docs/kasld.schema.json](https://github.com/bcoles/kasld/blob/master/docs/kasld.schema.json) — `-j` दस्तावेज़ एक JSON Schema के रूप में: इसके विरुद्ध एक ingested snapshot को validate करें, या इससे types generate करें। `schema_version` और इसका compatibility rule [docs/usage.md](https://github.com/bcoles/kasld/blob/master/docs/usage.md#json--j) में हैं |
| Testing और CI | [docs/testing.md](https://github.com/bcoles/kasld/blob/master/docs/testing.md) — host tests, replay fixtures, qemu-user के अंतर्गत cross-arch, coverage |
| Reproducibility | [docs/reproducibility.md](https://github.com/bcoles/kasld/blob/master/docs/reproducibility.md) — स्वतंत्र सत्यापन: स्थानीय kernel पर, architectures में live, या captured corpus पर |
## बिल्ड करना
`_GNU_SOURCE` macro का समर्थन करने वाला compiler आवश्यक है क्योंकि
non-portable code (`MAP_ANONYMOUS`, `getline()`, `popen()`, …) का उपयोग किया गया है।
```
make # build kasld + components
make run # build and run
make test # build and run unit tests
make cross # cross-compile for all supported architectures
make install # install to /usr/local (PREFIX=/usr/local)
make install-strip # install, then strip the installed binaries
make installcheck # smoke-test the installed bin/kasld + libexec/kasld/
make uninstall # remove installed files
make clean # remove build directory
make print-deps # list build dependencies (libs + per-component flags)
make help # show all targets and options
```
`COMPONENTS` एक build को glob से मेल खाने वाले components तक सीमित करता है, इसलिए एक target जो केवल कुछ ही तकनीकें चला सकता है, केवल वही ship करता है। Patterns components को नाम देते हैं और comma- या space-separated होते हैं, उसी रूप में जो `--skip` flag लेता है; किसी से मेल न खाने वाला pattern build को रोक देता है बजाय चुपचाप इसे संकीर्ण करने के। Unset होने पर, हर component बनाया जाता है।
```
make cross COMPONENTS='dmesg_*,sysfs_devicetree_*,devicetree_facts,proc_*'
```
Components installed size का अधिकांश हिस्सा हैं, इसलिए एक selection एक छोटे rootfs के लिए लीवर है — और यह build को अनुपात में कम कर देता है, जो सत्रह targets में बड़ी बचत है।
`CC` की तरह, selection invocation की है न कि tree की: इसके बिना चलाया गया `install` या `install-strip` सब कुछ rebuild और install करता है, इसलिए इसे उन्हें भी पास करें।
```
make install-strip COMPONENTS='dmesg_*,proc_*' DESTDIR=/staging PREFIX=/usr
```
`make print-deps` आवश्यक toolchain, दो optional libraries
(`pthread`, `zlib`) और वर्तमान compiler के लिए उनके auto-detection परिणाम, और per-component compile/link flag अपवादों की रिपोर्ट करता है — एक distribution package की control file को Makefile की probe logic पढ़े बिना populate करने के लिए पर्याप्त।
`make installcheck` installed `bin/kasld` चलाता है और पुष्टि करता है कि यह FHS `../libexec/kasld` पथ के माध्यम से अपने components खोज लेता है — split-install layout के लिए एक post-install smoke test, जो `make install` के समान `PREFIX`/`DESTDIR` का उपयोग करता है (इसलिए यह package CI में `DESTDIR` staging root के विरुद्ध भी काम करता है)।
`make install` `kasld` और `ksymoff` के लिए `man1` manual pages भी
`<prefix>/share/man/man1/` में install करता है, इसलिए install के बाद `man kasld` और `man ksymoff` काम करते हैं।
KASLD को उपयुक्त compiler (`CC`) निर्दिष्ट करके `make` के साथ cross-compile किया जा सकता है। Cross-compiling करते समय static linking स्वचालित रूप से लागू होती है:
```
make CC=aarch64-linux-musl-gcc
```
सभी समर्थित cross-compilation targets बनाएँ (toolchains `PATH` में होने चाहिए):
```
make cross
```
## लाइसेंस
KASLD MIT लाइसेंस प्राप्त है (देखें [LICENSE](https://github.com/bcoles/kasld/blob/master/LICENSE))। कुछ leak components third-party proof-of-concept code को अनुकूलित करते हैं या अन्य लोगों द्वारा पहली बार प्रकाशित एक तकनीक को लागू करते हैं; ऐसी प्रत्येक फ़ाइल अपने header में अपने मूल लेखक और स्रोत का श्रेय देती है, और [THIRD-PARTY-NOTICES.md](https://github.com/bcoles/kasld/blob/master/THIRD-PARTY-NOTICES.md) प्रत्येक को उसके लाइसेंस या पुनःउपयोग आधार (upstream license, author permission, या यहाँ पुनःलागू की गई technique/reproducer सामग्री) के साथ सूचीबद्ध करता है।
## KASLD का उद्धरण देना
KASLD MIT लाइसेंस प्राप्त है — उपयोग के लिए attribution आवश्यक नहीं है, लेकिन जहाँ भी इसे शोध, tooling, exploits, या लेखन में संदर्भित किया जाए वहाँ एक citation या link की सराहना की जाती है:
> **KASLD: Kernel Address Space Layout Derandomization**, Brendan Coles,
> https://github.com/bcoles/kasld
BibTeX:
```bibtex
@software{kasld,
title = {KASLD: Kernel Address Space Layout Derandomization},
author = {Coles, Brendan},
url = {https://github.com/bcoles/kasld},
version = {0.4.1},
year = {2026}
}
```
GitHub [CITATION.cff](https://github.com/bcoles/kasld/blob/master/CITATION.cff) से एक *"Cite this repository"* बटन भी दिखाता है। `master` से किसी unreleased build के लिए, विशिष्ट commit और access की गई तिथि का उद्धरण दें — जैसे `bcoles/kasld@<commit>`
(accessed YYYY-MM-DD) — क्योंकि `-dev` version strings किसी एकल commit के लिए अद्वितीय नहीं होते।