DedSec Project

Compiler Toolchains, Sanitizers, CFI και Binary Hardening — DedSec Project

Compiler Toolchains, Sanitizers, CFI και Binary Hardening Ελληνική έκδοση — Μάθημα 099. Διατηρούνται οι διεθνείς τεχνικοί όροι όπου είναι ακριβέστεροι και ευκολότεροι στην αναζήτηση. Στόχος…

Ελληνική έκδοση — Μάθημα 099. Διατηρούνται οι διεθνείς τεχνικοί όροι όπου είναι ακριβέστεροι και ευκολότεροι στην αναζήτηση.

Στόχος του μαθήματος

Να κατανοήσεις σε βάθος το Compiler Toolchains, Sanitizers, CFI και Binary Hardening, να αναγνωρίζεις trust boundaries και failure states και να μπορείς να αποδείξεις ένα συμπέρασμα με ασφαλές, επαναλήψιμο evidence.

Βαθιές τεχνικές έννοιες

1. Undefined behavior

Σε C/C++ undefined behavior επιτρέπει optimizer να κάνει transformations που δεν ταιριάζουν με intuitive source reasoning. Security review χρειάζεται language rules, compiler/version και actual binary behavior.

2. Sanitizers

ASan/UBSan/TSan/MSan και άλλα diagnostics βρίσκουν διαφορετικές bug classes. Χρησιμοποίησέ τα σε tests/fuzzing και αντιμετώπισε report ως root-cause evidence, όχι exploit recipe.

3. Stack and object protections

Stack canaries, fortified APIs, safe-stack/object-size checks και hardened allocators δυσκολεύουν ή εντοπίζουν corruption. Δεν αντικαθιστούν memory-safe design και bounds correctness.

4. Control-flow integrity

CFI περιορίζει indirect control transfers σε επιτρεπόμενους targets σύμφωνα με type/control model. Coverage εξαρτάται από compiler, LTO, modules και native boundaries.

5. Linker hardening

PIE/ASLR support, RELRO, non-executable memory και symbol/link policy επηρεάζουν runtime attack surface. Verify actual binary properties αντί να υποθέτεις flags από build script.

6. LTO and optimization

Optimization/LTO αλλάζει inlining, layout και elimination, άρα sanitizer/reproduction behavior. Κράτησε debug symbols/build IDs και reproduce με release-like settings όταν χρειάζεται.

7. Toolchain provenance

Compiler/linker/build tools είναι supply-chain inputs. Pin trusted versions, verify provenance και isolate builds ώστε compromised toolchain να μην αλλοιώνει artifacts.

8. Regression strategy

Κάθε compiler-detected bug πρέπει να γίνει minimal test που αποτυγχάνει πριν fix και περνά μετά. Run σε relevant architectures/configurations ώστε optimization-dependent bugs να μην επιστρέφουν.

Καθοδηγούμενο εργαστήριο

  1. Compile a harmless toy C program with and without common hardening flags and inspect the resulting binary properties—without developing an exploit — εκτέλεσέ το μόνο στο isolated/owned lab και κατέγραψε before/after αποτέλεσμα.
  2. Use a sanitizer on intentionally buggy toy code to capture a diagnostic and explain root cause, object lifetime, and fix — εκτέλεσέ το μόνο στο isolated/owned lab και κατέγραψε before/after αποτέλεσμα.
  3. Create a build-metadata record containing compiler version, flags, source hash, dependency lock, and output digest — εκτέλεσέ το μόνο στο isolated/owned lab και κατέγραψε before/after αποτέλεσμα.

Πλήρες αγγλικό μάθημα

English Module 099