_opName`**.
+
+Die objek is een van die volgende: `bpfdesc`, `cred`, `file`, `proc`, `vnode`, `mount`, `devfs`, `ifnet`, `inpcb`, `mbuf`, `ipq`, `pipe`, `sysv[msg/msq/shm/sem]`, `posix[shm/sem]`, `socket`, `kext`.\
+Die `opType` is gewoonlik check wat gebruik sal word om die aksie toe te laat of te weier. Dit is egter ook moontlik om `notify` te vind, wat die kext sal toelaat om op die gegewe aksie te reageer.
+
+You can find an example in [https://github.com/apple-oss-distributions/xnu/blob/94d3b452840153a99b38a3a9659680b2a006908e/bsd/kern/kern\_mman.c#L621](https://github.com/apple-oss-distributions/xnu/blob/94d3b452840153a99b38a3a9659680b2a006908e/bsd/kern/kern\_mman.c#L621):
+
+int
+mmap(proc_t p, struct mmap_args *uap, user_addr_t *retval)
+{
+[...]
+#if CONFIG_MACF
+ error = mac_file_check_mmap(vfs_context_ucred(ctx),
+ fp->fp_glob, prot, flags, file_pos + pageoff,
+&maxprot);
+if (error) {
+(void)vnode_put(vp);
+goto bad;
+}
+#endif /* MAC */
+[...]
+
+
+Then, it's possible to find the code of `mac_file_check_mmap` in [https://github.com/apple-oss-distributions/xnu/blob/94d3b452840153a99b38a3a9659680b2a006908e/security/mac\_file.c#L174](https://github.com/apple-oss-distributions/xnu/blob/94d3b452840153a99b38a3a9659680b2a006908e/security/mac\_file.c#L174)
+```c
+mac_file_check_mmap(struct ucred *cred, struct fileglob *fg, int prot,
+int flags, uint64_t offset, int *maxprot)
+{
+int error;
+int maxp;
+
+maxp = *maxprot;
+MAC_CHECK(file_check_mmap, cred, fg, NULL, prot, flags, offset, &maxp);
+if ((maxp | *maxprot) != *maxprot) {
+panic("file_check_mmap increased max protections");
+}
+*maxprot = maxp;
+return error;
+}
+```
+Wat die `MAC_CHECK` makro aanroep, waarvan die kode gevind kan word in [https://github.com/apple-oss-distributions/xnu/blob/94d3b452840153a99b38a3a9659680b2a006908e/security/mac\_internal.h#L261](https://github.com/apple-oss-distributions/xnu/blob/94d3b452840153a99b38a3a9659680b2a006908e/security/mac\_internal.h#L261)
+```c
+/*
+* MAC_CHECK performs the designated check by walking the policy
+* module list and checking with each as to how it feels about the
+* request. Note that it returns its value via 'error' in the scope
+* of the caller.
+*/
+#define MAC_CHECK(check, args...) do { \
+error = 0; \
+MAC_POLICY_ITERATE({ \
+if (mpc->mpc_ops->mpo_ ## check != NULL) { \
+DTRACE_MACF3(mac__call__ ## check, void *, mpc, int, error, int, MAC_ITERATE_CHECK); \
+int __step_err = mpc->mpc_ops->mpo_ ## check (args); \
+DTRACE_MACF2(mac__rslt__ ## check, void *, mpc, int, __step_err); \
+error = mac_error_select(__step_err, error); \
+} \
+}); \
+} while (0)
+```
+Wat al die geregistreerde mac-beleide sal deurgaan, hul funksies aanroep en die uitvoer binne die fout veranderlike stoor, wat slegs deur `mac_error_select` oorruilbaar sal wees deur sukses kodes, so as enige toets misluk, sal die volledige toets misluk en die aksie nie toegelaat word nie.
+
+{% hint style="success" %}
+Onthou egter dat nie alle MACF-aanroepings slegs gebruik word om aksies te weier nie. Byvoorbeeld, `mac_priv_grant` roep die makro [**MAC\_GRANT**](https://github.com/apple-oss-distributions/xnu/blob/94d3b452840153a99b38a3a9659680b2a006908e/security/mac\_internal.h#L274) aan, wat die aangevraagde voorreg sal toeken as enige beleid met 'n 0 antwoord gee:
+```c
+/*
+* MAC_GRANT performs the designated check by walking the policy
+* module list and checking with each as to how it feels about the
+* request. Unlike MAC_CHECK, it grants if any policies return '0',
+* and otherwise returns EPERM. Note that it returns its value via
+* 'error' in the scope of the caller.
+*/
+#define MAC_GRANT(check, args...) do { \
+error = EPERM; \
+MAC_POLICY_ITERATE({ \
+if (mpc->mpc_ops->mpo_ ## check != NULL) { \
+DTRACE_MACF3(mac__call__ ## check, void *, mpc, int, error, int, MAC_ITERATE_GRANT); \
+int __step_res = mpc->mpc_ops->mpo_ ## check (args); \
+if (__step_res == 0) { \
+error = 0; \
+} \
+DTRACE_MACF2(mac__rslt__ ## check, void *, mpc, int, __step_res); \
+} \
+}); \
+} while (0)
+```
+{% endhint %}
+
+### priv\_check & priv\_grant
+
+Hierdie aanroepe is bedoel om (tens of) **privileges** te kontroleer en te verskaf soos gedefinieer in [**bsd/sys/priv.h**](https://github.com/apple-oss-distributions/xnu/blob/94d3b452840153a99b38a3a9659680b2a006908e/bsd/sys/priv.h).\
+Sommige kernkode sal `priv_check_cred()` aanroep vanaf [**bsd/kern/kern\_priv.c**](https://github.com/apple-oss-distributions/xnu/blob/94d3b452840153a99b38a3a9659680b2a006908e/bsd/kern/kern\_priv.c) met die KAuth geloofsbriewe van die proses en een van die privileges kode wat `mac_priv_check` sal aanroep om te sien of enige beleid **weier** om die privilege te gee en dan roep dit `mac_priv_grant` aan om te sien of enige beleid die `privilege` toeken.
+
+### proc\_check\_syscall\_unix
+
+Hierdie haak laat toe om alle stelselaanroepe te onderskep. In `bsd/dev/[i386|arm]/systemcalls.c` is dit moontlik om die verklaarde funksie [`unix_syscall`](https://github.com/apple-oss-distributions/xnu/blob/94d3b452840153a99b38a3a9659680b2a006908e/bsd/dev/arm/systemcalls.c#L160C1-L167C25) te sien, wat hierdie kode bevat:
+```c
+#if CONFIG_MACF
+if (__improbable(proc_syscall_filter_mask(proc) != NULL && !bitstr_test(proc_syscall_filter_mask(proc), syscode))) {
+error = mac_proc_check_syscall_unix(proc, syscode);
+if (error) {
+goto skip_syscall;
+}
+}
+#endif /* CONFIG_MACF */
+```
+Wat die oproepende proses **bitmask** sal nagaan of die huidige syscall `mac_proc_check_syscall_unix` moet aanroep. Dit is omdat syscalls so gereeld aangeroep word dat dit interessant is om te probeer om `mac_proc_check_syscall_unix` nie elke keer aan te roep nie.
+
+Let daarop dat die funksie `proc_set_syscall_filter_mask()`, wat die bitmask syscalls in 'n proses stel, deur Sandbox aangeroep word om masks op gesandboksde prosesse te stel.
+
+## Blootgestelde MACF syscalls
+
+Dit is moontlik om met MACF te kommunikeer deur sommige syscalls wat in [security/mac.h](https://github.com/apple-oss-distributions/xnu/blob/94d3b452840153a99b38a3a9659680b2a006908e/security/mac.h#L151) gedefinieer is:
+```c
+/*
+* Extended non-POSIX.1e interfaces that offer additional services
+* available from the userland and kernel MAC frameworks.
+*/
+#ifdef __APPLE_API_PRIVATE
+__BEGIN_DECLS
+int __mac_execve(char *fname, char **argv, char **envv, mac_t _label);
+int __mac_get_fd(int _fd, mac_t _label);
+int __mac_get_file(const char *_path, mac_t _label);
+int __mac_get_link(const char *_path, mac_t _label);
+int __mac_get_pid(pid_t _pid, mac_t _label);
+int __mac_get_proc(mac_t _label);
+int __mac_set_fd(int _fildes, const mac_t _label);
+int __mac_set_file(const char *_path, mac_t _label);
+int __mac_set_link(const char *_path, mac_t _label);
+int __mac_mount(const char *type, const char *path, int flags, void *data,
+struct mac *label);
+int __mac_get_mount(const char *path, struct mac *label);
+int __mac_set_proc(const mac_t _label);
+int __mac_syscall(const char *_policyname, int _call, void *_arg);
+__END_DECLS
+#endif /*__APPLE_API_PRIVATE*/
+```
+## Verwysings
+
+* [**\*OS Internals Volume III**](https://newosxbook.com/home.html)
+
+{% hint style="success" %}
+Leer & oefen AWS Hacking:
[**HackTricks Opleiding AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)
\
+Leer & oefen GCP Hacking:
[**HackTricks Opleiding GCP Red Team Expert (GRTE)**
](https://training.hacktricks.xyz/courses/grte)
+
+
+
+Ondersteun HackTricks
+
+* Kyk na die [**subskripsie planne**](https://github.com/sponsors/carlospolop)!
+* **Sluit aan by die** 💬 [**Discord groep**](https://discord.gg/hRep4RUj7f) of die [**telegram groep**](https://t.me/peass) of **volg** ons op **Twitter** 🐦 [**@hacktricks\_live**](https://twitter.com/hacktricks\_live)**.**
+* **Deel hacking truuks deur PRs in te dien na die** [**HackTricks**](https://github.com/carlospolop/hacktricks) en [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github repos.
+
+
+{% endhint %}
diff --git a/macos-hardening/macos-security-and-privilege-escalation/macos-users.md b/macos-hardening/macos-security-and-privilege-escalation/macos-users.md
index dee65a1fb..e9a706f93 100644
--- a/macos-hardening/macos-security-and-privilege-escalation/macos-users.md
+++ b/macos-hardening/macos-security-and-privilege-escalation/macos-users.md
@@ -1,8 +1,8 @@
-# macOS Users
+# macOS Gebruikers & Eksterne Rekeninge
{% hint style="success" %}
-Leer & oefen AWS Hacking:
[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)
\
-Leer & oefen GCP Hacking:
[**HackTricks Training GCP Red Team Expert (GRTE)**
](https://training.hacktricks.xyz/courses/grte)
+Leer & oefen AWS Hacking:
[**HackTricks Opleiding AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)
\
+Leer & oefen GCP Hacking:
[**HackTricks Opleiding GCP Red Team Expert (GRTE)**
](https://training.hacktricks.xyz/courses/grte)
@@ -10,22 +10,19 @@ Leer & oefen GCP Hacking:
{% endhint %}
+## Algemene Gebruikers
-### Algemene gebruikers
-
-* **Daemon**: Gebruiker gereserveer vir stelseldemons. Die standaard demon rekeningname begin gewoonlik met 'n "\_":
+* **Daemon**: Gebruiker gereserveer vir stelseldemons. Die standaard daemon rekeningname begin gewoonlik met 'n "\_":
```bash
_amavisd, _analyticsd, _appinstalld, _appleevents, _applepay, _appowner, _appserver, _appstore, _ard, _assetcache, _astris, _atsserver, _avbdeviced, _calendar, _captiveagent, _ces, _clamav, _cmiodalassistants, _coreaudiod, _coremediaiod, _coreml, _ctkd, _cvmsroot, _cvs, _cyrus, _datadetectors, _demod, _devdocs, _devicemgr, _diskimagesiod, _displaypolicyd, _distnote, _dovecot, _dovenull, _dpaudio, _driverkit, _eppc, _findmydevice, _fpsd, _ftp, _fud, _gamecontrollerd, _geod, _hidd, _iconservices, _installassistant, _installcoordinationd, _installer, _jabber, _kadmin_admin, _kadmin_changepw, _knowledgegraphd, _krb_anonymous, _krb_changepw, _krb_kadmin, _krb_kerberos, _krb_krbtgt, _krbfast, _krbtgt, _launchservicesd, _lda, _locationd, _logd, _lp, _mailman, _mbsetupuser, _mcxalr, _mdnsresponder, _mobileasset, _mysql, _nearbyd, _netbios, _netstatistics, _networkd, _nsurlsessiond, _nsurlstoraged, _oahd, _ondemand, _postfix, _postgres, _qtss, _reportmemoryexception, _rmd, _sandbox, _screensaver, _scsd, _securityagent, _softwareupdate, _spotlight, _sshd, _svn, _taskgated, _teamsserver, _timed, _timezone, _tokend, _trustd, _trustevaluationagent, _unknown, _update_sharing, _usbmuxd, _uucp, _warmd, _webauthserver, _windowserver, _www, _wwwproxy, _xserverdocs
```
* **Gaste**: Rekening vir gaste met baie streng toestemmings
-
-{% code overflow="wrap" %}
```bash
state=("automaticTime" "afpGuestAccess" "filesystem" "guestAccount" "smbGuestAccess")
for i in "${state[@]}"; do sysadminctl -"${i}" status; done;
@@ -35,16 +32,21 @@ for i in "${state[@]}"; do sysadminctl -"${i}" status; done;
* **Niemand**: Prosesse word met hierdie gebruiker uitgevoer wanneer minimale toestemmings benodig word
* **Root**
-### Gebruikersregte
+## Gebruikersregte
-* **Standaard gebruiker:** Die mees basiese van gebruikers. Hierdie gebruiker benodig toestemmings wat van 'n admin-gebruiker toegestaan word wanneer hy probeer om sagteware te installeer of ander gevorderde take uit te voer. Hulle kan dit nie op hul eie doen nie.
-* **Admin-gebruiker**: 'n Gebruiker wat die meeste van die tyd as 'n standaard gebruiker werk, maar ook toegelaat word om root aksies uit te voer soos om sagteware te installeer en ander administratiewe take. Alle gebruikers wat tot die admin-groep behoort, **word toegang tot root gegee via die sudoers-lêer**.
+* **Standaard gebruiker:** Die mees basiese van gebruikers. Hierdie gebruiker benodig toestemmings wat deur 'n admin gebruiker toegestaan word wanneer hy probeer om sagteware te installeer of ander gevorderde take uit te voer. Hulle kan dit nie op hul eie doen nie.
+* **Admin gebruiker**: 'n Gebruiker wat die meeste van die tyd as 'n standaard gebruiker werk, maar ook toegelaat word om root aksies uit te voer soos om sagteware te installeer en ander administratiewe take. Alle gebruikers wat tot die admin-groep behoort, **kry toegang tot root via die sudoers-lêer**.
* **Root**: Root is 'n gebruiker wat toegelaat word om byna enige aksie uit te voer (daar is beperkings wat deur beskermings soos Stelselintegriteitsbeskerming opgelê word).
* Byvoorbeeld, root sal nie in staat wees om 'n lêer binne `/System` te plaas nie.
+## Eksterne Rekeninge
+
+MacOS ondersteun ook om in te log via eksterne identiteitsverskaffers soos FaceBook, Google... Die hoof daemon wat hierdie werk uitvoer is `accountsd` (`/System/Library/Frameworks/Accounts.framework//Versions/A/Support/accountsd`) en dit is moontlik om plugins wat vir eksterne autentisering gebruik word, binne die gids `/System/Library/Accounts/Authentication/` te vind.\
+Boonop kry `accountsd` die lys van rekeningsoorte van `/Library/Preferences/SystemConfiguration/com.apple.accounts.exists.plist`.
+
{% hint style="success" %}
-Learn & practice AWS Hacking:
[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)
\
-Learn & practice GCP Hacking:
[**HackTricks Training GCP Red Team Expert (GRTE)**
](https://training.hacktricks.xyz/courses/grte)
+Learn & practice AWS Hacking:
[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)
\
+Learn & practice GCP Hacking:
[**HackTricks Training GCP Red Team Expert (GRTE)**
](https://training.hacktricks.xyz/courses/grte)